From 66fbc1f9035558d01fd9dcef1b5efc6d7d431d83 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 3 Nov 2021 17:36:32 +0100 Subject: ssd1306: support both vertical and horizontal adress modes --- include/driver/ssd1306.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'include/driver') diff --git a/include/driver/ssd1306.h b/include/driver/ssd1306.h index 37cee81..a3afc0f 100644 --- a/include/driver/ssd1306.h +++ b/include/driver/ssd1306.h @@ -49,16 +49,37 @@ class SSD1306 { // Turn off power for configuration SSD1306_SET_DISP | 0x00, +#ifdef CONFIG_driver_ssd1306_mode_horizontal /* - * Enable Horizontal Addressing Mode. Assuming image data is - * {A, B, C, ...}, each byte corresponds to a 1x8 column, starting + * Enable Horizontal Addressing Mode. Assuming image data is {A, B, C, + * ..., a, b, c, ...}, each byte corresponds to a 1x8 column, starting * at the top left corner and proceeding to the right and then down: * * A7 B7 C7 ... * .. .. .. ... * A0 B0 C0 ... + * a7 b7 c7 ... + * .. .. .. ... + * a0 b0 c0 ... */ SSD1306_SET_MEM_ADDR, 0x00, +#endif +#ifdef CONFIG_driver_ssd1306_mode_vertical + /* + * Enable Vertical Addressing Mode. Assuming image data is {A, B, C, + * ..., a, b, c, ...}, each byte corresponds to a 1x8 column, starting + * at the top left corner and proceeding down and then to the right: + * + * A7 a7 ... + * .. .. ... + * A0 a0 ... + * B7 b7 ... + * .. .. ... + * B0 b0 ... + * .. .. ... + */ + SSD1306_SET_MEM_ADDR, 0x01, +#endif // RAM line 0 == display line 0 SSD1306_SET_DISP_START_LINE | 0x00, -- cgit v1.2.3