summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-04-09 12:52:42 -0400
committerDan Halbert <halbert@halwitz.org>2018-04-09 12:52:42 -0400
commitaa8c262d141d78c148a89de63b54623ad2592e0e (patch)
tree3c79429cc76896f7070f968e631bab81fbb8dbdf /shared-module
parent4e053cea0df0105e05052087077b2431cad26718 (diff)
add storage.erase_filesystem() to erase and reformat CIRCUITPY
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/storage/__init__.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c
index 5b0bbe01e..f1fa74990 100644
--- a/shared-module/storage/__init__.c
+++ b/shared-module/storage/__init__.c
@@ -32,7 +32,9 @@
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
+#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/storage/__init__.h"
+#include "supervisor/filesystem.h"
STATIC mp_obj_t mp_vfs_proxy_call(mp_vfs_mount_t *vfs, qstr meth_name, size_t n_args, const mp_obj_t *args) {
if (vfs == MP_VFS_NONE) {
@@ -125,3 +127,9 @@ void common_hal_storage_umount_path(const char* mount_path) {
mp_obj_t common_hal_storage_getmount(const char *mount_path) {
return storage_object_from_path(mount_path);
}
+
+void common_hal_storage_erase_filesystem(void) {
+ filesystem_init(false, true); // Force a re-format.
+ common_hal_mcu_reset();
+ // We won't actually get here, since we're resetting.
+}