summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/EPaperDisplay.c23
-rw-r--r--shared-module/random/__init__.c2
-rw-r--r--shared-module/time/__init__.c2
3 files changed, 25 insertions, 2 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
diff --git a/shared-module/random/__init__.c b/shared-module/random/__init__.c
index 5cc20e5b5..42499bc0a 100644
--- a/shared-module/random/__init__.c
+++ b/shared-module/random/__init__.c
@@ -44,7 +44,7 @@ STATIC uint32_t yasmarang(void)
{
if (yasmarang_pad == 0xeda4baba) {
if (!common_hal_os_urandom((uint8_t *)&yasmarang_pad, sizeof(uint32_t))) {
- yasmarang_pad = common_hal_time_monotonic() & 0xffffffff;
+ yasmarang_pad = common_hal_time_monotonic_ms() & 0xffffffff;
}
}
yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n;
diff --git a/shared-module/time/__init__.c b/shared-module/time/__init__.c
index 347e68ae0..c79a5f3ae 100644
--- a/shared-module/time/__init__.c
+++ b/shared-module/time/__init__.c
@@ -28,7 +28,7 @@
#include "supervisor/port.h"
#include "supervisor/shared/tick.h"
-uint64_t common_hal_time_monotonic(void) {
+uint64_t common_hal_time_monotonic_ms(void) {
return supervisor_ticks_ms64();
}