summaryrefslogtreecommitdiff
path: root/shared-bindings/supervisor
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /shared-bindings/supervisor
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'shared-bindings/supervisor')
-rwxr-xr-xshared-bindings/supervisor/Runtime.c43
-rw-r--r--shared-bindings/supervisor/__init__.c59
-rwxr-xr-xshared-bindings/supervisor/__init__.h2
3 files changed, 40 insertions, 64 deletions
diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c
index 5ba2198e1..a420d5b80 100755
--- a/shared-bindings/supervisor/Runtime.c
+++ b/shared-bindings/supervisor/Runtime.c
@@ -29,38 +29,30 @@
#include "shared-bindings/supervisor/Runtime.h"
//TODO: add USB, REPL to description once they're operational
-//| .. currentmodule:: supervisor
+//| class Runtime:
+//| """Current status of runtime objects.
//|
-//| :class:`Runtime` --- Supervisor Runtime information
-//| ----------------------------------------------------
+//| Usage::
//|
-//| Get current status of runtime objects.
-//|
-//| Usage::
-//|
-//| import supervisor
-//| if supervisor.runtime.serial_connected:
-//| print("Hello World!")
+//| import supervisor
+//| if supervisor.runtime.serial_connected:
+//| print("Hello World!")"""
//|
-//| .. class:: Runtime()
-//|
-//| You cannot create an instance of `supervisor.Runtime`.
-//| Use `supervisor.runtime` to access the sole instance available.
+//| def __init__(self, ):
+//| """You cannot create an instance of `supervisor.Runtime`.
+//| Use `supervisor.runtime` to access the sole instance available."""
+//| ...
//|
-//| .. attribute:: runtime.serial_connected
-//|
-//| Returns the USB serial communication status (read-only).
+//| serial_connected: bool = ...
+//| """Returns the USB serial communication status (read-only).
//|
//| .. note::
//|
//| SAMD: Will return ``True`` if the USB serial connection
//| has been established at any point. Will not reset if
-//| USB is disconnected but power remains (e.g. battery connected)
-//|
-//| Feather52 (nRF52832): Currently returns ``True`` regardless
-//| of USB connection status.
+//| USB is disconnected but power remains (e.g. battery connected)"""
//|
STATIC mp_obj_t supervisor_get_serial_connected(mp_obj_t self){
@@ -81,11 +73,10 @@ const mp_obj_property_t supervisor_serial_connected_obj = {
};
-//| .. attribute:: runtime.serial_bytes_available
-//|
-//| Returns the whether any bytes are available to read
-//| on the USB serial input. Allows for polling to see whether
-//| to call the built-in input() or wait. (read-only)
+//| serial_bytes_available: int = ...
+//| """Returns the whether any bytes are available to read
+//| on the USB serial input. Allows for polling to see whether
+//| to call the built-in input() or wait. (read-only)"""
//|
STATIC mp_obj_t supervisor_get_serial_bytes_available(mp_obj_t self){
if (!common_hal_get_serial_bytes_available()) {
diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c
index 2705c8e58..1830308b7 100644
--- a/shared-bindings/supervisor/__init__.c
+++ b/shared-bindings/supervisor/__init__.c
@@ -36,33 +36,18 @@
#include "shared-bindings/supervisor/__init__.h"
#include "shared-bindings/supervisor/Runtime.h"
-//| :mod:`supervisor` --- Supervisor settings
-//| =================================================
-//|
-//| .. module:: supervisor
-//| :synopsis: Supervisor settings
-//| :platform: SAMD21/51 (All), nRF (Runtime only)
-//|
-//| The `supervisor` module. (TODO: expand description)
-//|
-//| Libraries
-//|
-//| .. toctree::
-//| :maxdepth: 3
-//|
-//| Runtime
+//| """Supervisor settings"""
//|
-//| .. attribute:: runtime
-//|
-//| Runtime information, such as `runtime.serial_connected`
-//| (USB serial connection status).
-//| This object is the sole instance of `supervisor.Runtime`.
+//| runtime: Runtime = ...
+//| """Runtime information, such as ``runtime.serial_connected``
+//| (USB serial connection status).
+//| This object is the sole instance of `supervisor.Runtime`."""
//|
-//| .. method:: enable_autoreload()
-//|
-//| Enable autoreload based on USB file write activity.
+//| def enable_autoreload(self) -> None:
+//| """Enable autoreload based on USB file write activity."""
+//| ...
//|
STATIC mp_obj_t supervisor_enable_autoreload(void) {
autoreload_enable();
@@ -70,10 +55,10 @@ STATIC mp_obj_t supervisor_enable_autoreload(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_enable_autoreload_obj, supervisor_enable_autoreload);
-//| .. method:: disable_autoreload()
-//|
-//| Disable autoreload based on USB file write activity until
-//| `enable_autoreload` is called.
+//| def disable_autoreload(self) -> None:
+//| """Disable autoreload based on USB file write activity until
+//| `enable_autoreload` is called."""
+//| ...
//|
STATIC mp_obj_t supervisor_disable_autoreload(void) {
autoreload_disable();
@@ -81,10 +66,10 @@ STATIC mp_obj_t supervisor_disable_autoreload(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_autoreload_obj, supervisor_disable_autoreload);
-//| .. method:: set_rgb_status_brightness()
-//|
-//| Set brightness of status neopixel from 0-255
-//| `set_rgb_status_brightness` is called.
+//| def set_rgb_status_brightness(self, brightness: int) -> None:
+//| """Set brightness of status neopixel from 0-255
+//| `set_rgb_status_brightness` is called."""
+//| ...
//|
STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl){
// This must be int. If cast to uint8_t first, will never raise a ValueError.
@@ -97,9 +82,9 @@ STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl){
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness);
-//| .. method:: reload()
-//|
-//| Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).
+//| def reload(self) -> None:
+//| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL)."""
+//| ...
//|
STATIC mp_obj_t supervisor_reload(void) {
reload_requested = true;
@@ -108,9 +93,9 @@ STATIC mp_obj_t supervisor_reload(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload);
-//| .. method:: set_next_stack_limit(size)
-//|
-//| Set the size of the stack for the next vm run. If its too large, the default will be used.
+//| def set_next_stack_limit(self, size: int) -> None:
+//| """Set the size of the stack for the next vm run. If its too large, the default will be used."""
+//| ...
//|
STATIC mp_obj_t supervisor_set_next_stack_limit(mp_obj_t size_obj) {
mp_int_t size = mp_obj_get_int(size_obj);
diff --git a/shared-bindings/supervisor/__init__.h b/shared-bindings/supervisor/__init__.h
index d2e568945..b79bdacca 100755
--- a/shared-bindings/supervisor/__init__.h
+++ b/shared-bindings/supervisor/__init__.h
@@ -36,4 +36,4 @@ extern const super_runtime_obj_t common_hal_supervisor_runtime_obj;
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR___INIT___H \ No newline at end of file
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR___INIT___H