a

Fork of mbed by -deleted-

Revision:
20:029aa53d7323
Parent:
12:f63353af7be8
Child:
21:3944f1e2fa4f
diff -r e6be4cd80aad -r 029aa53d7323 I2C.h
--- a/I2C.h	Tue May 18 16:04:21 2010 +0000
+++ b/I2C.h	Thu Jun 03 11:17:50 2010 +0000
@@ -17,7 +17,7 @@
  *  An I2C Master, used for communicating with I2C slave devices
  *
  * Example:
- * > // Read from I2C slave at address 0x1234
+ * > // Read from I2C slave at address 0x62
  * >
  * > #include "mbed.h"
  * >
@@ -33,6 +33,13 @@
 
 public:
 
+    enum RxStatus {
+        NoData
+        , MasterGeneralCall
+        , MasterWrite
+        , MasterRead
+    };
+
     /* Constructor: I2C
      *  Create an I2C Master interface, connected to the specified pins
      *
@@ -60,9 +67,10 @@
      *  address - 8-bit I2C slave address [ addr | 1 ]
      *  data - Pointer to the byte-array to read data in to 
      *  length - Number of bytes to read
+     *  repeated - Repeated start, true - don't send stop at end
      *  returns - 0 on success (ack), or non-0 on failure (nack)
      */ 
-    int read(int address, char *data, int length); 
+    int read(int address, char *data, int length, bool repeated = false); 
 
     /* Function: write
      *  Write to an I2C slave
@@ -74,17 +82,18 @@
      *  address - 8-bit I2C slave address [ addr | 0 ]
      *  data - Pointer to the byte-array data to send 
      *  length - Number of bytes to send
+     *  repeated - Repeated start, true - do not send stop at end
      *  returns - 0 on success (ack), or non-0 on failure (nack)
      */ 
-    int write(int address, const char *data, int length);
+    int write(int address, const char *data, int length, bool repeated = false);
     
 protected:
 
-    I2CName _i2c;
-    
     void aquire();
-    static I2C *_owner;
-    int _hz;
+
+    I2CName     _i2c;
+    static I2C  *_owner;
+    int         _hz;
 
 };