Interface: moteiv.tos.platform.msp430.MSP430I2CPacket
interface MSP430I2CPacket
MSP430I2CPacket provides commands for reading and writing a series of
bytes across an I2C interface.
You must acquire a handle for the I2C interface before using it,
otherwise your operations will fail. Use the
I2CResourceC
generic component to request the resource
when it is needed.
- Author:
-
Joe Polastre, Moteiv Corporation <info@moteiv.com>
Commands
command result_t readPacket(uint8_t rh, uint16_t addr, uint8_t length, uint8_t *data)
command result_t writePacket(uint8_t rh, uint16_t addr, uint8_t length, uint8_t *data)
Events
event void readPacketDone(uint16_t addr, uint8_t length, uint8_t *data, result_t success)
event void writePacketDone(uint16_t addr, uint8_t length, uint8_t *data, result_t success)
Commands - Details
readPacket
command result_t readPacket(uint8_t rh, uint16_t addr, uint8_t length, uint8_t *data)
- Parameters:
-
rh
- Resource handle for the I2C bus is required before use.
-
addr
- Address of the slave I2C device.
-
length
- Number of bytes to read from the device.
-
data
- Pointer to the location where data should be stored.
- Returns:
-
SUCCESS if the operation has successfully started.
writePacket
command result_t writePacket(uint8_t rh, uint16_t addr, uint8_t length, uint8_t *data)
- Parameters:
-
rh
- Resource handle for the I2C bus is required before use.
-
addr
- Address of the slave I2C device.
-
length
- Number of bytes to write to the device.
-
data
- Pointer to the location of data to send.
- Returns:
-
SUCCESS if the operation has successfully started.
Events - Details
readPacketDone
event void readPacketDone(uint16_t addr, uint8_t length, uint8_t *data, result_t success)
- Parameters:
-
addr
- Address of the slave I2C device.
-
length
- Number of bytes to write to the device.
-
data
- Pointer to the location where data should be stored.
-
success
- Result of the operation.
writePacketDone
event void writePacketDone(uint16_t addr, uint8_t length, uint8_t *data, result_t success)
- Parameters:
-
addr
- Address of the slave I2C device.
-
length
- Number of bytes to write to the device.
-
data
- Pointer to the location of data to send.
-
success
- Result of the operation.