KS0713.h@0:1cfbf6b8d116, 2010-11-19 (annotated)
- Committer:
- tonydbeck
- Date:
- Fri Nov 19 23:48:18 2010 +0000
- Revision:
- 0:1cfbf6b8d116
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tonydbeck | 0:1cfbf6b8d116 | 1 | #ifndef GLCD_H |
tonydbeck | 0:1cfbf6b8d116 | 2 | #define GLCD_H |
tonydbeck | 0:1cfbf6b8d116 | 3 | |
tonydbeck | 0:1cfbf6b8d116 | 4 | #include "mbed.h" |
tonydbeck | 0:1cfbf6b8d116 | 5 | #include "bitmap.h" |
tonydbeck | 0:1cfbf6b8d116 | 6 | #include "font.h" |
tonydbeck | 0:1cfbf6b8d116 | 7 | |
tonydbeck | 0:1cfbf6b8d116 | 8 | |
tonydbeck | 0:1cfbf6b8d116 | 9 | |
tonydbeck | 0:1cfbf6b8d116 | 10 | class gLCD : public Stream { |
tonydbeck | 0:1cfbf6b8d116 | 11 | public: |
tonydbeck | 0:1cfbf6b8d116 | 12 | |
tonydbeck | 0:1cfbf6b8d116 | 13 | |
tonydbeck | 0:1cfbf6b8d116 | 14 | /* rst = Reset rs = Register Select e = Enable d0 - d7 = 8bit data bus */ |
tonydbeck | 0:1cfbf6b8d116 | 15 | |
tonydbeck | 0:1cfbf6b8d116 | 16 | gLCD(PinName rst, PinName rs, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, PinName d4, PinName d5, PinName d6, PinName d7, PinName led); |
tonydbeck | 0:1cfbf6b8d116 | 17 | |
tonydbeck | 0:1cfbf6b8d116 | 18 | |
tonydbeck | 0:1cfbf6b8d116 | 19 | #if DOXYGEN_ONLY |
tonydbeck | 0:1cfbf6b8d116 | 20 | int putc(int c); |
tonydbeck | 0:1cfbf6b8d116 | 21 | int printf(const char* format, ...); |
tonydbeck | 0:1cfbf6b8d116 | 22 | #endif |
tonydbeck | 0:1cfbf6b8d116 | 23 | |
tonydbeck | 0:1cfbf6b8d116 | 24 | |
tonydbeck | 0:1cfbf6b8d116 | 25 | |
tonydbeck | 0:1cfbf6b8d116 | 26 | /* locate(page address, column address) |
tonydbeck | 0:1cfbf6b8d116 | 27 | Function to locate a position on the display */ |
tonydbeck | 0:1cfbf6b8d116 | 28 | void locate(int page, int column); |
tonydbeck | 0:1cfbf6b8d116 | 29 | |
tonydbeck | 0:1cfbf6b8d116 | 30 | /* clearScreen() |
tonydbeck | 0:1cfbf6b8d116 | 31 | Function to clear entire display */ |
tonydbeck | 0:1cfbf6b8d116 | 32 | void clearScreen(); |
tonydbeck | 0:1cfbf6b8d116 | 33 | |
tonydbeck | 0:1cfbf6b8d116 | 34 | /* writeBitmap(name of bitmap array) |
tonydbeck | 0:1cfbf6b8d116 | 35 | Function to write a bitmap to the display */ |
tonydbeck | 0:1cfbf6b8d116 | 36 | void writeBitmap(const int *ptrBitmap); |
tonydbeck | 0:1cfbf6b8d116 | 37 | |
tonydbeck | 0:1cfbf6b8d116 | 38 | |
tonydbeck | 0:1cfbf6b8d116 | 39 | void locateChar(int page, int column); |
tonydbeck | 0:1cfbf6b8d116 | 40 | |
tonydbeck | 0:1cfbf6b8d116 | 41 | protected: |
tonydbeck | 0:1cfbf6b8d116 | 42 | |
tonydbeck | 0:1cfbf6b8d116 | 43 | virtual int _putc(int value); |
tonydbeck | 0:1cfbf6b8d116 | 44 | virtual int _getc(); |
tonydbeck | 0:1cfbf6b8d116 | 45 | |
tonydbeck | 0:1cfbf6b8d116 | 46 | /* writeCommand(Command to send to display) |
tonydbeck | 0:1cfbf6b8d116 | 47 | Function to write a command to the display |
tonydbeck | 0:1cfbf6b8d116 | 48 | RS is low for commands */ |
tonydbeck | 0:1cfbf6b8d116 | 49 | |
tonydbeck | 0:1cfbf6b8d116 | 50 | void writeCommand(int command); |
tonydbeck | 0:1cfbf6b8d116 | 51 | |
tonydbeck | 0:1cfbf6b8d116 | 52 | /* writeData(Data to send to display RAM) |
tonydbeck | 0:1cfbf6b8d116 | 53 | Function to send data to the display */ |
tonydbeck | 0:1cfbf6b8d116 | 54 | |
tonydbeck | 0:1cfbf6b8d116 | 55 | void writeData(int data); |
tonydbeck | 0:1cfbf6b8d116 | 56 | |
tonydbeck | 0:1cfbf6b8d116 | 57 | /* writeByte(Byte to send to the display via the data bus) |
tonydbeck | 0:1cfbf6b8d116 | 58 | Function to write a byte to the display */ |
tonydbeck | 0:1cfbf6b8d116 | 59 | |
tonydbeck | 0:1cfbf6b8d116 | 60 | void writeByte(int value); |
tonydbeck | 0:1cfbf6b8d116 | 61 | /*Initialize Digital Outputs for RS signal and E signal */ |
tonydbeck | 0:1cfbf6b8d116 | 62 | |
tonydbeck | 0:1cfbf6b8d116 | 63 | void writeChar5x8(int p, int col, int c); |
tonydbeck | 0:1cfbf6b8d116 | 64 | |
tonydbeck | 0:1cfbf6b8d116 | 65 | DigitalOut _rs, _e, _rst, _led; |
tonydbeck | 0:1cfbf6b8d116 | 66 | |
tonydbeck | 0:1cfbf6b8d116 | 67 | /*Initialize bus for data*/ |
tonydbeck | 0:1cfbf6b8d116 | 68 | |
tonydbeck | 0:1cfbf6b8d116 | 69 | BusOut _d; |
tonydbeck | 0:1cfbf6b8d116 | 70 | |
tonydbeck | 0:1cfbf6b8d116 | 71 | int _page; |
tonydbeck | 0:1cfbf6b8d116 | 72 | int _column; |
tonydbeck | 0:1cfbf6b8d116 | 73 | |
tonydbeck | 0:1cfbf6b8d116 | 74 | }; |
tonydbeck | 0:1cfbf6b8d116 | 75 | |
tonydbeck | 0:1cfbf6b8d116 | 76 | |
tonydbeck | 0:1cfbf6b8d116 | 77 | #endif |