diff options
-rw-r--r-- | stmhal/modpyb.c | 11 | ||||
-rw-r--r-- | stmhal/moduos.c | 8 | ||||
-rw-r--r-- | stmhal/portmodules.h | 2 |
3 files changed, 7 insertions, 14 deletions
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index b81f43c1d0..c71d3e77e2 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -339,15 +339,6 @@ STATIC mp_obj_t pyb_freq(mp_uint_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_freq_obj, 0, 4, pyb_freq); -/// \function sync() -/// Sync all file systems. -STATIC mp_obj_t pyb_sync(void) { - storage_flush(); - disk_ioctl(2, CTRL_SYNC, NULL); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_sync_obj, pyb_sync); - /// \function millis() /// Returns the number of milliseconds since the board was last reset. /// @@ -522,7 +513,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_elapsed_micros), (mp_obj_t)&pyb_elapsed_micros_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_udelay), (mp_obj_t)&pyb_udelay_obj }, - { MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&pyb_sync_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&mod_os_sync_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_mount), (mp_obj_t)&pyb_mount_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_Timer), (mp_obj_t)&pyb_timer_type }, diff --git a/stmhal/moduos.c b/stmhal/moduos.c index 7c73d60510..296440ad90 100644 --- a/stmhal/moduos.c +++ b/stmhal/moduos.c @@ -33,7 +33,6 @@ #include "lib/fatfs/ff.h" #include "lib/fatfs/diskio.h" #include "rng.h" -#include "storage.h" #include "file.h" #include "sdcard.h" #include "fsusermount.h" @@ -309,11 +308,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); /// \function sync() /// Sync all filesystems. STATIC mp_obj_t os_sync(void) { - storage_flush(); + disk_ioctl(0, CTRL_SYNC, NULL); + disk_ioctl(1, CTRL_SYNC, NULL); disk_ioctl(2, CTRL_SYNC, NULL); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync); +MP_DEFINE_CONST_FUN_OBJ_0(mod_os_sync_obj, os_sync); #if MICROPY_HW_ENABLE_RNG /// \function urandom(n) @@ -343,7 +343,7 @@ STATIC const mp_map_elem_t os_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_stat), (mp_obj_t)&os_stat_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_unlink), (mp_obj_t)&os_remove_obj }, // unlink aliases to remove - { MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&os_sync_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&mod_os_sync_obj }, /// \constant sep - separation character used in paths { MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_OBJ_NEW_QSTR(MP_QSTR__slash_) }, diff --git a/stmhal/portmodules.h b/stmhal/portmodules.h index 86580ea7fe..66354f7723 100644 --- a/stmhal/portmodules.h +++ b/stmhal/portmodules.h @@ -33,4 +33,6 @@ extern const mp_obj_module_t mp_module_usocket; // additional helper functions exported by the modules +MP_DECLARE_CONST_FUN_OBJ(mod_os_sync_obj); + mp_uint_t mod_time_seconds_since_2000(mp_uint_t year, mp_uint_t month, mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second); |