From 67504103373de3bedd9980d43d1d9e5db76fa822 Mon Sep 17 00:00:00 2001 From: Delio Brignoli Date: Mon, 18 Sep 2017 14:14:37 +0200 Subject: [PATCH] parts: ssd1306: SET_COLUMN_*_NIBBLE commands are ignored in page mode --- examples/parts/ssd1306_virt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/parts/ssd1306_virt.c b/examples/parts/ssd1306_virt.c index 7021d73..1ffa0e1 100644 --- a/examples/parts/ssd1306_virt.c +++ b/examples/parts/ssd1306_virt.c @@ -103,16 +103,20 @@ ssd1306_update_command_register (ssd1306_t *part) case SSD1306_VIRT_SET_COLUMN_LOW_NIBBLE ... SSD1306_VIRT_SET_COLUMN_LOW_NIBBLE + 0xF: part->spi_data -= SSD1306_VIRT_SET_COLUMN_LOW_NIBBLE; - part->cursor.column = (part->cursor.column & 0xF0) + if (part->addr_mode == SSD1306_ADDR_MODE_PAGE) { + part->cursor.column = (part->cursor.column & 0xF0) | (part->spi_data & 0xF); + } //printf ("SSD1306: SET COLUMN LOW NIBBLE: 0x%02x\n",part->spi_data); SSD1306_CLEAR_COMMAND_REG(part); return; case SSD1306_VIRT_SET_COLUMN_HIGH_NIBBLE ... SSD1306_VIRT_SET_COLUMN_HIGH_NIBBLE + 0xF: part->spi_data -= SSD1306_VIRT_SET_COLUMN_HIGH_NIBBLE; - part->cursor.column = (part->cursor.column & 0xF) + if (part->addr_mode == SSD1306_ADDR_MODE_PAGE) { + part->cursor.column = (part->cursor.column & 0xF) | ((part->spi_data & 0xF) << 4); + } //printf ("SSD1306: SET COLUMN HIGH NIBBLE: 0x%02x\n", part->spi_data); SSD1306_CLEAR_COMMAND_REG(part); return; -- 2.39.5