SPI based library for the ST7735 LCD controller.
Dependents: RayCastingEngine RETRO_LCD_PerformanceTest RETRO_loop_test RETRO_RickGame ... more
Color565.h@15:516f15979b53, 2015-03-01 (annotated)
- Committer:
- taylorza
- Date:
- Sun Mar 01 16:30:42 2015 +0000
- Revision:
- 15:516f15979b53
- Parent:
- 2:43f08d03a7e2
Fixed a bug in fill rectangle that excluded the last pixels when the rectangle had a height of 2 pixels.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taylorza | 2:43f08d03a7e2 | 1 | /////////////////////////////////////////////////////////////////////////////// |
taylorza | 2:43f08d03a7e2 | 2 | // LCD_ST7735 - Driver for ST7735 LCD display controller |
taylorza | 2:43f08d03a7e2 | 3 | // Author: Chris Taylor (taylorza) |
taylorza | 2:43f08d03a7e2 | 4 | |
taylorza | 2:43f08d03a7e2 | 5 | #ifndef __COLOR565_H__ |
taylorza | 2:43f08d03a7e2 | 6 | #define __COLOR565_H__ |
taylorza | 2:43f08d03a7e2 | 7 | /** Color palete support for 16bit RGB colors with 565 color format |
taylorza | 2:43f08d03a7e2 | 8 | */ |
taylorza | 2:43f08d03a7e2 | 9 | class Color565 |
taylorza | 2:43f08d03a7e2 | 10 | { |
taylorza | 2:43f08d03a7e2 | 11 | public: |
taylorza | 2:43f08d03a7e2 | 12 | /**White*/ |
taylorza | 2:43f08d03a7e2 | 13 | static const uint16_t White; |
taylorza | 2:43f08d03a7e2 | 14 | |
taylorza | 2:43f08d03a7e2 | 15 | /**Silver*/ |
taylorza | 2:43f08d03a7e2 | 16 | static const uint16_t Silver; |
taylorza | 2:43f08d03a7e2 | 17 | |
taylorza | 2:43f08d03a7e2 | 18 | /**Gray*/ |
taylorza | 2:43f08d03a7e2 | 19 | static const uint16_t Gray; |
taylorza | 2:43f08d03a7e2 | 20 | |
taylorza | 2:43f08d03a7e2 | 21 | /**Black*/ |
taylorza | 2:43f08d03a7e2 | 22 | static const uint16_t Black; |
taylorza | 2:43f08d03a7e2 | 23 | |
taylorza | 2:43f08d03a7e2 | 24 | /**Red*/ |
taylorza | 2:43f08d03a7e2 | 25 | static const uint16_t Red; |
taylorza | 2:43f08d03a7e2 | 26 | |
taylorza | 2:43f08d03a7e2 | 27 | /**Maroon*/ |
taylorza | 2:43f08d03a7e2 | 28 | static const uint16_t Maroon; |
taylorza | 2:43f08d03a7e2 | 29 | |
taylorza | 2:43f08d03a7e2 | 30 | /**Yellow*/ |
taylorza | 2:43f08d03a7e2 | 31 | static const uint16_t Yellow; |
taylorza | 2:43f08d03a7e2 | 32 | |
taylorza | 2:43f08d03a7e2 | 33 | /**Olive*/ |
taylorza | 2:43f08d03a7e2 | 34 | static const uint16_t Olive; |
taylorza | 2:43f08d03a7e2 | 35 | |
taylorza | 2:43f08d03a7e2 | 36 | /**Lime*/ |
taylorza | 2:43f08d03a7e2 | 37 | static const uint16_t Lime; |
taylorza | 2:43f08d03a7e2 | 38 | |
taylorza | 2:43f08d03a7e2 | 39 | /**Green*/ |
taylorza | 2:43f08d03a7e2 | 40 | static const uint16_t Green; |
taylorza | 2:43f08d03a7e2 | 41 | |
taylorza | 2:43f08d03a7e2 | 42 | /**Aqua*/ |
taylorza | 2:43f08d03a7e2 | 43 | static const uint16_t Aqua; |
taylorza | 2:43f08d03a7e2 | 44 | |
taylorza | 2:43f08d03a7e2 | 45 | /**Teal*/ |
taylorza | 2:43f08d03a7e2 | 46 | static const uint16_t Teal; |
taylorza | 2:43f08d03a7e2 | 47 | |
taylorza | 2:43f08d03a7e2 | 48 | /**Blue*/ |
taylorza | 2:43f08d03a7e2 | 49 | static const uint16_t Blue; |
taylorza | 2:43f08d03a7e2 | 50 | |
taylorza | 2:43f08d03a7e2 | 51 | /**Navy*/ |
taylorza | 2:43f08d03a7e2 | 52 | static const uint16_t Navy; |
taylorza | 2:43f08d03a7e2 | 53 | |
taylorza | 2:43f08d03a7e2 | 54 | /**Fuchsia*/ |
taylorza | 2:43f08d03a7e2 | 55 | static const uint16_t Fuchsia; |
taylorza | 2:43f08d03a7e2 | 56 | |
taylorza | 2:43f08d03a7e2 | 57 | /**Purple*/ |
taylorza | 2:43f08d03a7e2 | 58 | static const uint16_t Purple; |
taylorza | 2:43f08d03a7e2 | 59 | |
taylorza | 2:43f08d03a7e2 | 60 | /**Returns a 565 RGB color built from individual RGB color components |
taylorza | 2:43f08d03a7e2 | 61 | * @param r Red component |
taylorza | 2:43f08d03a7e2 | 62 | * @param g Green component |
taylorza | 2:43f08d03a7e2 | 63 | * @param b Blue component |
taylorza | 2:43f08d03a7e2 | 64 | */ |
taylorza | 2:43f08d03a7e2 | 65 | static uint16_t fromRGB(uint8_t r, uint8_t g, uint8_t b) |
taylorza | 2:43f08d03a7e2 | 66 | { |
taylorza | 2:43f08d03a7e2 | 67 | return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3) ; |
taylorza | 2:43f08d03a7e2 | 68 | } |
taylorza | 2:43f08d03a7e2 | 69 | private: |
taylorza | 2:43f08d03a7e2 | 70 | Color565(){}; |
taylorza | 2:43f08d03a7e2 | 71 | }; |
taylorza | 2:43f08d03a7e2 | 72 | #endif // __COLOR565_H__ |