Skip to content

Commit d1974e0

Browse files
committed
supervisor/Runtime: updated documentation for 'no disconnect'
1 parent 6205ed9 commit d1974e0

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

shared-bindings/supervisor/Runtime.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
//TODO: add USB, REPL to description once they're operational
3232
//| .. currentmodule:: supervisor
33-
//|
33+
//|
3434
//| :class:`Runtime` --- Supervisor Runtime information
3535
//| ----------------------------------------------------
3636
//|
@@ -40,7 +40,7 @@
4040
//|
4141
//| import supervisor
4242
//| if supervisor.runtime.serial_connected:
43-
//| print("Hello World!")
43+
//| print("Hello World!")
4444
//|
4545

4646
//| .. class:: Runtime()
@@ -49,25 +49,35 @@
4949
//| Use `supervisor.runtime` to access the sole instance available.
5050
//|
5151

52-
//| .. attribute:: runtime.serial_connected
52+
//| .. attribute:: runtime.serial_connected
53+
//|
54+
//| Returns the USB serial communication status (read-only).
55+
//|
56+
//| .. note::
5357
//|
54-
//| Returns the serial communication status (read-only)
58+
//| SAMD: Will return ``True`` if the USB serial connection
59+
//| has been established at any point. Will not reset if
60+
//| USB is disconnected but power remains (e.g. battery connected)
5561
//|
62+
//| Feather52 (nRF52832): Currently returns ``True`` regardless
63+
//| of USB connection status.
64+
//|
65+
5666
STATIC mp_obj_t supervisor_get_serial_connected(mp_obj_t self){
5767
if (!common_hal_get_serial_connected()) {
5868
return mp_const_false;
59-
}
69+
}
6070
else {
6171
return mp_const_true;
62-
}
72+
}
6373
}
6474
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_serial_connected_obj, supervisor_get_serial_connected);
6575

6676
const mp_obj_property_t supervisor_serial_connected_obj = {
6777
.base.type = &mp_type_property,
6878
.proxy = {(mp_obj_t)&supervisor_get_serial_connected_obj,
6979
(mp_obj_t)&mp_const_none_obj,
70-
(mp_obj_t)&mp_const_none_obj},
80+
(mp_obj_t)&mp_const_none_obj},
7181
};
7282

7383
STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {

shared-bindings/supervisor/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
//|
3636
//| .. module:: supervisor
3737
//| :synopsis: Supervisor settings
38-
//| :platform: SAMD21
38+
//| :platform: SAMD21/51 (All), nRF (Runtime only)
3939
//|
4040
//| The `supervisor` module. (TODO: expand description)
4141
//|

0 commit comments

Comments
 (0)