1
Diff: TextLCD.h
- Revision:
- 32:59c4b8f648d4
- Parent:
- 31:ef31cd8a00d1
- Child:
- 33:900a94bc7585
--- a/TextLCD.h Sun Jun 29 14:55:50 2014 +0000 +++ b/TextLCD.h Fri Aug 22 19:50:49 2014 +0000 @@ -11,6 +11,7 @@ * 2014, v09: WH/EO, Added Class for Native SPI controllers such as ST7032 * 2014, v10: WH, Added Class for Native I2C controllers such as ST7032i, Added support for MCP23008 I2C portexpander, Added support for Adafruit module * 2014, v11: WH, Added support for native I2C controllers such as PCF21XX, Improved the _initCtrl() method to deal with differences between all supported controllers + * 2014, v12: WH, Added support for native I2C controller PCF2119 and native I2C/SPI controllers SSD1803, ST7036, added setContrast method (by JH1PJL) for supported devices (eg ST7032i) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,7 +39,7 @@ /** A TextLCD interface for driving 4-bit HD44780-based LCDs * - * Currently supports 8x1, 8x2, 12x3, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x1, 24x2, 24x4, 40x2 and 40x4 panels + * Currently supports 8x1, 8x2, 12x3, 12x4, 16x1, 16x2, 16x3, 16x4, 20x2, 20x4, 24x1, 24x2, 24x4, 40x2 and 40x4 panels * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or SPI bus shiftregister (74595). * Supports some controllers with native I2C or SP interface. Supports some controllers that provide internal DC/DC converters for VLCD or VLED. * @@ -204,9 +205,15 @@ #define OLAT 0x0A -/* ST7032I I2C slave address */ +/* ST7032i I2C slave address */ #define ST7032_SA 0x7C +/* ST7036i I2C slave address */ +#define ST7036_SA0 0x78 +#define ST7036_SA1 0x7A +#define ST7036_SA2 0x7C +#define ST7036_SA3 0x7E + /* PCF21XX I2C slave address */ #define PCF21XX_SA0 0x74 #define PCF21XX_SA1 0x76 @@ -214,10 +221,24 @@ /* AIP31068 I2C slave address */ #define AIP31068_SA 0x7C +/* SSD1803 I2C slave address */ +#define SSD1803_SA0 0x78 +#define SSD1803_SA1 0x7A + +/* US2066 I2C slave address */ +#define US2066_SA0 0x78 +#define US2066_SA1 0x7A + + +//Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK +//#define LCD_I2C_ACK 0 +#define LCD_I2C_ACK 1 + /* LCD Type information on Rows, Columns and Variant. This information is encoded in * an int and used for the LCDType enumerators in order to simplify code maintenance */ // Columns encoded in b7..b0 #define LCD_T_COL_MSK 0x000000FF +#define LCD_T_C6 0x00000006 #define LCD_T_C8 0x00000008 #define LCD_T_C10 0x0000000A #define LCD_T_C12 0x0000000C @@ -236,37 +257,82 @@ // Addressing mode encoded in b19..b16 #define LCD_T_ADR_MSK 0x000F0000 -#define LCD_T_A 0x00000000 /*Mode A (Default), 1, 2 or 4 line display */ -#define LCD_T_B 0x00010000 /*Mode B, Alternate 8x2 (actually 16x1 display) */ -#define LCD_T_C 0x00020000 /*Mode C, Alternate 16x1 (actually 8x2 display) */ -#define LCD_T_D 0x00030000 /*Mode D, Alternate 3 or 4 line display (12x4, 24x4) */ -#define LCD_T_D1 0x00040000 /*Mode D1, Alternate 3 or 4 line display (12x4, 24x4) */ -#define LCD_T_E 0x00050000 /*Mode E, 4x40 display (actually two 40x2) */ +#define LCD_T_A 0x00000000 /*Mode A Default 1, 2 or 4 line display */ +#define LCD_T_B 0x00010000 /*Mode B, Alternate 8x2 (actually 16x1 display) */ +#define LCD_T_C 0x00020000 /*Mode C, Alternate 16x1 (actually 8x2 display) */ +#define LCD_T_D 0x00030000 /*Mode D, Alternate 3 or 4 line display (12x4, 20x4, 24x4) */ +#define LCD_T_D1 0x00040000 /*Mode D1, Alternate 3 out of 4 line display (12x3, 20x3, 24x3) */ +#define LCD_T_E 0x00050000 /*Mode E, 40x4 display (actually two 40x2) */ +#define LCD_T_F 0x00060000 /*Mode F, 16x3 display (actually 24x2) */ +#define LCD_T_G 0x00070000 /*Mode G, 16x3 display */ /* LCD Ctrl information on interface support and features. This information is encoded in * an int and used for the LCDCtrl enumerators in order to simplify code maintenance */ // Interface encoded in b31..b24 #define LCD_C_BUS_MSK 0xFF000000 -#define LCD_C_PAR 0x01000000 /*Parallel 4 or 8 bit data, E pin */ +#define LCD_C_PAR 0x01000000 /*Parallel 4 or 8 bit data, E pin, RS pin, RW=GND */ #define LCD_C_SPI3_9 0x02000000 /*SPI 3 line (MOSI, SCL, CS pins), 9 bits (RS + 8 Data) */ #define LCD_C_SPI3_10 0x04000000 /*SPI 3 line (MOSI, SCL, CS pins), 10 bits (RS, RW + 8 Data) */ -#define LCD_C_SPI4 0x08000000 /*SPI 4 line (MOSI, SCL, CS, RS pin) */ -#define LCD_C_I2C 0x10000000 /*I2C (SDA, SCL pin) */ +#define LCD_C_SPI3_16 0x08000000 /*SPI 3 line (MOSI, SCL, CS pins), 16 bits (RS, RW + 8 Data) */ +#define LCD_C_SPI3_24 0x10000000 /*SPI 3 line (MOSI, SCL, CS pins), 24 bits (RS, RW + 8 Data) */ +#define LCD_C_SPI4 0x20000000 /*SPI 4 line (MOSI, SCL, CS, RS pin), RS pin + 8 Data */ +#define LCD_C_I2C 0x40000000 /*I2C (SDA, SCL pin), 8 control bits (Co, RS, RW) + 8 Data */ // Features encoded in b23..b16 #define LCD_C_FTR_MSK 0x00FF0000 #define LCD_C_BST 0x00010000 /*Booster */ -#define LCD_C_CTR 0x00010000 /*Contrast Control */ -#define LCD_C_ICN 0x00020000 /*Icons */ +#define LCD_C_CTR 0x00020000 /*Contrast Control */ +#define LCD_C_ICN 0x00040000 /*Icons */ +#define LCD_C_PDN 0x00080000 /*Power Down */ + + +// Contrast setting, 5 significant bits (only supported for controllers with extended features) +// Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features) +#define LCD_DEF_CONTRAST 0x20 + +//ST7032 EastRising display +//ST7036 EA DOGM163 display +//Contrast setting 5 significant bits +//Voltage Multiplier setting 3 significant bits +#define LCD_ST7032_CONTRAST 0x18 +#define LCD_ST7032_RAB 0x04 + +#define LCD_ST7036_CONTRAST 0x28 +#define LCD_ST7036_RAB 0x04 + + +//SSD1803 EA DOGM204 display +//Contrast setting 5 significant bits +//Voltage Multiplier setting 3 significant bits +#define LCD_SSD1_CONTRAST 0x28 +#define LCD_SSD1_RAB 0x06 + + +//PCF2113, PCF2119 display +//Contrast setting 5 significant bits +//Voltage Multiplier setting 2 significant bits +#define LCD_PCF2_CONTRAST 0x20 +#define LCD_PCF2_S12 0x02 + +//PT6314 VFD display +//Contrast setting 2 significant bits +#define LCD_PT63_CONTRAST 0x00 /** Some sample User Defined Chars 5x7 dots */ -extern const char udc_ae[]; //æ -extern const char udc_0e[]; //ø -extern const char udc_ao[]; //å -extern const char udc_AE[]; //Æ -extern const char udc_0E[]; //Ø -extern const char udc_Ao[]; //Å -extern const char udc_PO[]; //Padlock Open -extern const char udc_PC[]; //Padlock Closed +//extern const char udc_ae[]; //æ +//extern const char udc_0e[]; //ø +//extern const char udc_ao[]; //å +//extern const char udc_AE[]; //Æ +//extern const char udc_0E[]; //Ø +//extern const char udc_Ao[]; //Å +//extern const char udc_PO[]; //Padlock Open +//extern const char udc_PC[]; //Padlock Closed + +//extern const char udc_alpha[]; //alpha +//extern const char udc_ohm[]; //ohm +//extern const char udc_sigma[]; //sigma +//extern const char udc_pi[]; //pi +//extern const char udc_root[]; //root + extern const char udc_0[]; // |> extern const char udc_1[]; // <| @@ -308,6 +374,8 @@ //extern const char udc_ch_mo[]; // Month (kana) //extern const char udc_ch_dy[]; // Day (kana) //extern const char udc_ch_mi[]; // minute (kana) +extern const char udc_None[]; +extern const char udc_All[]; /** A TextLCD interface for driving 4-bit HD44780-based LCDs * @@ -320,6 +388,8 @@ /** LCD panel format */ enum LCDType { +// LCD6x1 = (LCD_T_A | LCD_T_C6 | LCD_T_R1), /**< 6x1 LCD panel */ +// LCD6x2 = (LCD_T_A | LCD_T_C6 | LCD_T_R2), /**< 6x2 LCD panel */ LCD8x1 = (LCD_T_A | LCD_T_C8 | LCD_T_R1), /**< 8x1 LCD panel */ LCD8x2 = (LCD_T_A | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel */ LCD8x2B = (LCD_T_D | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel (actually 16x1) */ @@ -327,20 +397,34 @@ LCD12x2 = (LCD_T_A | LCD_T_C12 | LCD_T_R2), /**< 12x2 LCD panel */ LCD12x3D = (LCD_T_D | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX */ LCD12x3D1 = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX */ +// LCD12x3G = (LCD_T_G | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode ST7036 */ LCD12x4 = (LCD_T_A | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel */ LCD12x4D = (LCD_T_B | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel, special mode PCF21XX */ LCD16x1 = (LCD_T_A | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel */ LCD16x1C = (LCD_T_C | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel (actually 8x2) */ LCD16x2 = (LCD_T_A | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel (default) */ // LCD16x2B = (LCD_T_B | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel, alternate addressing, wrong.. */ -// LCD16x3D = (LCD_T_D | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode ST7036 */ + LCD16x3D = (LCD_T_D | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */ +// LCD16x3D1 = (LCD_T_D1 | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */ + LCD16x3F = (LCD_T_F | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel (actually 24x2) */ + LCD16x3G = (LCD_T_G | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode ST7036 */ LCD16x4 = (LCD_T_A | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel */ +// LCD16x4D = (LCD_T_D | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel, special mode SSD1803 */ // LCD20x1 = (LCD_T_A | LCD_T_C20 | LCD_T_R1), /**< 20x1 LCD panel */ LCD20x2 = (LCD_T_A | LCD_T_C20 | LCD_T_R2), /**< 20x2 LCD panel */ +// LCD20x3 = (LCD_T_A | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel */ +// LCD20x3D = (LCD_T_D | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */ +// LCD20x3D1 = (LCD_T_D1 | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */ LCD20x4 = (LCD_T_A | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel */ + LCD20x4D = (LCD_T_D | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel, special mode SSD1803 */ LCD24x1 = (LCD_T_A | LCD_T_C24 | LCD_T_R1), /**< 24x1 LCD panel */ LCD24x2 = (LCD_T_A | LCD_T_C24 | LCD_T_R2), /**< 24x2 LCD panel */ +// LCD24x3D = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */ +// LCD24x3D1 = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */ LCD24x4D = (LCD_T_D | LCD_T_C24 | LCD_T_R4), /**< 24x4 LCD panel, special mode KS0078 */ +// LCD32x1 = (LCD_T_A | LCD_T_C32 | LCD_T_R1), /**< 32x1 LCD panel */ +// LCD32x2 = (LCD_T_A | LCD_T_C32 | LCD_T_R2), /**< 32x2 LCD panel */ +// LCD32x4 = (LCD_T_A | LCD_T_C32 | LCD_T_R4), /**< 32x4 LCD panel */ // LCD40x1 = (LCD_T_A | LCD_T_C40 | LCD_T_R1), /**< 40x1 LCD panel */ LCD40x2 = (LCD_T_A | LCD_T_C40 | LCD_T_R2), /**< 40x2 LCD panel */ LCD40x4 = (LCD_T_E | LCD_T_C40 | LCD_T_R4) /**< 40x4 LCD panel, Two controller version */ @@ -349,16 +433,23 @@ /** LCD Controller Device */ enum LCDCtrl { - HD44780 = 0, /**< HD44780 (default) */ - WS0010 = 1 | (LCD_C_SPI3_10 | LCD_C_BST), /**< WS0010 OLED Controller, 4/8 bit, SPI3 */ - ST7036 = 2 | (LCD_C_SPI4 | LCD_C_BST), /**< ST7036 3V3 with Booster, 4/8 bit, SPI4 */ - ST7032_3V3 = 3 | (LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST), /**< ST7032 3V3 with Booster, 4/8 bit, SPI4, I2C */ - ST7032_5V = 4 | (LCD_C_SPI4 | LCD_C_I2C), /**< ST7032 5V no Booster, 4/8 bit, SPI4, I2C */ - KS0078 = 5, /**< KS0078 24x4 support, 4/8 bit */ - PCF2113_3V3 = 6 | (LCD_C_I2C | LCD_C_BST), /**< PCF2113 3V3 with Booster, 4/8 bit, I2C */ - PCF2116_3V3 = 7 | (LCD_C_I2C | LCD_C_BST), /**< PCF2116 3V3 with Booster, 4/8 bit, I2C */ -// PCF2116_5V = 8 | (LCD_C_I2C), /**< PCF2116 5V no Booster, 4/8 bit, I2C */ - AIP31068 = 9 | (LCD_C_SPI3_9 | LCD_C_I2C | LCD_C_BST) /**< AIP31068 I2C, SPI3 */ + HD44780 = 0 | LCD_C_PAR, /**< HD44780 or full equivalent (default) */ + WS0010 = 1 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_BST), /**< WS0010 OLED Controller, 4/8 bit, SPI3 */ + ST7036_3V3 = 2 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7036 3V3 with Booster, 4/8 bit, SPI4, I2C */ + ST7036_5V = 3 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7036 5V no Booster, 4/8 bit, SPI4, I2C */ + ST7032_3V3 = 4 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7032 3V3 with Booster, 4/8 bit, SPI4, I2C */ + ST7032_5V = 5 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_CTR), /**< ST7032 5V no Booster, 4/8 bit, SPI4, I2C */ + KS0078 = 6 | (LCD_C_PAR | LCD_C_SPI3_24), /**< KS0078 24x4 support, 4/8 bit, SPI3 */ + PCF2113_3V3 = 7 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2113 3V3 with Booster, 4/8 bit, I2C */ + PCF2116_3V3 = 8 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST), /**< PCF2116 3V3 with Booster, 4/8 bit, I2C */ + PCF2116_5V = 9 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2116 5V no Booster, 4/8 bit, I2C */ + PCF2119_3V3 = 10 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2119 3V3 with Booster, 4/8 bit, I2C */ +// PCF2119_5V = 11 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2119 5V no Booster, 4/8 bit, I2C */ + AIP31068 = 12 | (LCD_C_SPI3_9 | LCD_C_I2C | LCD_C_BST), /**< AIP31068 I2C, SPI3 */ + SSD1803_3V3 = 13 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN) /**< SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */ +// SSD1803_5V = 14 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN) /**< SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */ +// US2066_3V3 = 15 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN) /**< US2066 3V3 with Booster, 4/8 bit, I2C, SPI3 */ +// PT6314 = 16 | (LCD_C_PAR | LCD_C_SPI3_16 | LCD_C_CTR | LCD_C_PDN) /**< PT6314 VFD, 4/8 bit, SPI3 */ }; @@ -460,6 +551,25 @@ */ void setUDC(unsigned char c, char *udc_data); + /** Set Contrast + * setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation + * Code imported from fork by JH1PJL + * + * @param unsigned char c contrast data (6 significant bits, valid range 0..63, Value 0 will disable the Vgen) + * @return none + */ + void setContrast(unsigned char c = LCD_DEF_CONTRAST); + + + /** Set Power + * setPower method is supported by some compatible devices (eg SSD1803) that have power down modes + * + * @param bool powerOn Power on/off + * @return none + */ + void setPower(bool powerOn = true); + + //test // void _initCtrl(); @@ -565,7 +675,15 @@ // Cursor int _column; int _row; - LCDCursor _currentCursor; + LCDCursor _currentCursor; + +// Function mode saved to allow switch between Instruction sets after initialisation time +// Icon, Booster mode and contrast saved to allow contrast change at later time +// Only available for controllers with added features + int _function, _function_1, _function_x; + int _icon_power; + int _contrast; + }; //--------- End TextLCD_Base ----------- @@ -606,7 +724,7 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (parallel) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -661,7 +779,7 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -718,7 +836,7 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -779,7 +897,7 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -809,7 +927,7 @@ //---------- End TextLCD_SPI_N ------------ -#if(0) +#if(1) //Code checked out on logic analyser. Not yet tested on hardware.. //------- Start TextLCD_SPI_N_3_9 --------- @@ -840,7 +958,135 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). + */ + virtual void _setRS(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the BL pin (0 = Backlight Off, 1 = Backlight On). + */ + virtual void _setBL(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the databus value (4 bit). + */ + virtual void _setData(int value); + +/** Low level writes to LCD serial bus only (serial native) + */ + virtual void _writeByte(int value); + +// SPI bus + SPI *_spi; + DigitalOut _cs; + +//Test + DigitalOut _ps; + + +// controlbyte to select between data and command. Internal value for serial bus only + char _controlbyte; + +//Backlight + DigitalOut *_bl; +}; + +//-------- End TextLCD_SPI_N_3_9 ---------- +#endif + + +#if(1) +//------- Start TextLCD_SPI_N_3_10 --------- + +/** Create a TextLCD interface using a controller with native SPI3 10 bits interface + * Note: current mbed libs only support SPI 10 bit mode for NXP platforms + * + */ +class TextLCD_SPI_N_3_10 : public TextLCD_Base { +public: + /** Create a TextLCD interface using a controller with native SPI3 10 bits interface + * Note: current mbed libs only support SPI 10 bit mode for NXP platforms + * + * @param spi SPI Bus + * @param cs chip select pin (active low) + * @param type Sets the panel size/addressing mode (default = LCD16x2) + * @param bl Backlight control line (optional, default = NC) + * @param ctrl LCD controller (default = AIP31068) + */ + TextLCD_SPI_N_3_10(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068); + virtual ~TextLCD_SPI_N_3_10(void); + +private: + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the Enable pin. + */ + virtual void _setEnable(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the RS pin (0 = Command, 1 = Data). + */ + virtual void _setRS(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the BL pin (0 = Backlight Off, 1 = Backlight On). + */ + virtual void _setBL(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the databus value (4 bit). + */ + virtual void _setData(int value); + +/** Low level writes to LCD serial bus only (serial native) + */ + virtual void _writeByte(int value); + +// SPI bus + SPI *_spi; + DigitalOut _cs; + + +// controlbyte to select between data and command. Internal value for serial bus only + char _controlbyte; + +//Backlight + DigitalOut *_bl; +}; + +//-------- End TextLCD_SPI_N_3_10 ---------- +#endif + +#if(0) +//Code not yet checked out on logic analyser. Not yet tested on hardware.. + +//------- Start TextLCD_SPI_N_3_16 --------- + +/** Create a TextLCD interface using a controller with native SPI3 16 bits interface + * + */ +class TextLCD_SPI_N_3_16 : public TextLCD_Base { +public: + /** Create a TextLCD interface using a controller with native SPI3 16 bits interface + * + * @param spi SPI Bus + * @param cs chip select pin (active low) + * @param type Sets the panel size/addressing mode (default = LCD16x2) + * @param bl Backlight control line (optional, default = NC) + * @param ctrl LCD controller (default = PT6314) + */ + TextLCD_SPI_N_3_16(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = PT6314); + virtual ~TextLCD_SPI_N_3_16(void); + +private: + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the Enable pin. + */ + virtual void _setEnable(bool value); + +/** Implementation of pure Virtual Low level writes to LCD Bus (serial native) + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -869,32 +1115,31 @@ DigitalOut *_bl; }; -//-------- End TextLCD_SPI_N_3_9 ---------- +//-------- End TextLCD_SPI_N_3_16 ---------- #endif - -#if(0) -//Code checked out on logic analyser. Not yet tested on hardware.. +#if(1) +//Code to be checked out on logic analyser. Not yet tested on hardware.. -//------- Start TextLCD_SPI_N_3_10 --------- +//------- Start TextLCD_SPI_N_3_24 --------- -/** Create a TextLCD interface using a controller with native SPI3 10 bits interface - * Note: current mbed libs only support SPI 10 bit mode for NXP platforms +/** Create a TextLCD interface using a controller with native SPI3 24 bits interface + * Note: lib uses SPI 8 bit mode * */ -class TextLCD_SPI_N_3_10 : public TextLCD_Base { +class TextLCD_SPI_N_3_24 : public TextLCD_Base { public: - /** Create a TextLCD interface using a controller with native SPI3 10 bits interface - * Note: current mbed libs only support SPI 10 bit mode for NXP platforms + /** Create a TextLCD interface using a controller with native SPI3 24 bits interface + * Note: lib uses SPI 8 bit mode * * @param spi SPI Bus * @param cs chip select pin (active low) * @param type Sets the panel size/addressing mode (default = LCD16x2) * @param bl Backlight control line (optional, default = NC) - * @param ctrl LCD controller (default = AIP31068) + * @param ctrl LCD controller (default = SSD1803) */ - TextLCD_SPI_N_3_10(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068); - virtual ~TextLCD_SPI_N_3_10(void); + TextLCD_SPI_N_3_24(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = SSD1803_3V3); + virtual ~TextLCD_SPI_N_3_24(void); private: @@ -904,7 +1149,7 @@ virtual void _setEnable(bool value); /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) - * Set the RS pin ( 0 = Command, 1 = Data). + * Set the RS pin (0 = Command, 1 = Data). */ virtual void _setRS(bool value); @@ -933,7 +1178,7 @@ DigitalOut *_bl; }; -//-------- End TextLCD_SPI_N_3_10 ---------- +//-------- End TextLCD_SPI_N_3_24 ---------- #endif @@ -990,6 +1235,11 @@ //Backlight DigitalOut *_bl; + + +//Test + DigitalOut _ps; + }; //---------- End TextLCD_I2C_N ------------