diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-11-23 15:04:26 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-23 15:04:26 -0800 |
| commit | 491e3147994cfc92105b0b77b601d7a26734805b (patch) | |
| tree | 9bcf1af7cf0eca697aaf92b6e214568517a46e37 /shared-module | |
| parent | c67f5892ffec4f279ccb4e10bc82ca4ca8679fab (diff) | |
| parent | 982bce7259a9bbf7493f86258fc3395f31081648 (diff) | |
Merge pull request #3718 from jepler/epd-rotation
EPaperDisplay: add rotation property
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/displayio/EPaperDisplay.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 1b285b4b1..3fb37ff21 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -198,6 +198,29 @@ mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_ return self->core.bus; } +void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation){ + bool transposed = (self->core.rotation == 90 || self->core.rotation == 270); + bool will_transposed = (rotation == 90 || rotation == 270); + if(transposed != will_transposed) { + int tmp = self->core.width; + self->core.width = self->core.height; + self->core.height = tmp; + } + displayio_display_core_set_rotation(&self->core, rotation); + if (self == &displays[0].epaper_display) { + supervisor_stop_terminal(); + supervisor_start_terminal(self->core.width, self->core.height); + } + if (self->core.current_group != NULL) { + displayio_group_update_transform(self->core.current_group, &self->core.transform); + } +} + +uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self){ + return self->core.rotation; +} + + bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { uint16_t buffer_size = 128; // In uint32_ts |
