A modified version of the GDEP015OC1 library that supports x-or as a color.
Fork of GDEP015OC1 by
GDEP015OC1.h@5:6709a20459ad, 2016-09-22 (annotated)
- Committer:
- Anunnaki
- Date:
- Thu Sep 22 08:22:40 2016 +0000
- Revision:
- 5:6709a20459ad
- Parent:
- 4:86114342ce8f
- Child:
- 7:70c58d3cbc8b
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Anunnaki | 3:dc7b794b59b7 | 1 | /** |
Anunnaki | 3:dc7b794b59b7 | 2 | * Created by Filip Hormot (f.hormot@gmail.com) on 14/09/16. |
Anunnaki | 3:dc7b794b59b7 | 3 | */ |
Anunnaki | 3:dc7b794b59b7 | 4 | |
Anunnaki | 2:1c8f73aa2a16 | 5 | #include "mbed.h" |
Anunnaki | 2:1c8f73aa2a16 | 6 | |
Anunnaki | 2:1c8f73aa2a16 | 7 | #define BUFFER_SIZE 5000 |
Anunnaki | 3:dc7b794b59b7 | 8 | #define FONT_WIDTH 5 |
Anunnaki | 3:dc7b794b59b7 | 9 | #define FONT_HEIGHT 7 |
Anunnaki | 2:1c8f73aa2a16 | 10 | #define BUSY_STATE 1 |
Anunnaki | 2:1c8f73aa2a16 | 11 | |
Anunnaki | 2:1c8f73aa2a16 | 12 | class GDEP015OC1 { |
Anunnaki | 2:1c8f73aa2a16 | 13 | public: |
Anunnaki | 5:6709a20459ad | 14 | //unsigned char _buffer[BUFFER_SIZE]; |
Anunnaki | 2:1c8f73aa2a16 | 15 | GDEP015OC1(SPI& spi, PinName cs, PinName dc, PinName rst, PinName busy); |
Anunnaki | 2:1c8f73aa2a16 | 16 | |
Anunnaki | 4:86114342ce8f | 17 | void fill(unsigned char data, int i); |
Anunnaki | 2:1c8f73aa2a16 | 18 | unsigned char get(uint16_t i); |
Anunnaki | 2:1c8f73aa2a16 | 19 | void empty(void); |
Anunnaki | 2:1c8f73aa2a16 | 20 | void invert(void); |
Anunnaki | 2:1c8f73aa2a16 | 21 | void write(void); |
Anunnaki | 2:1c8f73aa2a16 | 22 | void drawPixel(uint16_t startX, uint16_t startY, bool color); |
Anunnaki | 2:1c8f73aa2a16 | 23 | void drawLine(uint16_t startX, uint16_t startY, uint16_t stopX, uint16_t stopY, bool color); |
Anunnaki | 3:dc7b794b59b7 | 24 | void drawTriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, bool color); |
Anunnaki | 3:dc7b794b59b7 | 25 | void drawRectangle(uint16_t startX, uint16_t startY, uint16_t stopX, uint16_t stopY, bool color); |
Anunnaki | 3:dc7b794b59b7 | 26 | void drawCircle(uint16_t startX, uint16_t startY, uint16_t radius, bool color); |
Anunnaki | 3:dc7b794b59b7 | 27 | void fillCircle(uint16_t startX, uint16_t startY, uint16_t radius, bool color); |
Anunnaki | 3:dc7b794b59b7 | 28 | void drawEllipse(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height, bool color); |
Anunnaki | 3:dc7b794b59b7 | 29 | void fillEllipse(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height, bool color); |
Anunnaki | 3:dc7b794b59b7 | 30 | void writeChar(char character, uint16_t startX, uint16_t startY, bool color); |
Anunnaki | 3:dc7b794b59b7 | 31 | void writeString(char *string, uint16_t startX, uint16_t startY, bool color); |
Anunnaki | 2:1c8f73aa2a16 | 32 | private: |
Anunnaki | 2:1c8f73aa2a16 | 33 | SPI& _spi; |
Anunnaki | 2:1c8f73aa2a16 | 34 | DigitalOut _cs; |
Anunnaki | 2:1c8f73aa2a16 | 35 | DigitalOut _dc; |
Anunnaki | 2:1c8f73aa2a16 | 36 | DigitalOut _rst; |
Anunnaki | 2:1c8f73aa2a16 | 37 | DigitalIn _busy; |
Anunnaki | 2:1c8f73aa2a16 | 38 | |
Anunnaki | 3:dc7b794b59b7 | 39 | bool _italic, _bold; |
Anunnaki | 3:dc7b794b59b7 | 40 | |
Anunnaki | 5:6709a20459ad | 41 | unsigned char _buffer[BUFFER_SIZE]; |
Anunnaki | 2:1c8f73aa2a16 | 42 | |
Anunnaki | 2:1c8f73aa2a16 | 43 | void _spiCommand(unsigned char command); |
Anunnaki | 2:1c8f73aa2a16 | 44 | void _spiData(unsigned char data); |
Anunnaki | 2:1c8f73aa2a16 | 45 | void _init(void); |
Anunnaki | 2:1c8f73aa2a16 | 46 | void _wakeUp(void); |
Anunnaki | 2:1c8f73aa2a16 | 47 | void _sleep(void); |
Anunnaki | 2:1c8f73aa2a16 | 48 | unsigned char _pixelConv(unsigned char *data, int i); |
Anunnaki | 2:1c8f73aa2a16 | 49 | uint8_t _mirrorData(uint8_t data); |
Anunnaki | 2:1c8f73aa2a16 | 50 | }; |