Diff: I2CTextLCD.h
- Revision:
- 2:1c5dea5d8783
- Parent:
- 1:0eb3365ec819
- Child:
- 3:704f87be7993
--- a/I2CTextLCD.h Sun Dec 19 19:19:39 2010 +0000 +++ b/I2CTextLCD.h Thu Dec 23 12:42:37 2010 +0000 @@ -10,28 +10,9 @@ #include "mbed.h" #include "Stream.h" -/* The code assumes the following connections between the PCF8575 -* and the LCD -* -* nc - D0 -* nc - D1 -* nc - D2 -* nc - D3 -* P0 - D4 -* P1 - D5 -* P2 - D6 -* P3 - D7 -* P4 - E -* P5 - nc -* P6 - nc -* P7 - RS -* gnd - R/W - -*/ - -#define E_ON 0x10 //P4 +#define E_ON 0x10 //P4 #define BACKLIGHT_ON 0x20 //P5 -#define RS_ON 0x80 //P7 +#define RS_ON 0x80 //P7 namespace mbed { @@ -42,7 +23,7 @@ * turned in to a more generic libray. * * If you are connecting multiple displays, you can connect them all in - * parallel except for the enable (e) pin, which must be unique for each + * parallel, the address of the PCF8575 or PCF8574 must be unique for each * display. * * Example: @@ -59,18 +40,25 @@ public: /* Constructor: I2CTextLCD - * Create a I2CTextLCD object, connected to the specified pins + * Create a I2CTextLCD object * - * All signals must be connected to DigitalIn compatible pins. + * wiring * - * Variables: - * rs - Used to specify data or command - * rw - Used to determine read or write - * e - enable - * d0..d3 - The data lines + * PCF8575/PCF8574 to LCD + * ---------------------- + * P0 - D4 + * P1 - D5 + * P2 - D6 + * P3 - D7 + * P4 - E + * P5 - backlight (connected to a relay) + * P6 - nc + * P7 - RS + * gnd - R/W + * */ - I2CTextLCD(PinName sda, PinName scl, int address, int columns = 16, int rows = 2); + I2CTextLCD(PinName sda, PinName scl, int address, int columns = 16, int rows = 2, bool backlight = true); #if 0 // Inhereted from Stream, for documentation only /* Function: putc @@ -106,6 +94,13 @@ virtual void cls(); virtual void reset(); + + /* Function: backlight + * Sets the backlight on or off + * + * Variables: + * on (true or false) + */ virtual void backlight(bool on); protected: @@ -129,10 +124,11 @@ I2C _i2c; int _i2cAddress; bool _backlight; - + + private: - + };