Giter Site home page Giter Site logo

How to address i2c slaves about libmpsse HOT 1 OPEN

roboknight avatar roboknight commented on August 30, 2024
How to address i2c slaves

from libmpsse.

Comments (1)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 30, 2024
 Posting a solution if anyone else gets perplexed like me ...

 Basically, you have to start writing to I2C with the address of slave SHIFTED 1 bit to the left (last bit 0 for writes, or 1 for reads) so the above code would be something like:

//writing part
 char Data={"\0x90\0x01\x11\x22"};
 Start(context);
 Write (Context,Data,4);  //equals ioctl and i2c_smbus_write_word_data above
 Stop(context);

//reading part
 Start(Context);
 Data[1]=\0x00;           // ADS1015_REG_POINTER_CONVERT=0x00
 Write (Context,Data,2);  //set the register for read
 Stop(context);
 Start(Context);
 Data[0]=\0x91;
 Write (Context,Data,1);  //State you want to read from address 0x48 (0x48<<1)|1
 Read (Context,2);        //read the word (2 bytes) of data
 Stop(Context);

Original comment by [email protected] on 19 Mar 2014 at 5:24

from libmpsse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.