Jump to content
43oh

[SOLVED] Software / Bit-bang I2C library for Energia


Recommended Posts

The P1_6 and P1_7 pins are already used for SPI and I need an I2C connection.

 

So I'm looking for a bit-bang I2C library, for Energia.

 

I've found RobG library at http://forum.43oh.com/topic/441-serial-eeprom/?p=3876 but I'm facing big issues when I try to port it to Energia.

 

Thank you for your help.

Link to post
Share on other sites
  • 1 month later...
  • 1 month later...

After a lot of work, especially with a logic analyser, I changed the delay functions for the more precise

 

#define TICKS_PER_MS (F_CPU / 1000)
#define TICKS_PER_US (TICKS_PER_MS / 1000)

///
/// @brief	delayI2Cms
/// @param	delay number of milliseconds
///
void delayI2Cms(uint16_t delay)

{
    while (delay--) __delay_cycles(TICKS_PER_MS);
}

///
/// @brief	delayI2Cus
/// @param	delay number of microseconds
///
void delayI2Cus(uint16_t delay)
{
    while (delay--) __delay_cycles(TICKS_PER_US);
}

 

After many tests, the library is available at http://forum.43oh.com/topic/3619-energia-library-software-i%C2%B2c-master-for-msp430g2553/?p=32365'>[Energia Library] Software I

Link to post
Share on other sites

hehe i was actualy looking at that sensor before.

 

a litle question. If the stellarpad is 5V tolerant does it mean i don't need that circuit to interface the srf10?

 

and is there anyway that works with analog signals? changing from 5V to 3.3V MCU is kinda of a pain

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...