File tree Expand file tree Collapse file tree 5 files changed +22
-19
lines changed Expand file tree Collapse file tree 5 files changed +22
-19
lines changed Original file line number Diff line number Diff line change 24
24
* THE SOFTWARE.
25
25
*/
26
26
27
- #include <string.h>
28
-
29
- #include "py/runtime.h"
30
- #include "py/mphal.h"
31
- #include "common-hal/microcontroller/Pin.h"
32
-
33
27
// Pins aren't actually defined here. They are in the board specific directory
34
- // such as boards/arduino_zero /pins.c.
28
+ // such as boards/feather52832 /pins.csv
Original file line number Diff line number Diff line change 27
27
#include "common-hal/microcontroller/Pin.h"
28
28
#include "common-hal/microcontroller/Processor.h"
29
29
30
-
31
30
#include "shared-bindings/microcontroller/__init__.h"
32
31
#include "shared-bindings/microcontroller/Pin.h"
33
32
#include "shared-bindings/microcontroller/Processor.h"
34
33
35
- // TODO porting common_hal_mcu
34
+ #include "supervisor/filesystem.h"
35
+ #include "nrfx_glue.h"
36
+
36
37
void common_hal_mcu_delay_us (uint32_t delay ) {
37
- // os_delay_us (delay);
38
+ NRFX_DELAY_US (delay );
38
39
}
39
40
40
41
void common_hal_mcu_disable_interrupts () {
@@ -48,7 +49,8 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
48
49
}
49
50
50
51
void common_hal_mcu_reset (void ) {
51
- // TODO: see atmel-samd for functionality
52
+ filesystem_flush ();
53
+ NVIC_SystemReset ();
52
54
}
53
55
54
56
// The singleton microcontroller.Processor object, bound to microcontroller.cpu
Original file line number Diff line number Diff line change 28
28
29
29
#include "py/mperrno.h"
30
30
#include "py/runtime.h"
31
+ #include "shared-bindings/microcontroller/__init__.h"
31
32
#include "shared-bindings/storage/__init__.h"
33
+ #include "supervisor/filesystem.h"
32
34
33
35
extern volatile bool mp_msc_enabled ;
34
36
35
- void common_hal_storage_remount (const char * mount_path , bool readonly ) {
36
- if (strcmp (mount_path , "/" ) != 0 ) {
37
+ void common_hal_storage_remount (const char * mount_path , bool readonly ) {
38
+ if (strcmp (mount_path , "/" ) != 0 )
37
39
mp_raise_OSError (MP_EINVAL );
38
- }
39
40
}
40
41
41
- void common_hal_storage_erase_filesystem () {
42
- mp_raise_NotImplementedError ("" );
42
+ void common_hal_storage_erase_filesystem (void ) {
43
+ filesystem_init (false, true); // Force a re-format.
44
+ common_hal_mcu_reset ();
45
+ // We won't actually get here, since we're resetting.
43
46
}
Original file line number Diff line number Diff line change 29
29
#include "shared-bindings/time/__init__.h"
30
30
#include "tick.h"
31
31
32
- inline uint64_t common_hal_time_monotonic () {
33
- return ticks_ms ;
32
+ #include "nrfx_glue.h"
33
+
34
+ inline uint64_t common_hal_time_monotonic (void ) {
35
+ return ticks_ms ;
34
36
}
35
37
36
38
void common_hal_time_delay_ms (uint32_t delay ) {
37
- mp_hal_delay_ms (delay );
39
+ NRFX_DELAY_US (delay );
38
40
}
Original file line number Diff line number Diff line change 45
45
extern "C" {
46
46
#endif
47
47
48
+ #include <drivers/nrfx_common.h>
49
+
48
50
/**
49
51
* @defgroup nrfx_glue nrfx_glue.h
50
52
* @{
You can’t perform that action at this time.
0 commit comments