From 73e0021db2fc2a92d4d79129ba5af058e7c85c68 Mon Sep 17 00:00:00 2001 From: Tectu Date: Sun, 24 Jun 2012 16:44:58 +0200 Subject: [PATCH] implemented lld_lcdWriteGPIO() for SSD1289 --- drivers/lcd/ssd1289_lld.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/lcd/ssd1289_lld.c b/drivers/lcd/ssd1289_lld.c index 86c8558f..f9fa0cfd 100644 --- a/drivers/lcd/ssd1289_lld.c +++ b/drivers/lcd/ssd1289_lld.c @@ -7,12 +7,17 @@ uint16_t DeviceCode; extern uint16_t lcd_width, lcd_height; #ifdef LCD_USE_GPIO + +static __inline lld_lcdWriteGPIO(uint16_t d) { + LCD_DATA_PORT_1->BSRR = (((~d >> 8) << 16) | (d >> 8) << LCD_DATA_PORT_1_BASE); + LCD_DATA_PORT_2->BSRR = (((~d & 0xFF) << 16) | (d & 0xFF) << LCD_DATA_PORT_2_BASE); +} + static __inline void lld_lcdWriteIndex(uint16_t index) { Clr_RS; Set_RD; - 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); + lld_lcdWriteGPIO(index); Clr_WR; Set_WR; @@ -21,8 +26,7 @@ static __inline void lld_lcdWriteIndex(uint16_t index) { static __inline void lld_lcdWriteData(uint16_t data) { Set_RS; - 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); + lld_lcdWriteGPIO(data); Clr_WR; Set_WR; @@ -85,8 +89,7 @@ __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) { Set_RS; for(i = 0; i < size; 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); + lld_lcdWriteGPIO(buffer[i]); Clr_WR; Set_WR; }