Move hook implementation to supervisor

This commit is contained in:
George White 2022-04-18 14:09:36 +00:00
parent 32fc084b39
commit 3b5171c4ff
5 changed files with 10 additions and 12 deletions

4
main.c
View File

@ -62,6 +62,7 @@
#include "supervisor/shared/workflow.h" #include "supervisor/shared/workflow.h"
#include "supervisor/usb.h" #include "supervisor/usb.h"
#include "supervisor/workflow.h" #include "supervisor/workflow.h"
#include "supervisor/shared/external_flash/external_flash.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Processor.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"); __fatal_error("Assertion failed");
} }
#endif #endif
void MP_WEAK external_flash_setup(void) {
}

View File

@ -28,7 +28,7 @@
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "py/mphal.h" #include "supervisor/shared/external_flash/external_flash.h"
void board_init(void) { 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_function(PIN_PB23, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT); gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT);
gpio_set_pin_level(PIN_PB23, true); gpio_set_pin_level(PIN_PB23, true);
// Add some delay to give the pins time to get set
// mp_hal_delay_ms(3000);
} }

View File

@ -47,9 +47,4 @@ void reset_board(void);
// disabling USB, BLE or flash) because CircuitPython may continue to run. // disabling USB, BLE or flash) because CircuitPython may continue to run.
void board_deinit(void); 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 #endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H

View File

@ -588,3 +588,6 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
} }
return 0; // success return 0; // success
} }
void MP_WEAK external_flash_setup(void) {
}

View File

@ -47,4 +47,9 @@
void supervisor_external_flash_flush(void); 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 #endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_EXTERNAL_FLASH_H