Skip to content

Rotation not supported #17

@FxIII

Description

@FxIII

I'm using this library with the DSTIKE ESP32 Watch DevKit TFT here.
It works like a charm (put python into a watch was my secret dream).
Alas the screen is rotated 90° cw, I added a function to set rotation :

STATIC mp_obj_t st7789_ST7789_set_rotation(mp_obj_t self_in, mp_obj_t value) {
    st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
    mp_int_t m = mp_obj_get_int(value);
    uint8_t madctl[] = {ST7789_MADCTL_RGB};
    switch (m) {
    case 0:
      madctl[0] =  ST7789_MADCTL_MX | ST7789_MADCTL_MY | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 1:
      madctl[0] =  ST7789_MADCTL_MY | ST7789_MADCTL_MV | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 2:
      madctl[0] =  ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 3:
      madctl[0] =  ST7789_MADCTL_MX | ST7789_MADCTL_MV | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    default:
      break;
    }
    return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(st7789_ST7789_set_rotation_obj, st7789_ST7789_set_rotation);

But when setting in mode 1 there is like an offset of 80 pixels (the fill function leaves a vertical band on the right)

No clues of what next (I'm remapping everything in sw right now). Any Idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions