summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-09-04 10:23:19 -0700
committerGitHub <noreply@github.com>2019-09-04 10:23:19 -0700
commit16a8a3468851741106252c347da7aaafd7d22343 (patch)
treea9d3d971c1b8551ae346543191442c0da4f9c0fa /shared-module
parent321835cb4764e40d290635ba16a849aad6463f8d (diff)
parent5f6228b6f02c229e84cc64c1e2b6a2332354c186 (diff)
Merge pull request #2117 from pewpew-game/stage-fix-transaction
Fix transactions in _stage after displayio changes
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/_stage/__init__.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c
index 2c525be87..d5da74272 100644
--- a/shared-module/_stage/__init__.c
+++ b/shared-module/_stage/__init__.c
@@ -36,6 +36,22 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
uint16_t *buffer, size_t buffer_size,
displayio_display_obj_t *display, uint8_t scale) {
+
+ displayio_area_t area;
+ area.x1 = x0;
+ area.y1 = y0;
+ area.x2 = x1;
+ area.y2 = y1;
+ displayio_display_core_set_region_to_update(
+ &display->core, display->set_column_command, display->set_row_command,
+ NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area);
+
+ while (!displayio_display_core_begin_transaction(&display->core)) {
+ RUN_BACKGROUND_TASKS;
+ }
+ display->core.send(display->core.bus, DISPLAY_COMMAND,
+ CHIP_SELECT_TOGGLE_EVERY_BYTE,
+ &display->write_ram_command, 1);
size_t index = 0;
for (uint16_t y = y0; y < y1; ++y) {
for (uint8_t yscale = 0; yscale < scale; ++yscale) {
@@ -57,8 +73,9 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
index += 1;
// The buffer is full, send it.
if (index >= buffer_size) {
- display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer),
- buffer_size * 2);
+ display->core.send(display->core.bus, DISPLAY_DATA,
+ CHIP_SELECT_UNTOUCHED,
+ ((uint8_t*)buffer), buffer_size * 2);
index = 0;
}
}
@@ -67,6 +84,10 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
}
// Send the remaining data.
if (index) {
- display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer), index * 2);
+ display->core.send(display->core.bus, DISPLAY_DATA,
+ CHIP_SELECT_UNTOUCHED,
+ ((uint8_t*)buffer), index * 2);
}
+
+ displayio_display_core_end_transaction(&display->core);
}