summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-12-10 14:04:24 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-12-10 14:04:24 +0530
commitdee86a014b783aff61a72f9915a4538a7fc97e4e (patch)
treebb2c6878024a721c073de5f108b35f30d6b9d102 /shared-bindings
parent20c3184c87ee198f97f322ec983f04cedcb9cdcc (diff)
factor out esp_ota_end
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 a6c042486..55858a80e 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_finish(void) {
+ common_hal_ota_finish();
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish);
+
STATIC mp_obj_t ota_flash(mp_obj_t program_binary_in) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(program_binary_in, &bufinfo, MP_BUFFER_READ);
@@ -41,6 +47,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(ota_flash_obj, 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_finish), MP_ROM_PTR(&ota_finish_obj) },
{ MP_ROM_QSTR(MP_QSTR_flash), MP_ROM_PTR(&ota_flash_obj) },
};
STATIC MP_DEFINE_CONST_DICT(ota_module_globals, ota_module_globals_table);
diff --git a/shared-bindings/ota/__init__.h b/shared-bindings/ota/__init__.h
index c4b40b2af..1765c21ad 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_finish(void);
extern void common_hal_ota_flash(const void *buf, const size_t len);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_OTA___INIT___H