summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-09-14 14:56:51 -0700
committerGitHub <noreply@github.com>2020-09-14 14:56:51 -0700
commita60906d7df11dac826ccc729d8d8e8fb4cd8e954 (patch)
treeb45c6fc850c0210d162e89e7eea4450a5228e2f7 /shared-module
parent3d8bac50e41acc286cefbde9e052c5ccb335101e (diff)
parente504438fd223c9bb0b9d6950a699f1283ece137c (diff)
Merge pull request #3392 from hierophect/esp32-displayio-fix
Fix some DisplayIO crashes, add ESP32-S2 debugging capability
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/FourWire.c4
-rw-r--r--shared-module/displayio/I2CDisplay.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c
index 17e8cfa1d..726116208 100644
--- a/shared-module/displayio/FourWire.c
+++ b/shared-module/displayio/FourWire.c
@@ -76,7 +76,9 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) {
common_hal_reset_pin(self->command.pin);
common_hal_reset_pin(self->chip_select.pin);
- common_hal_reset_pin(self->reset.pin);
+ if (self->reset.pin) {
+ common_hal_reset_pin(self->reset.pin);
+ }
}
bool common_hal_displayio_fourwire_reset(mp_obj_t obj) {
diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c
index 0c8f2e69a..5bd03dcd6 100644
--- a/shared-module/displayio/I2CDisplay.c
+++ b/shared-module/displayio/I2CDisplay.c
@@ -53,6 +53,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self,
// Probe the bus to see if a device acknowledges the given address.
if (!common_hal_busio_i2c_probe(i2c, device_address)) {
+ self->base.type = &mp_type_NoneType;
mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address);
}
@@ -71,7 +72,9 @@ void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) {
common_hal_busio_i2c_deinit(self->bus);
}
- common_hal_reset_pin(self->reset.pin);
+ if (self->reset.base.type == &digitalio_digitalinout_type) {
+ common_hal_digitalio_digitalinout_deinit(&self->reset);
+ }
}
bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) {