diff --git a/main.c b/main.c index 0521170545..810348b6c9 100644 --- a/main.c +++ b/main.c @@ -62,6 +62,7 @@ #include "supervisor/shared/workflow.h" #include "supervisor/usb.h" #include "supervisor/workflow.h" +#include "supervisor/shared/external_flash/external_flash.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Processor.h" @@ -982,6 +983,3 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c __fatal_error("Assertion failed"); } #endif - -void MP_WEAK external_flash_setup(void) { -} diff --git a/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c b/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c index 5960bff666..9e862b3c01 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c @@ -28,7 +28,7 @@ #include "mpconfigboard.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" -#include "py/mphal.h" +#include "supervisor/shared/external_flash/external_flash.h" void board_init(void) { } @@ -58,7 +58,4 @@ void external_flash_setup(void) { gpio_set_pin_function(PIN_PB23, GPIO_PIN_FUNCTION_OFF); gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT); gpio_set_pin_level(PIN_PB23, true); - - // Add some delay to give the pins time to get set - // mp_hal_delay_ms(3000); } diff --git a/supervisor/board.h b/supervisor/board.h index d9aee837f7..e3f0af79a3 100644 --- a/supervisor/board.h +++ b/supervisor/board.h @@ -47,9 +47,4 @@ void reset_board(void); // disabling USB, BLE or flash) because CircuitPython may continue to run. void board_deinit(void); -// Configure anything that needs to get set up before the external flash -// is init'ed. For example, if GPIO needs to be configured to enable the -// flash chip, as is the case on some boards. -void external_flash_setup(void); - #endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index 33d618276c..7da45fdc99 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -588,3 +588,6 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, } return 0; // success } + +void MP_WEAK external_flash_setup(void) { +} diff --git a/supervisor/shared/external_flash/external_flash.h b/supervisor/shared/external_flash/external_flash.h index db5c677eb0..7966b64674 100644 --- a/supervisor/shared/external_flash/external_flash.h +++ b/supervisor/shared/external_flash/external_flash.h @@ -47,4 +47,9 @@ void supervisor_external_flash_flush(void); +// Configure anything that needs to get set up before the external flash +// is init'ed. For example, if GPIO needs to be configured to enable the +// flash chip, as is the case on some boards. +void external_flash_setup(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_EXTERNAL_FLASH_H