Fix reset pin null reference, construct error null reference
This commit is contained in:
parent
be199983c1
commit
f95ad7b27c
@ -76,8 +76,10 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) {
|
|||||||
|
|
||||||
common_hal_reset_pin(self->command.pin);
|
common_hal_reset_pin(self->command.pin);
|
||||||
common_hal_reset_pin(self->chip_select.pin);
|
common_hal_reset_pin(self->chip_select.pin);
|
||||||
|
if (self->reset.pin) {
|
||||||
common_hal_reset_pin(self->reset.pin);
|
common_hal_reset_pin(self->reset.pin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool common_hal_displayio_fourwire_reset(mp_obj_t obj) {
|
bool common_hal_displayio_fourwire_reset(mp_obj_t obj) {
|
||||||
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
|
displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||||
|
@ -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.
|
// Probe the bus to see if a device acknowledges the given address.
|
||||||
if (!common_hal_busio_i2c_probe(i2c, device_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);
|
mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,8 +72,10 @@ void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) {
|
|||||||
common_hal_busio_i2c_deinit(self->bus);
|
common_hal_busio_i2c_deinit(self->bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self->reset.pin) {
|
||||||
common_hal_reset_pin(self->reset.pin);
|
common_hal_reset_pin(self->reset.pin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) {
|
bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) {
|
||||||
displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj);
|
displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user