diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c index 5c1e8057bff..303bbb3150d 100644 --- a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c @@ -13,6 +13,7 @@ #include "shared-module/displayio/__init__.h" #include "shared-bindings/board/__init__.h" #include "supervisor/shared/board.h" +#include "py/mphal.h" #include "inky-shared.h" #define DELAY 0x80 @@ -55,6 +56,7 @@ static void pre_init(void) { gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; for (uint8_t i = 0u; i < 8; i++) { + mp_hal_delay_us(1); // reduce clockout frequency gpio_put(SR_CLK, true); if (gpio_get(SR_DATA)) { state |= (0b1 << i); @@ -64,8 +66,7 @@ static void pre_init(void) { reset_button_state = state; // Turn on LED_CONN so the user knows it is ok to release the button. - // The LED is only on for a short time, since it is automatically turned - // off during board-init. + // The LED is only on for a short time, since it is reset from board_init. gpio_init(LED_CONN); gpio_put(LED_CONN, true); gpio_set_dir(LED_CONN, GPIO_OUT); @@ -117,6 +118,10 @@ const uint8_t refresh_sequence[] = { }; void board_init(void) { + // reset LED_CONN (turned on in pre_init()) + gpio_deinit(LED_CONN); + + // create bus and display fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; busio_spi_obj_t *spi = common_hal_board_create_spi(0); diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c b/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c index dcafa77915d..0214492339b 100644 --- a/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c @@ -13,6 +13,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-module/displayio/__init__.h" #include "supervisor/shared/board.h" +#include "py/mphal.h" #include "inky-shared.h" digitalio_digitalinout_obj_t enable_pin_obj; @@ -53,6 +54,7 @@ static void pre_init(void) { gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; for (uint8_t i = 0u; i < 8; i++) { + mp_hal_delay_us(1); // reduce clockout frequency gpio_put(SR_CLK, true); if (gpio_get(SR_DATA)) { state |= (0b1 << i); @@ -62,8 +64,7 @@ static void pre_init(void) { reset_button_state = state; // Turn on LED_CONN so the user knows it is ok to release the button. - // The LED is only on for a short time, since it is automatically turned - // off during board-init. + // The LED is only on for a short time, since it is reset from board_init. gpio_init(LED_CONN); gpio_put(LED_CONN, true); gpio_set_dir(LED_CONN, GPIO_OUT); @@ -160,6 +161,10 @@ const uint8_t refresh_sequence[] = { }; void board_init(void) { + // reset LED_CONN (turned on in pre_init()) + gpio_deinit(LED_CONN); + + // create bus and display fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; busio_spi_obj_t *spi = common_hal_board_create_spi(0); diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/pins.c b/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/pins.c index a4310d53f03..9dc7394a3af 100644 --- a/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/pins.c +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/pins.c @@ -14,16 +14,16 @@ #include "inky-shared.h" // For use with keypad.ShiftRegisterKeys(): maps keycodes (bit-number) -// to logical names such as board.KEYCODES.BUTTON_A etc. +// to logical names such as board.KEYCODES.SW_A etc. // N.B.: labels and bit-numbers in the schematic are reversed, i.e. -// BUTTON_A on D0 has bit-number 7 +// SW_A on D0 has bit-number 7 static const qstr board_keycodes_fields[] = { - MP_QSTR_BUTTON_A, - MP_QSTR_BUTTON_B, - MP_QSTR_BUTTON_C, - MP_QSTR_BUTTON_D, - MP_QSTR_BUTTON_E, + MP_QSTR_SW_A, + MP_QSTR_SW_B, + MP_QSTR_SW_C, + MP_QSTR_SW_D, + MP_QSTR_SW_E, MP_QSTR_RTC_ALARM, MP_QSTR_EXT_TRIGGER, MP_QSTR_INKY_BUS @@ -59,9 +59,9 @@ static const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_LED_CONN), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_CLK), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_OUT), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_CLK), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_LATCH), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_OUT), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_LED_A), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO12) },