Skip to content

Commit 4d81b53

Browse files
committed
Update CIRCUITPY_BOOT_BUTTON_NO_GPIO to 0/1 for false/true. Add compile time check forbidding CIRCUITPY_BOOT_BUTTON and CIRCUITPY_BOOT_BUTTON_NO_GPIO.
1 parent c6038a6 commit 4d81b53

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

ports/raspberrypi/supervisor/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#include "RP2350.h" // CMSIS
5757
#endif
5858

59-
#ifdef CIRCUITPY_BOOT_BUTTON_NO_GPIO
59+
#if CIRCUITPY_BOOT_BUTTON_NO_GPIO
6060
#include "hardware/gpio.h"
6161
#include "hardware/sync.h"
6262
#include "hardware/structs/ioqspi.h"
@@ -584,7 +584,7 @@ void port_boot_info(void) {
584584
#endif
585585
}
586586

587-
#if defined(CIRCUITPY_BOOT_BUTTON_NO_GPIO)
587+
#if CIRCUITPY_BOOT_BUTTON_NO_GPIO
588588
bool __no_inline_not_in_flash_func(port_boot_button_pressed)(void) {
589589
// Sense the state of the boot button. Because this function
590590
// disables flash, it cannot be safely called once the second

py/circuitpy_mpconfig.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,15 @@ void background_callback_run_all(void);
635635
#define CIRCUITPY_SAVES_PARTITION_SIZE 0
636636
#endif
637637

638+
// Boards that have a boot button connected to a GPIO pin should set
639+
// CIRCUITPY_BOOT_BUTTON_NO_GPIO to 1.
640+
#ifndef CIRCUITPY_BOOT_BUTTON_NO_GPIO
641+
#define CIRCUITPY_BOOT_BUTTON_NO_GPIO (0)
642+
#endif
643+
#if defined(CIRCUITPY_BOOT_BUTTON) && CIRCUITPY_BOOT_BUTTON_NO_GPIO
644+
#error "CIRCUITPY_BOOT_BUTTON and CIRCUITPY_BOOT_BUTTON_NO_GPIO are mutually exclusive"
645+
#endif
646+
638647
#if defined(__GNUC__) && !defined(__ZEPHYR__)
639648
#if __GNUC__ < CIRCUITPY_MIN_GCC_VERSION
640649
// (the 3 level scheme here is required to get expansion & stringization

supervisor/shared/safe_mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void print_safe_mode_message(safe_mode_t reason) {
129129
case SAFE_MODE_USER:
130130
#if defined(BOARD_USER_SAFE_MODE_ACTION)
131131
message = BOARD_USER_SAFE_MODE_ACTION;
132-
#elif defined(CIRCUITPY_BOOT_BUTTON) || defined(CIRCUITPY_BOOT_BUTTON_NO_GPIO)
132+
#elif defined(CIRCUITPY_BOOT_BUTTON) || CIRCUITPY_BOOT_BUTTON_NO_GPIO
133133
message = MP_ERROR_TEXT("You pressed the BOOT button at start up");
134134
#else
135135
message = MP_ERROR_TEXT("You pressed the reset button during boot.");

0 commit comments

Comments
 (0)