summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-01-23 14:43:54 -0800
committerScott Shawcroft <scott@tannewt.org>2019-01-23 14:43:54 -0800
commit3139d0dc20cf55565ea6654e8e9ef4a78363ff21 (patch)
tree0cb2d7ab15ae7d5b0debae52d30755b4978c7d55
parentaaa644b223bcf86db6af14416916ea74311f7903 (diff)
Use common delay function during display init so we don't starve background tasks.
-rw-r--r--shared-module/displayio/Display.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index f75f0392f..7946111b7 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -29,6 +29,7 @@
#include "py/runtime.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/ParallelBus.h"
+#include "shared-bindings/time/__init__.h"
#include <stdint.h>
@@ -73,18 +74,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
uint8_t *data = cmd + 2;
self->send(self->bus, true, cmd, 1);
self->send(self->bus, false, data, data_size);
+ uint16_t delay_length_ms = 10;
if (delay) {
data_size++;
- uint16_t delay_length_ms = *(cmd + 1 + data_size);
+ delay_length_ms = *(cmd + 1 + data_size);
if (delay_length_ms == 255) {
delay_length_ms = 500;
}
- uint64_t start = ticks_ms;
- while (ticks_ms - start < delay_length_ms) {}
- } else {
- uint64_t start = ticks_ms;
- while (ticks_ms - start < 10) {}
}
+ common_hal_time_delay_ms(delay_length_ms);
i += 2 + data_size;
}
self->end_transaction(self->bus);