Skip to content

Commit 08e94e6

Browse files
committed
add more docs
1 parent cb35abf commit 08e94e6

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

shared-bindings/ota/__init__.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,26 @@
2626

2727
#include "shared-bindings/ota/__init__.h"
2828

29-
//| """ota module
29+
//| """OTA Module
30+
//|
31+
//| The `ota` module implements over-the-air update.
32+
//|
33+
//| There are two identical ota partitions ota_0/1, these
34+
//| contain different firmware versions.
35+
//| Having two partitions enables rollback functionality.
36+
//|
37+
//| The two partitions are defined as boot partition and
38+
//| next-update partition. Calling `ota.flash()` writes the
39+
//| next-update partition.
40+
//|
41+
//| After the next-update partition is written a validation
42+
//| check is performed and on a successful validation this
43+
//| partition is set as the boot partition. On next reset,
44+
//| firmware will be loaded from this partition"""
3045
//|
31-
//| The `ota` module implements over-the-air update."""
3246

3347
//| def switch() -> None:
34-
//| """Switches the boot partition.
48+
//| """Switches the boot partition."""
3549
//| ...
3650
//|
3751
STATIC mp_obj_t ota_switch(void) {
@@ -42,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch);
4256

4357
//| def finish() -> None:
4458
//| """Validates flashed firmware, sets next boot partition.
45-
//| **Must be called after** `ota.flash()`
59+
//| **Must be called after** `ota.flash()`"""
4660
//| ...
4761
//|
4862
STATIC mp_obj_t ota_finish(void) {
@@ -52,7 +66,10 @@ STATIC mp_obj_t ota_finish(void) {
5266
STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish);
5367

5468
//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None:
55-
//| """Writes one of two OTA partition at the given offset.
69+
//| """Writes one of two OTA partitions at the given offset.
70+
//|
71+
//| The default offset is 0. It is necessary to provide the
72+
//| offset when writing in discontinous chunks."""
5673
//| ...
5774
//|
5875
STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

0 commit comments

Comments
 (0)