Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ssd1306 display 'rotate' method  #4015

Closed
@robhamerling

Description

@robhamerling

For some reason unknown to me the ssd1306.py driver uses the display 'upside down'. Of course this arbitrary, but what I mean: rows and columns are initialised 'mirrored' in __init().

SET_SEG_REMAP | 0x01, # column addr 127 mapped to SEG0
SET_COM_OUT_DIR | 0x08, # scan from COM[N] to COM0

I would like to use this display 'upside-up', but the driver has no 'rotate' method (like I found in the sh1106 driver). For example:

def rotate(self, flag):
    if flag:
        self.write_cmd(SET_COM_OUT_DIR)             # mirror vertically
        self.write_cmd(SET_SEG_REMAP)               # mirror horizontally (64 rows)
    else:
        self.write_cmd(SET_COM_OUT_DIR | 0x08)
        self.write_cmd(SET_SEG_REMAP | 0x01)`

Note: This addition works fine for my 64-rows display, but needs to be improved to support both 32 and 64 rows. May I suggest to add this rotate-facility to the standard driver?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions