summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-12-10 16:42:45 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-12-10 16:42:45 +0530
commit07015ad527f81d81829190b31569a35a305676ce (patch)
treefb10286bf75e591b32c8d87ab030472c506702ba /shared-bindings
parentbfa2c604efa213628bb33ad870b851a43f21c877 (diff)
add ability to switch boot partition
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/ota/__init__.c7
-rw-r--r--shared-bindings/ota/__init__.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c
index 84a46c83a..46399dcb2 100644
--- a/shared-bindings/ota/__init__.c
+++ b/shared-bindings/ota/__init__.c
@@ -30,6 +30,12 @@
//|
//| The `ota` module implements over-the-air update."""
+STATIC mp_obj_t ota_switch(void) {
+ common_hal_ota_switch();
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch);
+
STATIC mp_obj_t ota_finish(void) {
common_hal_ota_finish();
return mp_const_none;
@@ -60,6 +66,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ota_flash_obj, 1, ota_flash);
STATIC const mp_rom_map_elem_t ota_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ota) },
+ { MP_ROM_QSTR(MP_QSTR_switch), MP_ROM_PTR(&ota_switch_obj) },
{ MP_ROM_QSTR(MP_QSTR_finish), MP_ROM_PTR(&ota_finish_obj) },
{ MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) },
};
diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h
index 9eec604e0..82273f975 100644
--- a/shared-bindings/ota/__init__.h
+++ b/shared-bindings/ota/__init__.h
@@ -29,6 +29,7 @@
#include "py/runtime.h"
+extern void common_hal_ota_switch(void);
extern void common_hal_ota_finish(void);
extern void common_hal_ota_flash(const void *buf, const size_t len, const int32_t offset);