From 182469e0d55c27ec2aefade5e0ee04122ce48de7 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Mon, 16 Nov 2026 12:20:32 +0100 Subject: [PATCH 1/3] add volatile statement to loop --- ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c | 2 +- ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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..03dc97bb01a 100644 --- a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c @@ -54,7 +54,7 @@ static void pre_init(void) { gpio_set_dir_masked(SR_PIN_MASK, SR_PIN_DIR); gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; - for (uint8_t i = 0u; i < 8; i++) { + for (volatile uint8_t i = 0u; i < 8; i++) { gpio_put(SR_CLK, true); if (gpio_get(SR_DATA)) { state |= (0b1 << i); 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..b3c355bddb6 100644 --- a/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_7_3/board.c @@ -52,7 +52,7 @@ static void pre_init(void) { gpio_set_dir_masked(SR_PIN_MASK, SR_PIN_DIR); gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; - for (uint8_t i = 0u; i < 8; i++) { + for (volatile uint8_t i = 0u; i < 8; i++) { gpio_put(SR_CLK, true); if (gpio_get(SR_DATA)) { state |= (0b1 << i); From f13afa362e7c8b25a08e66bb1d933803d2ea71d2 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Mon, 16 Nov 2026 12:21:08 +0100 Subject: [PATCH 2/3] use pin-names from schematic (unify with Inky-Frame 5.7) --- .../boards/pimoroni_inky_frame_7_3/pins.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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) }, From 24559d48d39454a917f4de3e2373ee895ca33925 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Tue, 17 Nov 2026 19:33:20 +0100 Subject: [PATCH 3/3] use delays instead of volatile; manually reset LED_CONN (no more bulk reset) --- .../boards/pimoroni_inky_frame_5_7/board.c | 11 ++++++++--- .../boards/pimoroni_inky_frame_7_3/board.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) 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 03dc97bb01a..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 @@ -54,7 +55,8 @@ static void pre_init(void) { gpio_set_dir_masked(SR_PIN_MASK, SR_PIN_DIR); gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; - for (volatile uint8_t i = 0u; i < 8; i++) { + 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 b3c355bddb6..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; @@ -52,7 +53,8 @@ static void pre_init(void) { gpio_set_dir_masked(SR_PIN_MASK, SR_PIN_DIR); gpio_put_masked(SR_PIN_MASK, SR_PIN_VALUE); uint8_t state = 0u; - for (volatile uint8_t i = 0u; i < 8; i++) { + 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);