From 89a597bfc475e8668e7a8c3849dab4f932a63383 Mon Sep 17 00:00:00 2001 From: Tectu Date: Sun, 24 Jun 2012 16:04:11 +0200 Subject: [PATCH] ssd1289 GPIO split into two 8-bit groups --- drivers/lcd/ssd1289_lld.c | 9 ++++++--- readme | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/lcd/ssd1289_lld.c b/drivers/lcd/ssd1289_lld.c index 9f3303f9..86c8558f 100644 --- a/drivers/lcd/ssd1289_lld.c +++ b/drivers/lcd/ssd1289_lld.c @@ -11,7 +11,8 @@ static __inline void lld_lcdWriteIndex(uint16_t index) { Clr_RS; Set_RD; - palWritePort(LCD_DATA_PORT, index); + LCD_DATA_PORT_1->BSRR = (((~index >> 8) << 16) | (index >> 8) << LCD_DATA_PORT_1_BASE); + LCD_DATA_PORT_2->BSRR = (((~index & 0xFF) << 16) | (index & 0xFF) << LCD_DATA_PORT_2_BASE); Clr_WR; Set_WR; @@ -20,7 +21,8 @@ static __inline void lld_lcdWriteIndex(uint16_t index) { static __inline void lld_lcdWriteData(uint16_t data) { Set_RS; - palWritePort(LCD_DATA_PORT, data); + LCD_DATA_PORT_1->BSRR = (((~data >> 8) << 16) | (data >> 8) << LCD_DATA_PORT_1_BASE); + LCD_DATA_PORT_2->BSRR = (((~data & 0xFF) << 16) | (data & 0xFF) << LCD_DATA_PORT_2_BASE); Clr_WR; Set_WR; @@ -83,7 +85,8 @@ __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { Set_RS; for(i = 0; i < size; i++) { - palWritePort(LCD_DATA_PORT, buffer[i]); + LCD_DATA_PORT_1->BSRR = (((~buffer[i] >> 8) << 16) | (buffer[i] >> 8) << LCD_DATA_PORT_1_BASE); + LCD_DATA_PORT_2->BSRR = (((~buffer[i] & 0xFF) << 16) | (buffer[i] & 0xFF) << LCD_DATA_PORT_2_BASE); Clr_WR; Set_WR; } diff --git a/readme b/readme index 7e926841..7840b56a 100644 --- a/readme +++ b/readme @@ -6,16 +6,21 @@ git clone https://github.com/tectu/Chibios-LCD-Driver lcd ### Edit boardfiles: add the following to your board.h file, matching to your pinconfig: - #define TP_PORT GPIOC - #define TP_IRQ 4 - #define TP_CS 6 + #define TP_PORT GPIOC + #define TP_IRQ 4 + #define TP_CS 6 - #define LCD_DATA_PORT GPIOE - #define LCD_CMD_PORT GPIOD - #define LCD_CS 12 - #define LCD_RS 13 - #define LCD_WR 14 - #define LCD_RD 15 + #define LCD_DATA_PORT_1 GPIOB + #define LCD_DATA_PORT_2 GPIOC + #define LCD_DATA_PORT_1_BASE 8 + #define LCD_DATA_PORT_2_BASE 0 + #define LCD_CMD_PORT GPIOD + #define LCD_CS 12 + #define LCD_RS 13 + #define LCD_WR 14 + #define LCD_RD 15 + +in this example, we use GPIOC[0:7] for DB[0:7] and GPIOB[8:15] for DB[8:15] ### Edit Makefile: include lcd.mk: