128x64 grafical display with KS0107B and KS0108B controller
Display.h@0:45771b38d50d, 2009-11-17 (annotated)
- Committer:
- hornfeldt
- Date:
- Tue Nov 17 22:42:50 2009 +0000
- Revision:
- 0:45771b38d50d
- Child:
- 1:1d06bc155ef3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hornfeldt | 0:45771b38d50d | 1 | #ifndef DISPLAY_H |
hornfeldt | 0:45771b38d50d | 2 | #define DISPLAY_H |
hornfeldt | 0:45771b38d50d | 3 | |
hornfeldt | 0:45771b38d50d | 4 | #define RS_f = 1 |
hornfeldt | 0:45771b38d50d | 5 | #define RW_f = 2 |
hornfeldt | 0:45771b38d50d | 6 | #define CS1_f = 4 |
hornfeldt | 0:45771b38d50d | 7 | #define CS2_f = 8 |
hornfeldt | 0:45771b38d50d | 8 | |
hornfeldt | 0:45771b38d50d | 9 | #include "mbed.h" |
hornfeldt | 0:45771b38d50d | 10 | #include "font.h" |
hornfeldt | 0:45771b38d50d | 11 | |
hornfeldt | 0:45771b38d50d | 12 | class Display { |
hornfeldt | 0:45771b38d50d | 13 | public: |
hornfeldt | 0:45771b38d50d | 14 | // Constructor: |
hornfeldt | 0:45771b38d50d | 15 | Display (PinName _RS, PinName _RW, PinName _E, PinName _CS1, PinName _CS2, PinName DB0, PinName DB1, PinName DB2, PinName DB3, PinName DB4, PinName DB5, PinName DB6, PinName DB7); |
hornfeldt | 0:45771b38d50d | 16 | // Send write command to Display |
hornfeldt | 0:45771b38d50d | 17 | // Page 0-7, y 0-127 |
hornfeldt | 0:45771b38d50d | 18 | void write (int page, int y, unsigned int data); |
hornfeldt | 0:45771b38d50d | 19 | // |
hornfeldt | 0:45771b38d50d | 20 | int SendCommand(unsigned int, int); |
hornfeldt | 0:45771b38d50d | 21 | // Row 0-7, col 0-122 |
hornfeldt | 0:45771b38d50d | 22 | void writec(int row, int Y, char c); |
hornfeldt | 0:45771b38d50d | 23 | private: |
hornfeldt | 0:45771b38d50d | 24 | BusInOut DB; |
hornfeldt | 0:45771b38d50d | 25 | DigitalOut RS; |
hornfeldt | 0:45771b38d50d | 26 | DigitalOut RW; |
hornfeldt | 0:45771b38d50d | 27 | DigitalOut E; |
hornfeldt | 0:45771b38d50d | 28 | DigitalOut CS1; |
hornfeldt | 0:45771b38d50d | 29 | DigitalOut CS2; |
hornfeldt | 0:45771b38d50d | 30 | int CurCol; |
hornfeldt | 0:45771b38d50d | 31 | }; |
hornfeldt | 0:45771b38d50d | 32 | |
hornfeldt | 0:45771b38d50d | 33 | class DisplayTTY { |
hornfeldt | 0:45771b38d50d | 34 | public: |
hornfeldt | 0:45771b38d50d | 35 | DisplayTTY (Display *d, int row, int startY, int numOfChars, int numOfRows, int charOffset, int flags); |
hornfeldt | 0:45771b38d50d | 36 | int putc (int c); |
hornfeldt | 0:45771b38d50d | 37 | private: |
hornfeldt | 0:45771b38d50d | 38 | Display *display; |
hornfeldt | 0:45771b38d50d | 39 | int row; |
hornfeldt | 0:45771b38d50d | 40 | int startY; |
hornfeldt | 0:45771b38d50d | 41 | int numOfChars; |
hornfeldt | 0:45771b38d50d | 42 | int numOfRows; |
hornfeldt | 0:45771b38d50d | 43 | int charOffset; |
hornfeldt | 0:45771b38d50d | 44 | int flags; |
hornfeldt | 0:45771b38d50d | 45 | }; |
hornfeldt | 0:45771b38d50d | 46 | |
hornfeldt | 0:45771b38d50d | 47 | #endif |