Lib for the new LCD Display with ILI9341 controller supporting two displays
Dependents: CANary_9341_test CANary_9341 CANary
Fork of SPI_TFT_ILI9341 by
Diff: SPI_TFTx2_ILI9341.h
- Revision:
- 9:522e742e62eb
- Parent:
- 8:66cf46ec1225
- Child:
- 10:aca12a61d2b1
--- a/SPI_TFTx2_ILI9341.h Mon May 12 00:53:43 2014 +0000 +++ b/SPI_TFTx2_ILI9341.h Mon May 12 03:18:44 2014 +0000 @@ -14,8 +14,8 @@ * use pixel (x,y) instadt of colum row */ -#ifndef MBED_SPI_TFTx2_ILI9341_H -#define MBED_SPI_TFTx2_ILI9341_H +#ifndef MBED_SPI_TFTx2_H +#define MBED_SPI_TFTx2_H #include "mbed.h" #include "GraphicsDisplay.h" @@ -25,7 +25,7 @@ /* some RGB color definitions */ #define Black 0x0000 /* 0, 0, 0 */ -#define Navy 0x000F /* 0, 0, 128 */ +#define Navy 0x0007 /* 0, 0, 64 */ #define DarkGreen 0x03E0 /* 0, 128, 0 */ #define DarkCyan 0x03EF /* 0, 128, 128 */ #define Maroon 0x7800 /* 128, 0, 0 */ @@ -42,6 +42,7 @@ #define White 0xFFFF /* 255, 255, 255 */ #define Orange 0xFD20 /* 255, 165, 0 */ #define GreenYellow 0xAFE5 /* 173, 255, 47 */ +#define Amber 0xFBE0 /* 255, 126, 0 */ /** Display control class, based on GraphicsDisplay and TextDisplay @@ -50,7 +51,7 @@ * @code * #include "stdio.h" * #include "mbed.h" - * #include "SPI_TFTx2_ILI9341.h" + * #include "SPI_TFTx2.h" * #include "string" * #include "Arial12x12.h" * #include "Arial24x23.h" @@ -58,7 +59,7 @@ * * * // the TFT is connected to SPI pin 5-7 and IO's 8-10 - * SPI_TFTx2_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc + * SPI_TFTx2 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc * If your display need a signal for switch the backlight use a aditional IO pin in your program * * int main() { @@ -78,7 +79,7 @@ * } * @endcode */ - class SPI_TFTx2_ILI9341 : public GraphicsDisplay { + class SPI_TFTx2 : public GraphicsDisplay { public: /** Create a SPI_TFTx2 object connected to SPI and three pins @@ -86,12 +87,13 @@ * @param mosi pin connected to SDO of display * @param miso pin connected to SDI of display * @param sclk pin connected to RS of display - * @param cs pin connected to CS of display + * @param cs0 pin connected to CS of display + * @param cs1 pin connected to CS of display * @param reset pin connected to RESET of display * @param dc pin connected to WR of display * the IM pins have to be set to 1110 (3-0) */ - SPI_TFTx2_ILI9341(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, PinName dc, const char* name ="TFT"); + SPI_TFTx2(PinName mosi, PinName miso, PinName sclk, PinName cs0, PinName cs1, PinName reset, PinName dc, const char* name ="TFT"); /** Get the width of the screen in pixel * @@ -271,7 +273,9 @@ */ void set_orientation(unsigned int o); - + /* Select between two displays */ + void set_display(unsigned int o); + /** read out the manufacturer ID of the LCD * can used for checking the connection to the display * @returns ID @@ -281,7 +285,8 @@ SPI _spi; - DigitalOut _cs; + DigitalOut _cs0; + DigitalOut _cs1; DigitalOut _reset; DigitalOut _dc; unsigned char* font; @@ -392,6 +397,7 @@ unsigned char spi_port; unsigned int orientation; + unsigned int seldisp; unsigned int char_x; unsigned int char_y; PinName clk;