From 6dffd67073e0cba05ea3aff1f19a264443a2b5fb Mon Sep 17 00:00:00 2001 From: "Serge Y. Stroobandt" Date: Mon, 30 Sep 2019 00:45:32 +0200 Subject: [PATCH] =?UTF-8?q?drivers/display/ssd1306.py=20=E2=80=94=20upside?= =?UTF-8?q?=5Fdown=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The added `upside_down` static method causes the contents to be rendered with a 180° rotation. If a display is to be run upside down, this method must be called prior to instantiating a `Writer` for this display. This particular OLED command sequence was originally discussed [here](https://digistump.com/board/index.php?topic=1669.0). --- .../components/micropython/esp32/modules/ssd1306.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/ssd1306.py b/MicroPython_BUILD/components/micropython/esp32/modules/ssd1306.py index d0f98424..e444b8b7 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/ssd1306.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/ssd1306.py @@ -72,6 +72,10 @@ def contrast(self, contrast): def invert(self, invert): self.write_cmd(SET_NORM_INV | (invert & 1)) + + def upside_down(self): + self.write_cmd(SET_SEG_REMAP) + self.write_cmd(SET_COM_OUT_DIR) def show(self): x0 = 0