Justin Howard / Mbed 2 deprecated AdaFruit_RGBLCD

Dependencies:   AdaFruit_RGBLCDShield MCP23017 mbed RTclock

Dependents:   SX1276_GPS

Fork of MCP_test by Wim Huiskamp

Revision:
5:6c9ee7e3a20c
Parent:
4:d70e37f6c6bd
Child:
6:a6be2aede8f2
--- a/AdaFruit_RGBLCDShield.cpp	Sat Aug 02 13:50:40 2014 +0000
+++ b/AdaFruit_RGBLCDShield.cpp	Sat Aug 02 14:16:30 2014 +0000
@@ -28,7 +28,9 @@
 
 #define delayMicroseconds(a) wait(a / 1000000)
 
-/* Remove Arduino i2c (wire) interface
+/* MBED TURNED OFF
+
+Arduino i2c (wire) interface
 
 #include <Wire.h>
 #ifdef __AVR__
@@ -63,6 +65,8 @@
 // can't assume that its in that state when a sketch starts (and the
 // RGBLCDShield constructor is called).
 
+// MBED - wired in serial
+// MBED - wired in _i2c
 Adafruit_RGBLCDShield::Adafruit_RGBLCDShield(MCP23017 & inMCP)
     : Serial(SERIAL_TX, SERIAL_RX)
     , _i2c(inMCP)
@@ -128,7 +132,7 @@
   if (_i2cAddr != 255) {
     //_i2c.begin(_i2cAddr);
     //WIRE.begin();
-    //_i2c->begin();
+    _i2c.reset();
 
     _i2c.pinMode(8, OUTPUT);
     _i2c.pinMode(6, OUTPUT);
@@ -143,12 +147,14 @@
     for (uint8_t i=0; i<4; i++) 
       _i2c.pinMode(_data_pins[i], OUTPUT);
 
+    unsigned short nPullups = 0;
     for (uint8_t i=0; i<5; i++) {
       _i2c.pinMode(_button_pins[i], INPUT);
+      nPullups |= (1 << _button_pins[i]);
       //_i2c.pullUp(_button_pins[i], 1);
     }
     
-    _i2c.internalPullupMask(0xffff);
+    _i2c.internalPullupMask(nPullups);
   }
 
   if (lines > 1) {
@@ -349,7 +355,7 @@
     _i2c.digitalWrite(p, d);
   } else {
     // straightup IO
-    // @@@ TURNED OFF @@@
+    // MBED TURNED OFF
     //digitalWrite(p, d);
   }
 }
@@ -369,7 +375,7 @@
     _i2c.pinMode(p, d);
   } else {
     // straightup IO
-    //@@@ TURNED OFF @@@
+    // MBED TURNED OFF
     //pinMode(p, d);
   }
 }