Fork of the official mbed C/C++ SDK provides the software platform and libraries to build your applications. The fork has the documentation converted to Doxygen format

Dependents:   NervousPuppySprintOne NervousPuppySprint2602 Robot WarehouseBot1 ... more

Fork of mbed by mbed official

Revision:
21:3944f1e2fa4f
Parent:
20:029aa53d7323
Child:
22:9114680c05da
--- a/I2C.h	Thu Jun 03 11:17:50 2010 +0000
+++ b/I2C.h	Thu Jun 17 16:23:14 2010 +0000
@@ -40,6 +40,11 @@
         , MasterRead
     };
 
+    enum Acknowledge {
+          NoACK = 0
+        , ACK   = 1
+    };
+
     /* Constructor: I2C
      *  Create an I2C Master interface, connected to the specified pins
      *
@@ -72,6 +77,15 @@
      */ 
     int read(int address, char *data, int length, bool repeated = false); 
 
+    /* Function: read
+     *  Read a single byte from the I2C bus
+     *
+     * Variables:
+     *  ack - indicates if the byte is to be acknowledged (1 = acknowledge)
+     *  returns - the byte read
+     */
+    int read(int ack);
+
     /* Function: write
      *  Write to an I2C slave
      *
@@ -86,7 +100,27 @@
      *  returns - 0 on success (ack), or non-0 on failure (nack)
      */ 
     int write(int address, const char *data, int length, bool repeated = false);
-    
+
+    /* Function: write
+     *  Write single byte out on the I2C bus
+     *
+     * Variables:
+     *  data - data to write out on bus
+     *  returns - a '1' if an ACK was retrieved, a '0' otherwise
+     */
+    int write(int data);
+
+    /* Function: start
+     *  Creates a start condition on the I2C bus
+     */
+
+    void start(void);
+
+    /* Function: stop
+     *  Creates a stop condition on the I2C bus
+     */
+    void stop(void);
+
 protected:
 
     void aquire();