Jump to content
Sign in to follow this  

[Energia Library] I2C_API on Energia

Recommended Posts

*This is untested and needs testing, i don't have access to any I2C devices currently infortunaly, only next week*



I ran into this while exploring stellaris features:



It's a very nice API to use the 4 I2C modules in the stellarpad.

Since i had some problems with the Wire library, both getting diferent modules to work or get proper data from a srf08/srf10 i decided to implement this on my energia files.


It ended up like this:


This is what you have to add to make it work. It includes a utils/uartstdio


Gona test a bit with some I2C sensors i have but it would be nice to someone test them with some other I2C ICs.


Any sugestions would be appreciated


PS: i just made some tweaks so it works like a library in Energia for the Stellarpad. I take no credit for the API made since it exists for quite some time.

Share this post

Link to post
Share on other sites

Ok now it's tested and working and here it's in the link i pasted in the previous reply. But how do i actualy make a download link for the zip like i see other people do?


It includes a working example with srf08. In this one i can get distances over the 70cm and until the max range of it and also i get very stable values (i had this problem with wire library, limited until 70cm and very erratic values).


It supports all I2C modules in both 100kbps and 400kbps mode.

The original API includes a search for bus function but it isn't working here.


Also i have a problem. It doesnt unable the library to work but it should be done in other way.


I had to add in the I2C_Stellaris_API.cpp so i could use multiple modules, any module besides I2C0 has mux

    #define GPIO_PD1_I2C3SDA 0x00030403
    #define GPIO_PD0_I2C3SCL 0x00030003
    #define GPIO_PE4_I2C2SCL 0x00041003
    #define GPIO_PE5_I2C2SDA 0x00041403
    #define GPIO_PA7_I2C1SDA 0x00001C03
    #define GPIO_PA6_I2C1SCL 0x00001803

But this is in "driverlib/pin_map.h". 

Anyone can help me with that?



TODO (or untested), 

Use multime I2C modules at the same time

Make it work with MAX6956 

Share this post

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.

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.

Sign in to follow this  

  • Create New...