I2cLCD library that can display cursor.
Fork of I2cLCD by
I2cLCD.h@2:4e32baaf019b, 2014-02-17 (annotated)
- Committer:
- togayan
- Date:
- Mon Feb 17 08:13:14 2014 +0000
- Revision:
- 2:4e32baaf019b
- Parent:
- 1:f973d1359998
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:b3cc6ae3dfd8 | 1 | |
jksoft | 0:b3cc6ae3dfd8 | 2 | #ifndef MBED_I2CLCD_H |
jksoft | 0:b3cc6ae3dfd8 | 3 | #define MBED_I2CLCD_H |
jksoft | 0:b3cc6ae3dfd8 | 4 | |
jksoft | 0:b3cc6ae3dfd8 | 5 | #include "mbed.h" |
jksoft | 0:b3cc6ae3dfd8 | 6 | |
togayan | 1:f973d1359998 | 7 | class I2cLCD : public Stream |
togayan | 1:f973d1359998 | 8 | { |
jksoft | 0:b3cc6ae3dfd8 | 9 | public: |
jksoft | 0:b3cc6ae3dfd8 | 10 | |
jksoft | 0:b3cc6ae3dfd8 | 11 | enum IconType { |
jksoft | 0:b3cc6ae3dfd8 | 12 | Mark = 0x0001, |
jksoft | 0:b3cc6ae3dfd8 | 13 | Battery_1 = 0x0004, |
jksoft | 0:b3cc6ae3dfd8 | 14 | Battery_2 = 0x0002, |
jksoft | 0:b3cc6ae3dfd8 | 15 | Battery_3 = 0x0010, |
jksoft | 0:b3cc6ae3dfd8 | 16 | Battery_4 = 0x0008, |
jksoft | 0:b3cc6ae3dfd8 | 17 | NoSound = 0x0020, |
jksoft | 0:b3cc6ae3dfd8 | 18 | Lock = 0x0040, |
jksoft | 0:b3cc6ae3dfd8 | 19 | ArrowDown = 0x0080, |
jksoft | 0:b3cc6ae3dfd8 | 20 | ArrowUp = 0x0100, |
jksoft | 0:b3cc6ae3dfd8 | 21 | Input = 0x0200, |
jksoft | 0:b3cc6ae3dfd8 | 22 | Alarm = 0x0400, |
jksoft | 0:b3cc6ae3dfd8 | 23 | Tell = 0x0800, |
jksoft | 0:b3cc6ae3dfd8 | 24 | Antenna = 0x1000, |
jksoft | 0:b3cc6ae3dfd8 | 25 | }; |
jksoft | 0:b3cc6ae3dfd8 | 26 | |
togayan | 1:f973d1359998 | 27 | I2cLCD(I2C& i2c, PinName rp); |
jksoft | 0:b3cc6ae3dfd8 | 28 | #if DOXYGEN_ONLY |
jksoft | 0:b3cc6ae3dfd8 | 29 | int putc(int c); |
jksoft | 0:b3cc6ae3dfd8 | 30 | int printf(const char* format, ...); |
jksoft | 0:b3cc6ae3dfd8 | 31 | #endif |
jksoft | 0:b3cc6ae3dfd8 | 32 | void locate(int column, int row); |
jksoft | 0:b3cc6ae3dfd8 | 33 | void cls(); |
jksoft | 0:b3cc6ae3dfd8 | 34 | int rows(); |
jksoft | 0:b3cc6ae3dfd8 | 35 | int columns(); |
jksoft | 0:b3cc6ae3dfd8 | 36 | void seticon(IconType type); |
jksoft | 0:b3cc6ae3dfd8 | 37 | void clearicon(IconType type); |
jksoft | 0:b3cc6ae3dfd8 | 38 | void puticon(int flg); |
togayan | 2:4e32baaf019b | 39 | void cursor(bool isOn, int column, int row); |
togayan | 1:f973d1359998 | 40 | |
jksoft | 0:b3cc6ae3dfd8 | 41 | protected: |
jksoft | 0:b3cc6ae3dfd8 | 42 | virtual int _putc(int value); |
jksoft | 0:b3cc6ae3dfd8 | 43 | virtual int _getc(); |
jksoft | 0:b3cc6ae3dfd8 | 44 | |
jksoft | 0:b3cc6ae3dfd8 | 45 | int address(int column, int row); |
jksoft | 0:b3cc6ae3dfd8 | 46 | void character(int column, int row, int c); |
jksoft | 0:b3cc6ae3dfd8 | 47 | void writeCommand( int cmd ); |
jksoft | 0:b3cc6ae3dfd8 | 48 | void writeData( int data ); |
togayan | 1:f973d1359998 | 49 | |
jksoft | 0:b3cc6ae3dfd8 | 50 | DigitalOut _rs; |
togayan | 1:f973d1359998 | 51 | I2C& _i2c; |
jksoft | 0:b3cc6ae3dfd8 | 52 | int _column; |
jksoft | 0:b3cc6ae3dfd8 | 53 | int _row; |
togayan | 1:f973d1359998 | 54 | |
jksoft | 0:b3cc6ae3dfd8 | 55 | char contrast; |
jksoft | 0:b3cc6ae3dfd8 | 56 | int icon; |
togayan | 1:f973d1359998 | 57 | |
jksoft | 0:b3cc6ae3dfd8 | 58 | }; |
jksoft | 0:b3cc6ae3dfd8 | 59 | |
jksoft | 0:b3cc6ae3dfd8 | 60 | #endif |