Fixed I2CDisplay reset issue
This commit is contained in:
parent
91156670e9
commit
39b38256fd
@ -42,6 +42,16 @@
|
|||||||
void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self,
|
void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self,
|
||||||
busio_i2c_obj_t* i2c, uint16_t device_address, const mcu_pin_obj_t* reset) {
|
busio_i2c_obj_t* i2c, uint16_t device_address, const mcu_pin_obj_t* reset) {
|
||||||
|
|
||||||
|
// Reset the display before probing
|
||||||
|
self->reset.base.type = &mp_type_NoneType;
|
||||||
|
if (reset != NULL) {
|
||||||
|
self->reset.base.type = &digitalio_digitalinout_type;
|
||||||
|
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||||
|
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||||
|
never_reset_pin_number(reset->number);
|
||||||
|
common_hal_displayio_i2cdisplay_reset(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)) {
|
||||||
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);
|
||||||
@ -55,15 +65,6 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self,
|
|||||||
gc_never_free(self->bus);
|
gc_never_free(self->bus);
|
||||||
|
|
||||||
self->address = device_address;
|
self->address = device_address;
|
||||||
|
|
||||||
self->reset.base.type = &mp_type_NoneType;
|
|
||||||
if (reset != NULL) {
|
|
||||||
self->reset.base.type = &digitalio_digitalinout_type;
|
|
||||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
|
||||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
|
||||||
never_reset_pin_number(reset->number);
|
|
||||||
common_hal_displayio_i2cdisplay_reset(self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) {
|
void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user