Set of routines to access 16*32character LCD display on WattBob I board.
Dependents: Assignment_2_herpe Final_V1 ass2 ass2 ... more
Diff: WattBob_TextLCD.h
- Revision:
- 1:190b705fb9e1
- Parent:
- 0:e5b7c70254ac
- Child:
- 2:1cba2dd23d65
--- a/WattBob_TextLCD.h Sun Nov 28 22:47:51 2010 +0000 +++ b/WattBob_TextLCD.h Mon Nov 29 14:22:52 2010 +0000 @@ -14,17 +14,58 @@ #define E_BIT 5 #define BL_BIT 4 +/** Class to access 16*2 LCD display connected to an MCP23017 I/O extender chip + * + * Derived from the "stream" class to be able to use methods such as "printf" + * + * Example : + * @code + * MCP23017 *par_port; + * WattBob_TextLCD *lcd; + * ..... + * + * par_port->write_bit(1,BL_BIT); // turn LCD backlight ON + * lcd->cls(); lcd->locate(0,0); + * lcd->printf("%s", message); + * lcd->locate(1,0);lcd->printf("press 1 to cont"); + * @endcode + */ class WattBob_TextLCD : public Stream { public: - WattBob_TextLCD(MCP23017 *port); // constructor - + /** Create TextLCD object connected to a MCP23017 device + * + * @param port pointer to MCP23017 object + */ + WattBob_TextLCD(MCP23017 *port); + + /** Set cursor to a known point + * + * Virtual function for stream class + * + * @param row integer row number (0 or 1) + * @param col integer column number (0 or 15) + */ virtual void locate(int row, int column); - virtual void cls(); + + /** clear display + * + * Virtual function for stream class + */ + virtual void cls(); + + /** reset the display + * + * Virtual function for stream class + */ virtual void reset(); protected: + virtual int _putc(int c); + virtual int _getc(); + virtual void newline(); + void clock(); void writeData(int data); void writeCommand(int command); @@ -35,11 +76,7 @@ void _rw (int data); void _e (int data); void _d (int data); - - virtual int _putc(int c); - virtual int _getc(); - virtual void newline(); - + int _rows; int _columns; int _row;