summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-12-12 05:15:25 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-12-12 05:15:25 +0530
commit92098ca06b2d119db7810738ed7da262bdea5686 (patch)
tree19dd1977294b8676a8765037876cccd6472bd7b3 /shared-bindings
parent08e94e6a204708060860a9ed3b801bf3fb5b5ecc (diff)
update docs, implement suggested changes
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/ota/__init__.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/shared-bindings/ota/__init__.c b/shared-bindings/ota/__init__.c
index 152a8e802..8ecc6d9c4 100644
--- a/shared-bindings/ota/__init__.c
+++ b/shared-bindings/ota/__init__.c
@@ -41,11 +41,24 @@
//| After the next-update partition is written a validation
//| check is performed and on a successful validation this
//| partition is set as the boot partition. On next reset,
-//| firmware will be loaded from this partition"""
+//| firmware will be loaded from this partition.
+//|
+//| Here is the sequence of commands to follow:
+//|
+//| .. code-block:: python
+//|
+//| import ota
+//|
+//| ota.flash(buffer, offset)
+//| ota.finish()
+//| """
+//| ...
//|
//| def switch() -> None:
-//| """Switches the boot partition."""
+//| """Switches the boot partition. On next reset,
+//| firmware will be loaded from the partition
+//| just switched over to."""
//| ...
//|
STATIC mp_obj_t ota_switch(void) {
@@ -56,7 +69,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch);
//| def finish() -> None:
//| """Validates flashed firmware, sets next boot partition.
-//| **Must be called after** `ota.flash()`"""
+//| **Must be called** after the firmware has been
+//| completely written into the flash using `ota.flash()`.
+//|
+//| This is to be called only once per update."""
//| ...
//|
STATIC mp_obj_t ota_finish(void) {
@@ -65,11 +81,14 @@ STATIC mp_obj_t ota_finish(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_finish_obj, ota_finish);
-//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None:
+//| def flash(*buffer: ReadableBuffer, offset: int=0) -> None:
//| """Writes one of two OTA partitions at the given offset.
//|
//| The default offset is 0. It is necessary to provide the
-//| offset when writing in discontinous chunks."""
+//| offset when writing in discontinous chunks.
+//|
+//| This can be called multiple times when flashing the firmware
+//| in small chunks."""
//| ...
//|
STATIC mp_obj_t ota_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {