This Library for DOGS-102 Graphic LCD module. Based on Igor Skochinsky's "DOGLCDDemo" program.
Dependents: DOGS102_Example1 DOGS102_Example2
Fork of DOGLCDDemo by
LCD/DogLCD.h@0:2a5dccfd318f, 2010-01-14 (annotated)
- Committer:
- igorsk
- Date:
- Thu Jan 14 00:49:39 2010 +0000
- Revision:
- 0:2a5dccfd318f
- Child:
- 1:2145a74df666
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igorsk | 0:2a5dccfd318f | 1 | #ifndef MBED_DOGLCD_H |
igorsk | 0:2a5dccfd318f | 2 | #define MBED_DOGLCD_H |
igorsk | 0:2a5dccfd318f | 3 | |
igorsk | 0:2a5dccfd318f | 4 | #include "AbstractLCD.h" |
igorsk | 0:2a5dccfd318f | 5 | |
igorsk | 0:2a5dccfd318f | 6 | /*********** |
igorsk | 0:2a5dccfd318f | 7 | * Module for Electronic Assembly's DOGL128-6 display module |
igorsk | 0:2a5dccfd318f | 8 | * Should be compatible with other modules using ST7565 controller |
igorsk | 0:2a5dccfd318f | 9 | ***********/ |
igorsk | 0:2a5dccfd318f | 10 | |
igorsk | 0:2a5dccfd318f | 11 | #define LCDWIDTH 128 |
igorsk | 0:2a5dccfd318f | 12 | #define LCDHEIGHT 64 |
igorsk | 0:2a5dccfd318f | 13 | #define LCDPAGES (LCDHEIGHT+7)/8 |
igorsk | 0:2a5dccfd318f | 14 | |
igorsk | 0:2a5dccfd318f | 15 | /* |
igorsk | 0:2a5dccfd318f | 16 | |
igorsk | 0:2a5dccfd318f | 17 | Each page is 8 lines, one byte per column |
igorsk | 0:2a5dccfd318f | 18 | |
igorsk | 0:2a5dccfd318f | 19 | Col0 |
igorsk | 0:2a5dccfd318f | 20 | +---+-- |
igorsk | 0:2a5dccfd318f | 21 | | 0 | |
igorsk | 0:2a5dccfd318f | 22 | Page 0 | 1 | |
igorsk | 0:2a5dccfd318f | 23 | | 2 | |
igorsk | 0:2a5dccfd318f | 24 | | 3 | |
igorsk | 0:2a5dccfd318f | 25 | | 4 | |
igorsk | 0:2a5dccfd318f | 26 | | 5 | |
igorsk | 0:2a5dccfd318f | 27 | | 6 | |
igorsk | 0:2a5dccfd318f | 28 | | 7 | |
igorsk | 0:2a5dccfd318f | 29 | +---+-- |
igorsk | 0:2a5dccfd318f | 30 | */ |
igorsk | 0:2a5dccfd318f | 31 | |
igorsk | 0:2a5dccfd318f | 32 | /* |
igorsk | 0:2a5dccfd318f | 33 | LCD interface class. |
igorsk | 0:2a5dccfd318f | 34 | Usage: |
igorsk | 0:2a5dccfd318f | 35 | DogLCD dog(spi, pin_power, pin_cs, pin_a0, pin_reset); |
igorsk | 0:2a5dccfd318f | 36 | where spi is an instance of SPI class |
igorsk | 0:2a5dccfd318f | 37 | */ |
igorsk | 0:2a5dccfd318f | 38 | |
igorsk | 0:2a5dccfd318f | 39 | class DogLCD: public AbstractLCD |
igorsk | 0:2a5dccfd318f | 40 | { |
igorsk | 0:2a5dccfd318f | 41 | SPI& _spi; |
igorsk | 0:2a5dccfd318f | 42 | DigitalOut _cs, _a0, _reset, _power; |
igorsk | 0:2a5dccfd318f | 43 | int _updating; |
igorsk | 0:2a5dccfd318f | 44 | void _send_commands(const unsigned char* buf, size_t size); |
igorsk | 0:2a5dccfd318f | 45 | void _send_data(const unsigned char* buf, size_t size); |
igorsk | 0:2a5dccfd318f | 46 | void _set_xy(int x, int y); |
igorsk | 0:2a5dccfd318f | 47 | unsigned char _framebuffer[LCDWIDTH*LCDPAGES]; |
igorsk | 0:2a5dccfd318f | 48 | public: |
igorsk | 0:2a5dccfd318f | 49 | DogLCD(SPI& spi, PinName power, PinName cs, PinName a0, PinName reset): |
igorsk | 0:2a5dccfd318f | 50 | _spi(spi), _cs(cs), _a0(a0), _reset(reset), _power(power), _updating(0) |
igorsk | 0:2a5dccfd318f | 51 | { |
igorsk | 0:2a5dccfd318f | 52 | } |
igorsk | 0:2a5dccfd318f | 53 | // initialize and turn on the display |
igorsk | 0:2a5dccfd318f | 54 | void init(); |
igorsk | 0:2a5dccfd318f | 55 | // send a 128x64 picture for the whole screen |
igorsk | 0:2a5dccfd318f | 56 | void send_pic(const unsigned char* data); |
igorsk | 0:2a5dccfd318f | 57 | // clear screen |
igorsk | 0:2a5dccfd318f | 58 | void clear_screen(); |
igorsk | 0:2a5dccfd318f | 59 | // turn all pixels on |
igorsk | 0:2a5dccfd318f | 60 | void all_on(bool on = true); |
igorsk | 0:2a5dccfd318f | 61 | |
igorsk | 0:2a5dccfd318f | 62 | // AbstractLCD methods |
igorsk | 0:2a5dccfd318f | 63 | virtual int width() {return LCDWIDTH;}; |
igorsk | 0:2a5dccfd318f | 64 | virtual int height() {return LCDHEIGHT;}; |
igorsk | 0:2a5dccfd318f | 65 | virtual void pixel(int x, int y, int colour); |
igorsk | 0:2a5dccfd318f | 66 | virtual void fill(int x, int y, int width, int height, int colour); |
igorsk | 0:2a5dccfd318f | 67 | virtual void beginupdate(); |
igorsk | 0:2a5dccfd318f | 68 | virtual void endupdate(); |
igorsk | 0:2a5dccfd318f | 69 | }; |
igorsk | 0:2a5dccfd318f | 70 | |
igorsk | 0:2a5dccfd318f | 71 | #endif |