From 425b8ff83551abf2538778e50f786bf3245670a7 Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Tue, 17 Jan 2012 20:14:51 +0100 Subject: [PATCH] New LCD drivers --- Makefile | 1 + .../LPC1343 Workspace.workspace.session | 8 ++--- build/codelite/LPC1343_CodeBase.project | 2 ++ build/crossworks/LPC1343_CodeBase.hzs | 33 +++++++------------ drivers/lcd/tft/hw/ssd1351.c | 3 +- drivers/lcd/tft/hw/ssd1351.h | 20 +++++------ main.c | 6 ++++ projectconfig.h | 1 + 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 78bfbf7..12f36ce 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ OBJS += verdana9.o verdana14.o verdanabold14.o OBJS += ILI9328.o # OBJS += ILI9325.o # OBJS += ssd1331.o +# OBJS += ssd1351.o # OBJS += st7735.o # OBJS += st7783.o diff --git a/build/codelite/LPC1343 Workspace.workspace.session b/build/codelite/LPC1343 Workspace.workspace.session index 860bfe3..fce93d4 100644 --- a/build/codelite/LPC1343 Workspace.workspace.session +++ b/build/codelite/LPC1343 Workspace.workspace.session @@ -5,14 +5,14 @@ - - + + - - + + diff --git a/build/codelite/LPC1343_CodeBase.project b/build/codelite/LPC1343_CodeBase.project index 6dbe1c0..54c13ef 100644 --- a/build/codelite/LPC1343_CodeBase.project +++ b/build/codelite/LPC1343_CodeBase.project @@ -166,6 +166,8 @@ + + diff --git a/build/crossworks/LPC1343_CodeBase.hzs b/build/crossworks/LPC1343_CodeBase.hzs index c018daa..70f8d54 100644 --- a/build/crossworks/LPC1343_CodeBase.hzs +++ b/build/crossworks/LPC1343_CodeBase.hzs @@ -1,16 +1,7 @@ - - - - - - - - - - + @@ -33,13 +24,6 @@ - - - - - - - @@ -59,10 +43,10 @@ - - - + + + @@ -75,7 +59,12 @@ - + + + + + + - + diff --git a/drivers/lcd/tft/hw/ssd1351.c b/drivers/lcd/tft/hw/ssd1351.c index eddc0f0..b53d9e3 100644 --- a/drivers/lcd/tft/hw/ssd1351.c +++ b/drivers/lcd/tft/hw/ssd1351.c @@ -188,7 +188,8 @@ void lcdInit(void) CMD(SSD1351_CMD_SETGPIO); DATA(0x00); // Disable GPIO pins CMD(SSD1351_CMD_FUNCTIONSELECTION); - DATA(0x00); // External VDD + DATA(0x00); // External VDD (0 = Internal, 1 = External???)* + // Which is it ... DS is contradictory here! CMD(SSD1351_CMD_SETPHASELENGTH); DATA(0x32); CMD(SSD1351_CMD_SETSEGMENTLOWVOLTAGE); diff --git a/drivers/lcd/tft/hw/ssd1351.h b/drivers/lcd/tft/hw/ssd1351.h index 204b9a8..e4edfd8 100644 --- a/drivers/lcd/tft/hw/ssd1351.h +++ b/drivers/lcd/tft/hw/ssd1351.h @@ -64,22 +64,22 @@ // Control pins #define SSD1351_SCK_PORT (2) // SCK (D0) -#define SSD1351_SCK_PIN (4) +#define SSD1351_SCK_PIN (1) #define SSD1351_SID_PORT (2) // DAT/MOSI (D1) -#define SSD1351_SID_PIN (5) +#define SSD1351_SID_PIN (2) #define SSD1351_CS_PORT (2) // OLEDCS -#define SSD1351_CS_PIN (6) +#define SSD1351_CS_PIN (3) #define SSD1351_RST_PORT (2) // RST -#define SSD1351_RST_PIN (7) +#define SSD1351_RST_PIN (4) #define SSD1351_DC_PORT (2) // D/C (only required for 4-pin SPI) -#define SSD1351_DC_PIN (8) +#define SSD1351_DC_PIN (5) // Placed here to try to keep all pin specific values in the header file -#define SSD1351_DISABLEPULLUPS() do { gpioSetPullup(&IOCON_PIO2_4, gpioPullupMode_Inactive); \ - gpioSetPullup(&IOCON_PIO2_5, gpioPullupMode_Inactive); \ - gpioSetPullup(&IOCON_PIO2_6, gpioPullupMode_Inactive); \ - gpioSetPullup(&IOCON_PIO2_7, gpioPullupMode_Inactive); \ - gpioSetPullup(&IOCON_PIO2_8, gpioPullupMode_Inactive); } while (0) +#define SSD1351_DISABLEPULLUPS() do { gpioSetPullup(&IOCON_PIO2_1, gpioPullupMode_Inactive); \ + gpioSetPullup(&IOCON_PIO2_2, gpioPullupMode_Inactive); \ + gpioSetPullup(&IOCON_PIO2_3, gpioPullupMode_Inactive); \ + gpioSetPullup(&IOCON_PIO2_4, gpioPullupMode_Inactive); \ + gpioSetPullup(&IOCON_PIO2_5, gpioPullupMode_Inactive); } while (0) // These registers allow fast single cycle clear+set of bits (see section 8.5.1 of LPC1343 UM) #define SSD1351_GPIO2DATA_SCK (*(pREG32 (GPIO_GPIO2_BASE + ((1 << SSD1351_SCK_PIN) << 2)))) diff --git a/main.c b/main.c index 6d5c158..dbae27d 100644 --- a/main.c +++ b/main.c @@ -43,6 +43,9 @@ #include "core/gpio/gpio.h" #include "core/systick/systick.h" +#include "drivers/lcd/tft/hw/ssd1351.h" +#include "drivers/lcd/tft/drawing.h" + #ifdef CFG_INTERFACE #include "core/cmd/cmd.h" #endif @@ -61,6 +64,9 @@ int main(void) uint32_t currentSecond, lastSecond; currentSecond = lastSecond = 0; + lcdInit(); + lcdTest(); + while (1) { // Toggle LED once per second diff --git a/projectconfig.h b/projectconfig.h index e59629a..d25de0f 100644 --- a/projectconfig.h +++ b/projectconfig.h @@ -141,6 +141,7 @@ ST7735 . . . . X X X X X X . . . . . . . SHARPMEM . . . . X X X X . . . . . . . . . SSD1306 . . . . X X X . X X . . . . . . . + SSD1351 . . . . X X X X X . . . . . . . . MCP121 . . . . . . . . . . . . . . X . . TIMERS SSP ADC UART -- 2.20.1