Commit 67504103373de3bedd9980d43d1d9e5db76fa822
authorDelio Brignoli <brignoli.delio@gmail.com>
Mon, 18 Sep 2017 12:14:37 +0000 (14:14 +0200)
committerMichel Pollet <github.com@pollet.net>
Tue, 19 Sep 2017 09:02:21 +0000 (10:02 +0100)
examples/parts/ssd1306_virt.c

index 7021d73b4a02f4da12e37a4d7b14c90a874e2924..1ffa0e1045ccc09ba6fce449b8ed17c83d77e348 100644 (file)
@@ -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;