diff options
| author | Dave Astels <dastels@daveastels.com> | 2019-07-31 18:46:41 -0400 |
|---|---|---|
| committer | Dave Astels <dastels@daveastels.com> | 2019-07-31 18:46:41 -0400 |
| commit | cd092df9d875d444cf110fc0a1dbb427b261bf8a (patch) | |
| tree | e0d2da5d55335a485d75cd2ada2e3d70e9fb2ccc /shared-module/displayio/__init__.c | |
| parent | 1f9cb44fa3a09996d042b7b9e01864bf2feac363 (diff) | |
| parent | 366fdcce18e148a6828b7a7074e1e4198fca3595 (diff) | |
Merge remote-tracking branch 'adafruit/master' into displayio_fill_area
Diffstat (limited to 'shared-module/displayio/__init__.c')
| -rw-r--r-- | shared-module/displayio/__init__.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 97060aaeb..8f6e650a1 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -209,35 +209,35 @@ void reset_displays(void) { } } } else if (displays[i].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type) { - displayio_i2cdisplay_obj_t* i2c = &displays[i].i2cdisplay_bus; - if (((uint32_t) i2c->bus) < ((uint32_t) &displays) || - ((uint32_t) i2c->bus) > ((uint32_t) &displays + CIRCUITPY_DISPLAY_LIMIT)) { - busio_i2c_obj_t* original_i2c = i2c->bus; - #if BOARD_I2C - // We don't need to move original_i2c if it is the board.SPI object because it is - // statically allocated already. (Doing so would also make it impossible to reference in - // a subsequent VM run.) - if (original_i2c == common_hal_board_get_i2c()) { - continue; - } - #endif - memcpy(&i2c->inline_bus, original_i2c, sizeof(busio_i2c_obj_t)); - i2c->bus = &i2c->inline_bus; - // Check for other displays that use the same i2c bus and swap them too. - for (uint8_t j = i + 1; j < CIRCUITPY_DISPLAY_LIMIT; j++) { - if (displays[i].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type && - displays[i].i2cdisplay_bus.bus == original_i2c) { - displays[i].i2cdisplay_bus.bus = &i2c->inline_bus; - } + displayio_i2cdisplay_obj_t* i2c = &displays[i].i2cdisplay_bus; + if (((uint32_t) i2c->bus) < ((uint32_t) &displays) || + ((uint32_t) i2c->bus) > ((uint32_t) &displays + CIRCUITPY_DISPLAY_LIMIT)) { + busio_i2c_obj_t* original_i2c = i2c->bus; + #if BOARD_I2C + // We don't need to move original_i2c if it is the board.SPI object because it is + // statically allocated already. (Doing so would also make it impossible to reference in + // a subsequent VM run.) + if (original_i2c == common_hal_board_get_i2c()) { + continue; + } + #endif + memcpy(&i2c->inline_bus, original_i2c, sizeof(busio_i2c_obj_t)); + i2c->bus = &i2c->inline_bus; + // Check for other displays that use the same i2c bus and swap them too. + for (uint8_t j = i + 1; j < CIRCUITPY_DISPLAY_LIMIT; j++) { + if (displays[i].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type && + displays[i].i2cdisplay_bus.bus == original_i2c) { + displays[i].i2cdisplay_bus.bus = &i2c->inline_bus; } } } - } - - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].display.base.type == NULL) { + } else { + // Not an active display. continue; } + + // Reset the displayed group. Only the first will get the terminal but + // that's ok. displayio_display_obj_t* display = &displays[i].display; display->auto_brightness = true; common_hal_displayio_display_show(display, &circuitpython_splash); |
