Simple I2C test program. open/close/read/write supported.

Dependencies:   mbed vt100

Revision:
1:e105ceaee6ac
Parent:
0:1a2637f8e2dd
Child:
2:218e22a54982
--- a/dumb_i2c.cpp	Tue Feb 09 00:23:22 2016 +0000
+++ b/dumb_i2c.cpp	Tue Apr 05 02:11:20 2016 +0000
@@ -3,6 +3,8 @@
 
 DUMB_I2C::DUMB_I2C(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr<<1) {
     // activate the peripheral
+    freq = 100000 ; /* 100KHz */
+    m_i2c.frequency(freq) ;
 }
 
 DUMB_I2C::~DUMB_I2C() { }
@@ -12,6 +14,17 @@
     return( m_addr >> 1 ) ;
 }
 
+void DUMB_I2C::frequency(uint32_t f)
+{
+    freq = f ;
+    m_i2c.frequency(freq) ;
+}
+
+uint32_t DUMB_I2C::frequency(void)
+{
+    return(freq) ;
+}
+
 void DUMB_I2C::read(int addr, uint8_t *data, int len) 
 {
     readRegs(addr, data, len) ;