|
30 | 30 |
|
31 | 31 | //TODO: add USB, REPL to description once they're operational
|
32 | 32 | //| .. currentmodule:: supervisor
|
33 |
| -//| |
| 33 | +//| |
34 | 34 | //| :class:`Runtime` --- Supervisor Runtime information
|
35 | 35 | //| ----------------------------------------------------
|
36 | 36 | //|
|
|
40 | 40 | //|
|
41 | 41 | //| import supervisor
|
42 | 42 | //| if supervisor.runtime.serial_connected:
|
43 |
| -//| print("Hello World!") |
| 43 | +//| print("Hello World!") |
44 | 44 | //|
|
45 | 45 |
|
46 | 46 | //| .. class:: Runtime()
|
|
49 | 49 | //| Use `supervisor.runtime` to access the sole instance available.
|
50 | 50 | //|
|
51 | 51 |
|
52 |
| -//| .. attribute:: runtime.serial_connected |
| 52 | +//| .. attribute:: runtime.serial_connected |
| 53 | +//| |
| 54 | +//| Returns the USB serial communication status (read-only). |
| 55 | +//| |
| 56 | +//| .. note:: |
53 | 57 | //|
|
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) |
55 | 61 | //|
|
| 62 | +//| Feather52 (nRF52832): Currently returns ``True`` regardless |
| 63 | +//| of USB connection status. |
| 64 | +//| |
| 65 | + |
56 | 66 | STATIC mp_obj_t supervisor_get_serial_connected(mp_obj_t self){
|
57 | 67 | if (!common_hal_get_serial_connected()) {
|
58 | 68 | return mp_const_false;
|
59 |
| - } |
| 69 | + } |
60 | 70 | else {
|
61 | 71 | return mp_const_true;
|
62 |
| - } |
| 72 | + } |
63 | 73 | }
|
64 | 74 | MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_serial_connected_obj, supervisor_get_serial_connected);
|
65 | 75 |
|
66 | 76 | const mp_obj_property_t supervisor_serial_connected_obj = {
|
67 | 77 | .base.type = &mp_type_property,
|
68 | 78 | .proxy = {(mp_obj_t)&supervisor_get_serial_connected_obj,
|
69 | 79 | (mp_obj_t)&mp_const_none_obj,
|
70 |
| - (mp_obj_t)&mp_const_none_obj}, |
| 80 | + (mp_obj_t)&mp_const_none_obj}, |
71 | 81 | };
|
72 | 82 |
|
73 | 83 | STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {
|
|
0 commit comments