aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-24 16:44:58 +0200
committerTectu <joel@unormal.org>2012-06-24 16:44:58 +0200
commit73e0021db2fc2a92d4d79129ba5af058e7c85c68 (patch)
tree06f8217d8daa8302a9001c65725b698c4d15eea6
parent89a597bfc475e8668e7a8c3849dab4f932a63383 (diff)
downloaduGFX-73e0021db2fc2a92d4d79129ba5af058e7c85c68.tar.gz
uGFX-73e0021db2fc2a92d4d79129ba5af058e7c85c68.tar.bz2
uGFX-73e0021db2fc2a92d4d79129ba5af058e7c85c68.zip
implemented lld_lcdWriteGPIO() for SSD1289
-rw-r--r--drivers/lcd/ssd1289_lld.c15
1 files 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;
}