I2C driver API.
This API is based on the Linux I2C User Space API . For a description of the I2C protocol see https://www.kernel.org/doc/Documentation/i2c/i2c-protocol.| msgs/1 | Communicate with the I2C bus. |
msgs(Msgs::[Adr::integer() | {sleep, Time::integer()} | {write, Data::binary()} | {write, Data::binary(), Flags::integer()} | {read, Length::integer()} | {read, Length::integer(), Flags::integer()}]) -> LastResponse::any()
Communicate with the I2C bus.
The first entry in the list has to be the address as an integer.
The entry {sleep, Time} can be used to add delays between messages.
For possible flags see the
Linux I2C User Space API
.
Sending a read message {read, Length} the I2C_M_RD flag will be set
automatcally. The Length is the number of bytes to be read.
1> grisp_i2c:msgs([16#40, {read, 2}]).
will send an I2C message with
addr = 16#40 flags = I2C_M_RD len = 2using the notation from https://www.kernel.org/doc/Documentation/i2c/i2c-protocol this message will look like:
S 16#40 Rd [A] [Data] A [Data] NA PA write message like
2> grisp_i2c:msgs([16#40, {write, <<16#02>>}]).
will send an I2C message with
addr = 16#40 flags = 16#0000 len = 1 *buf = 16#02using the notation from https://www.kernel.org/doc/Documentation/i2c/i2c-protocol this message will look like:
S 16#40 Wr [A] 16#02 P
Generated by EDoc