Set of routines to access 16*32character LCD display on WattBob I board.
Dependents: Assignment_2_herpe Final_V1 ass2 ass2 ... more
WattBob_TextLCD.h@0:e5b7c70254ac, 2010-11-28 (annotated)
- Committer:
- jimherd
- Date:
- Sun Nov 28 22:47:51 2010 +0000
- Revision:
- 0:e5b7c70254ac
- Child:
- 1:190b705fb9e1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jimherd | 0:e5b7c70254ac | 1 | /* draft mbed TextLCD |
jimherd | 0:e5b7c70254ac | 2 | * (c) 2007/8, sford |
jimherd | 0:e5b7c70254ac | 3 | */ |
jimherd | 0:e5b7c70254ac | 4 | |
jimherd | 0:e5b7c70254ac | 5 | #ifndef WATTBOB_TEXTLCD_H |
jimherd | 0:e5b7c70254ac | 6 | #define WATTBOB_TEXTLCD_H |
jimherd | 0:e5b7c70254ac | 7 | |
jimherd | 0:e5b7c70254ac | 8 | #include "mbed.h" |
jimherd | 0:e5b7c70254ac | 9 | #include "Stream.h" |
jimherd | 0:e5b7c70254ac | 10 | #include "MCP23017.h" |
jimherd | 0:e5b7c70254ac | 11 | |
jimherd | 0:e5b7c70254ac | 12 | #define RS_BIT 7 |
jimherd | 0:e5b7c70254ac | 13 | #define RW_BIT 6 |
jimherd | 0:e5b7c70254ac | 14 | #define E_BIT 5 |
jimherd | 0:e5b7c70254ac | 15 | #define BL_BIT 4 |
jimherd | 0:e5b7c70254ac | 16 | |
jimherd | 0:e5b7c70254ac | 17 | class WattBob_TextLCD : public Stream { |
jimherd | 0:e5b7c70254ac | 18 | |
jimherd | 0:e5b7c70254ac | 19 | public: |
jimherd | 0:e5b7c70254ac | 20 | WattBob_TextLCD(MCP23017 *port); // constructor |
jimherd | 0:e5b7c70254ac | 21 | |
jimherd | 0:e5b7c70254ac | 22 | virtual void locate(int row, int column); |
jimherd | 0:e5b7c70254ac | 23 | virtual void cls(); |
jimherd | 0:e5b7c70254ac | 24 | virtual void reset(); |
jimherd | 0:e5b7c70254ac | 25 | |
jimherd | 0:e5b7c70254ac | 26 | protected: |
jimherd | 0:e5b7c70254ac | 27 | |
jimherd | 0:e5b7c70254ac | 28 | void clock(); |
jimherd | 0:e5b7c70254ac | 29 | void writeData(int data); |
jimherd | 0:e5b7c70254ac | 30 | void writeCommand(int command); |
jimherd | 0:e5b7c70254ac | 31 | void writeByte(int value); |
jimherd | 0:e5b7c70254ac | 32 | void writeNibble(int value); |
jimherd | 0:e5b7c70254ac | 33 | |
jimherd | 0:e5b7c70254ac | 34 | void _rs (int data); |
jimherd | 0:e5b7c70254ac | 35 | void _rw (int data); |
jimherd | 0:e5b7c70254ac | 36 | void _e (int data); |
jimherd | 0:e5b7c70254ac | 37 | void _d (int data); |
jimherd | 0:e5b7c70254ac | 38 | |
jimherd | 0:e5b7c70254ac | 39 | virtual int _putc(int c); |
jimherd | 0:e5b7c70254ac | 40 | virtual int _getc(); |
jimherd | 0:e5b7c70254ac | 41 | virtual void newline(); |
jimherd | 0:e5b7c70254ac | 42 | |
jimherd | 0:e5b7c70254ac | 43 | int _rows; |
jimherd | 0:e5b7c70254ac | 44 | int _columns; |
jimherd | 0:e5b7c70254ac | 45 | int _row; |
jimherd | 0:e5b7c70254ac | 46 | int _column; |
jimherd | 0:e5b7c70254ac | 47 | |
jimherd | 0:e5b7c70254ac | 48 | private: |
jimherd | 0:e5b7c70254ac | 49 | MCP23017 *par_port; |
jimherd | 0:e5b7c70254ac | 50 | }; |
jimherd | 0:e5b7c70254ac | 51 | |
jimherd | 0:e5b7c70254ac | 52 | #endif |