From dee86a014b783aff61a72f9915a4538a7fc97e4e Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Thu, 10 Dec 2020 14:04:24 +0530 Subject: factor out esp_ota_end --- shared-bindings/ota/__init__.c | 7 +++++++ shared-bindings/ota/__init__.h | 1 + 2 files changed, 8 insertions(+) (limited to 'shared-bindings') 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 -- cgit v1.2.3