Giter Site home page Giter Site logo

I2C data-address about iot HOT 6 CLOSED

dotnet avatar dotnet commented on July 28, 2024
I2C data-address

from iot.

Comments (6)

deinok avatar deinok commented on July 28, 2024 1

@joperezr Yes, thanks. In my case I will add an extension method for my specific device.

from iot.

joperezr avatar joperezr commented on July 28, 2024

If by this you mean the I2c Address, then this is set in the I2cConnectionSettings.DeviceAddress. The way it works is that you would generate a I2cConnectionSettings object, and then pass that in to the constructor of the UnixI2cDevice, for example:

var settings = new I2cConnectionSettings(busId: 0, deviceAddress: 0x77);
var myI2cDevyce = new UnixI2cDevice(settings);

from iot.

deinok avatar deinok commented on July 28, 2024

@joperezr In my case I use for now the following i2cset -y 1 0x69 0x00 0xFF && i2cset -y 1 0x69 0x01 0x00 && i2cset -y 1 0x69 0x02 0x00 for set a led to red.
As you can see, 1 is busId, 0x69 is for deviceAddress, 0x00, 0x01, 0x02 is for registers or data-address and at the end we have the RGB value.

I'm not sure, but I think that writting a byte array with the register and value works well. Could we add a method to simplificate this?

from iot.

joperezr avatar joperezr commented on July 28, 2024

reading a register from a device is not strictly standard. For example, there are some devices that in order to read register 0x00, the way you do it is that you first write 0x00 to the i2c bus chain, then you wait for one cycle, and then you read from that bus chain. There are other devices that behave different, where in order to read register 0x00, you have to first write the register you want to read with the 8-th bit flipped to 1 to the i2c bus chain and then read from it, so you would write 0x80 in order to read register 0x00. What I mean is that it wouldn't be possible to have a standard function like:

byte readRegister(byte registerAddress);
void writeRegister(byte registerAddress, byte data);

because the way to read and write registers is not standard for all devices. Today, UnixI2cDevice provides a way to Read and Write from the i2cBus chain, but each device needs to implement how reading a register is performed in that particular device (based on the device's datasheet).

Does that make sense?

from iot.

joperezr avatar joperezr commented on July 28, 2024

cool. I plan on adding some Spi and I2c device bindings as an example of the API consumption soon 😄

from iot.

deinok avatar deinok commented on July 28, 2024

Cool. If you need it, I could give bindings for https://www.access-is.com/products/val100

from iot.

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.