Skip to content

Commit 3b5171c

Browse files
committed
Move hook implementation to supervisor
1 parent 32fc084 commit 3b5171c

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "supervisor/shared/workflow.h"
6363
#include "supervisor/usb.h"
6464
#include "supervisor/workflow.h"
65+
#include "supervisor/shared/external_flash/external_flash.h"
6566

6667
#include "shared-bindings/microcontroller/__init__.h"
6768
#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
982983
__fatal_error("Assertion failed");
983984
}
984985
#endif
985-
986-
void MP_WEAK external_flash_setup(void) {
987-
}

ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "mpconfigboard.h"
2929
#include "common-hal/microcontroller/Pin.h"
3030
#include "hal/include/hal_gpio.h"
31-
#include "py/mphal.h"
31+
#include "supervisor/shared/external_flash/external_flash.h"
3232

3333
void board_init(void) {
3434
}
@@ -58,7 +58,4 @@ void external_flash_setup(void) {
5858
gpio_set_pin_function(PIN_PB23, GPIO_PIN_FUNCTION_OFF);
5959
gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT);
6060
gpio_set_pin_level(PIN_PB23, true);
61-
62-
// Add some delay to give the pins time to get set
63-
// mp_hal_delay_ms(3000);
6461
}

supervisor/board.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,4 @@ void reset_board(void);
4747
// disabling USB, BLE or flash) because CircuitPython may continue to run.
4848
void board_deinit(void);
4949

50-
// Configure anything that needs to get set up before the external flash
51-
// is init'ed. For example, if GPIO needs to be configured to enable the
52-
// flash chip, as is the case on some boards.
53-
void external_flash_setup(void);
54-
5550
#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H

supervisor/shared/external_flash/external_flash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,3 +588,6 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
588588
}
589589
return 0; // success
590590
}
591+
592+
void MP_WEAK external_flash_setup(void) {
593+
}

supervisor/shared/external_flash/external_flash.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@
4747

4848
void supervisor_external_flash_flush(void);
4949

50+
// Configure anything that needs to get set up before the external flash
51+
// is init'ed. For example, if GPIO needs to be configured to enable the
52+
// flash chip, as is the case on some boards.
53+
void external_flash_setup(void);
54+
5055
#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_EXTERNAL_FLASH_H

0 commit comments

Comments
 (0)