Correct idle status of SCK pin

This commit is contained in:
Jeff Epler 2023-09-14 14:56:39 -05:00
parent 4b41fdb586
commit ef9f75ead1
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 7 additions and 1 deletions

View File

@ -47,6 +47,10 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp
while (!common_hal_busio_i2c_try_lock(bus->bus)) {
RUN_BACKGROUND_TASKS;
}
// ensure deasserted CS and idle CLK
pin_change(bus, /* set */ bus->cs_mask, /* clear */ bus->clk_mask);
for (uint32_t i = 0; i < init_sequence_len; /* NO INCREMENT */) {
uint8_t *cmd = init_sequence + i;
uint8_t data_size = *(cmd + 1);
@ -57,8 +61,10 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp
ioexpander_bus_send(bus, true, cmd, 1);
ioexpander_bus_send(bus, false, data, data_size);
// idle CLK
pin_change(bus, 0, /* clear */ bus->clk_mask);
// deassert CS
pin_change(bus, /* set */ bus->cs_mask, /* clear */ 0);
pin_change(bus, /* set */ bus->cs_mask, 0);
uint16_t delay_length_ms = 10;
if (delay) {