aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}