From f7966df39849bfc0c6954d058a621da0d58335e0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 11 Apr 2021 09:37:25 +0200 Subject: examples/ssd1306: add support for 128x32 displays --- commandline/examples/ssd1306-init | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'commandline/examples/ssd1306-init') diff --git a/commandline/examples/ssd1306-init b/commandline/examples/ssd1306-init index 56e77e5..4d587be 100755 --- a/commandline/examples/ssd1306-init +++ b/commandline/examples/ssd1306-init @@ -3,8 +3,14 @@ WR_CMD=0x80 WR_DATA=0x40 -WIDTH=128 -HEIGHT=64 +: ${WIDTH:=128} +: ${HEIGHT:=64} + +if [ "${HEIGHT}" = 32 ]; then + COM_PIN_CFG=0x02 +else + COM_PIN_CFG=0x12 +fi SET_CONTRAST=0x81 SET_ENTIRE_ON=0xa4 @@ -32,7 +38,7 @@ for cmd in $SET_DISP_OFF \ $SET_MUX_RATIO $(( HEIGHT - 1 )) \ $SET_COM_OUT_DIR_08 \ $SET_DISP_OFFSET 0x00 \ - $SET_COM_PIN_CFG 0x12 \ + $SET_COM_PIN_CFG $COM_PIN_CFG \ $SET_DISP_CLK_DIV 0x80 \ $SET_PRECHARGE 0xf1 \ $SET_VCOM_DESEL 0x30 \ -- cgit v1.2.3