[Tinyos-2-commits] CVS: tinyos-2.x/tos/interfaces I2CPacket.nc,
1.1.2.3, 1.1.2.4
Philip Buonadonna
philipb at users.sourceforge.net
Thu May 25 17:39:58 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/interfaces
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14687/interfaces
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
I2CPacket.nc
Log Message:
- Extended interface to acommodate repeated STARTS and multiple API calls
per I2C transaction.
- Added i2c_flags_t definition
- Added support for 10-bit addressing.
Index: I2CPacket.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/interfaces/Attic/I2CPacket.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** I2CPacket.nc 27 Feb 2006 22:00:42 -0000 1.1.2.3
--- I2CPacket.nc 26 May 2006 00:39:55 -0000 1.1.2.4
***************
*** 25,52 ****
* The address, length, and buffer must be specified. The I2C bus then
* has control of that buffer and returns it when the operation has
! * completed. The I2CPacket interface only supports master-mode communication
! * and single tranfers (a start and stop condition are transmitted for
! * every packet operation).
*
* @author Joe Polastre
* Revision: $Revision$
*/
interface I2CPacket {
/**
* Perform an I2C read operation
*/
! async command error_t readPacket(uint16_t _addr, uint8_t _length, uint8_t* _data);
/**
* Perform an I2C write operation
*/
! async command error_t writePacket(uint16_t _addr, uint8_t _length, uint8_t* _data);
/**
* Notification that the read operation has completed
*/
! async event void readPacketDone(uint16_t addr, uint8_t length, uint8_t* data, error_t success);
/**
* Notification that the write operation has completed
*/
! async event void writePacketDone(uint16_t addr, uint8_t length, uint8_t* data, error_t success);
}
--- 25,92 ----
* The address, length, and buffer must be specified. The I2C bus then
* has control of that buffer and returns it when the operation has
! * completed. The I2CPacket interface supports master-mode communication
! * and provides for multiple repeated STARTs and multiple reads/writes
! * within the same START transaction.
*
* @author Joe Polastre
+ * @author Phil Buonadonna <pbuonadonna at archrock.com>
* Revision: $Revision$
*/
+
interface I2CPacket {
/**
* Perform an I2C read operation
+ *
+ * @param addr The slave device address
+ * @param length Length, in bytes, to be read
+ * @param data A point to a data buffer to read into
+ * @param flags Flags that may be logical ORed and defined by:
+ * START_FLAG - The START condition is transmitted at the beginning
+ * of the packet if set.
+ * STOP_FLAG - The STOP condition is transmitted at the end of the
+ * packet if set.
+ * ACK_END_FLAG - ACK the last byte if set. Otherwise NACK last byte. This
+ * flag cannot be used with the STOP_FLAG.
+ * ADDR10_FLAG - Slave device address is 10-bit if set. 7-bit if not set.
+ *
+ * @return SUCCESS if bus available and request accepted.
*/
! async command error_t read(uint16_t addr, uint8_t length, uint8_t* data, i2c_flags_t flags);
!
/**
* Perform an I2C write operation
+ *
+ * @param addr The slave device address
+ * @param length Length, in bytes, to be read
+ * @param data A point to a data buffer to read into
+ * @param flags Flags that may be logical ORed and defined by:
+ * START_FLAG - The START condition is transmitted at the beginning
+ * of the packet if set.
+ * STOP_FLAG - The STOP condition is transmitted at the end of the
+ * packet if set.
+ * ADDR10_FLAG - Slave device address is 10-bit if set. 7-bit if not set.
+ *
+ * @return SUCCESS if bus available and request accepted.
*/
! async command error_t write(uint16_t addr, uint8_t length, uint8_t* data, i2c_flags_t flags);
/**
* Notification that the read operation has completed
+ *
+ * @param addr The slave device address
+ * @param length Length, in bytes, read
+ * @param data Pointer to the received data buffer
+ * @param success SUCCESS if transfer completed without error.
*/
! async event void readDone(uint16_t addr, uint8_t length, uint8_t* data, error_t success);
!
/**
* Notification that the write operation has completed
+ *
+ * @param addr The slave device address
+ * @param length Length, in bytes, written
+ * @param data Pointer to the data buffer written
+ * @param success SUCCESS if transfer completed without error.
*/
! async event void writeDone(uint16_t addr, uint8_t length, uint8_t* data, error_t success);
}
More information about the Tinyos-2-commits
mailing list