Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AdaFruit_RGBLCDShield MCP23017 mbed RTclock
Fork of MCP_test by
Diff: AdaFruit_RGBLCDShield.cpp
- Revision:
- 6:a6be2aede8f2
- Parent:
- 5:6c9ee7e3a20c
diff -r 6c9ee7e3a20c -r a6be2aede8f2 AdaFruit_RGBLCDShield.cpp
--- a/AdaFruit_RGBLCDShield.cpp Sat Aug 02 14:16:30 2014 +0000
+++ b/AdaFruit_RGBLCDShield.cpp Sat Aug 02 16:05:40 2014 +0000
@@ -19,7 +19,7 @@
#include <string.h>
#include <inttypes.h>
-// New MBED code
+// New MBED code to handle porting
#define OUTPUT DIR_OUTPUT
#define INPUT DIR_INPUT
@@ -67,9 +67,10 @@
// MBED - wired in serial
// MBED - wired in _i2c
-Adafruit_RGBLCDShield::Adafruit_RGBLCDShield(MCP23017 & inMCP)
+Adafruit_RGBLCDShield::Adafruit_RGBLCDShield(MCP23017 & inMCP, Serial & inSerial)
: Serial(SERIAL_TX, SERIAL_RX)
, _i2c(inMCP)
+ , _debug(inSerial)
{
_i2cAddr = 0;
@@ -127,16 +128,20 @@
begin(16, 1);
}
-void Adafruit_RGBLCDShield::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
+void Adafruit_RGBLCDShield::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
// check if i2c
if (_i2cAddr != 255) {
+ _debug.printf("Adafruit_RGBLCDShield::begin() - I2C ON\n\r");
+
//_i2c.begin(_i2cAddr);
//WIRE.begin();
+
_i2c.reset();
-
+
_i2c.pinMode(8, OUTPUT);
_i2c.pinMode(6, OUTPUT);
_i2c.pinMode(7, OUTPUT);
+
setBacklight(0x7);
if (_rw_pin)
@@ -218,7 +223,7 @@
command(LCD_FUNCTIONSET | _displayfunction);
// turn the display on with no cursor or blinking default
- _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
+ _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
display();
// clear it off
@@ -228,7 +233,6 @@
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode
command(LCD_ENTRYMODESET | _displaymode);
-
}
/********** high level commands, for the user! */
@@ -465,3 +469,14 @@
}
return reply;
}
+
+void Adafruit_RGBLCDShield::debugWait(const char * inMessage)
+{
+ _debug.printf("Wait: %s", inMessage);
+
+ while (0 == readButtons()) {
+ wait(0.2);
+ }
+
+ _debug.printf(" DONE\r\n");
+}
