SPI based library for the ST7735 LCD controller.
Dependents: RayCastingEngine RETRO_LCD_PerformanceTest RETRO_loop_test RETRO_RickGame ... more
Diff: LCD_ST7735.h
- Revision:
- 3:451148656b76
- Parent:
- 1:33ff5fad4320
- Child:
- 4:88d22437119c
diff -r 43f08d03a7e2 -r 451148656b76 LCD_ST7735.h --- a/LCD_ST7735.h Sat Sep 20 05:43:17 2014 +0000 +++ b/LCD_ST7735.h Sat Sep 20 19:09:16 2014 +0000 @@ -10,6 +10,20 @@ class LCD_ST7735 { public: + /** Orientation of the display */ + enum Orientation + { + /** No rotation of the display image*/ + Rotate0, + /** Rotate the display image 90 degrees */ + Rotate90, + /** Rotate the display image 180 degrees */ + Rotate180, + /** Rotate the display image 270 degrees */ + Rotate270 + }; + + public: /**Creates an instance of the LCD_ST7735 driver * @param backlightPin pin used to control the backlight * @param resetPin pin used to reset the display controller @@ -28,6 +42,18 @@ PinName clkPin, PinName csPin ); + + /** Set the orientation of the display + * @param orientation Orientation of the display. + * @param flip Flips the display direction + */ + void setOrientation(Orientation orientation, bool flip); + + /** Get the width of the display given the current orientation */ + int getWidth(); + + /** Get the height of the display given the current orientation */ + int getHeight(); /** Control the display's backlight * @param state true to turn the backlight on, false to turn it off @@ -152,7 +178,7 @@ * @param pString ASCIIZ string to draw to the display. * @note The font is currently limited to an 8x8 font. See the font_IBM.h file for an example font. */ - void drawString(const uint8_t *pFont, int x, int y, const char *pString); + void drawString(const uint8_t *pFont, int x, int y, const char *pString); private: void drawVertLine(int x1, int y1, int y2, uint16_t color); @@ -178,6 +204,10 @@ void clipRect(int x1, int y1, int x2, int y2); private: + int _width; + int _height; + Orientation _orientation; + bool _flip; uint16_t _foregroundColor; uint16_t _backgroundColor;