diff options
Diffstat (limited to 'shared-bindings/supervisor')
| -rw-r--r--[-rwxr-xr-x] | shared-bindings/supervisor/Runtime.c | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | shared-bindings/supervisor/Runtime.h | 6 | ||||
| -rw-r--r-- | shared-bindings/supervisor/__init__.c | 18 | ||||
| -rw-r--r--[-rwxr-xr-x] | shared-bindings/supervisor/__init__.h | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 283c8a1d6..4c004e092 100755..100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -35,7 +35,7 @@ STATIC supervisor_run_reason_t _run_reason; -//TODO: add USB, REPL to description once they're operational +// TODO: add USB, REPL to description once they're operational //| class Runtime: //| """Current status of runtime objects. //| @@ -55,7 +55,7 @@ STATIC supervisor_run_reason_t _run_reason; //| serial_connected: bool //| """Returns the USB serial communication status (read-only).""" //| -STATIC mp_obj_t supervisor_runtime_get_serial_connected(mp_obj_t self){ +STATIC mp_obj_t supervisor_runtime_get_serial_connected(mp_obj_t self) { return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_connected()); } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial_connected_obj, supervisor_runtime_get_serial_connected); @@ -72,7 +72,7 @@ const mp_obj_property_t supervisor_runtime_serial_connected_obj = { //| 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_runtime_get_serial_bytes_available(mp_obj_t self){ +STATIC mp_obj_t supervisor_runtime_get_serial_bytes_available(mp_obj_t self) { return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_bytes_available()); } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_serial_bytes_available_obj, supervisor_runtime_get_serial_bytes_available); diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index 6874ac744..3a94a8fd5 100755..100644 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -40,8 +40,8 @@ bool common_hal_supervisor_runtime_get_serial_connected(void); bool common_hal_supervisor_runtime_get_serial_bytes_available(void); -//TODO: placeholders for future functions -//bool common_hal_get_supervisor_runtime_repl_active(void); -//bool common_hal_get_supervisor_runtime_usb_enumerated(void); +// TODO: placeholders for future functions +// bool common_hal_get_supervisor_runtime_repl_active(void); +// bool common_hal_get_supervisor_runtime_usb_enumerated(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR_RUNTIME_H diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index ad8603047..28ac68d62 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -73,14 +73,14 @@ MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_autoreload_obj, supervisor_disable_ //| `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. - int brightness_int = mp_obj_get_int(lvl); - if(brightness_int < 0 || brightness_int > 255){ - mp_raise_ValueError(translate("Brightness must be between 0 and 255")); - } - set_rgb_status_brightness((uint8_t)brightness_int); - return mp_const_none; +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. + int brightness_int = mp_obj_get_int(lvl); + if (brightness_int < 0 || brightness_int > 255) { + mp_raise_ValueError(translate("Brightness must be between 0 and 255")); + } + set_rgb_status_brightness((uint8_t)brightness_int); + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness); @@ -128,5 +128,5 @@ STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals const mp_obj_module_t supervisor_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&supervisor_module_globals, + .globals = (mp_obj_dict_t *)&supervisor_module_globals, }; diff --git a/shared-bindings/supervisor/__init__.h b/shared-bindings/supervisor/__init__.h index b79bdacca..a2ad3dd6d 100755..100644 --- a/shared-bindings/supervisor/__init__.h +++ b/shared-bindings/supervisor/__init__.h @@ -27,7 +27,7 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR___INIT___H -//#include "py/mpconfig.h" +// #include "py/mpconfig.h" #include "py/obj.h" #include "common-hal/supervisor/Runtime.h" |
