summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-11-25 17:52:06 -0500
committerDan Halbert <halbert@halwitz.org>2020-11-25 17:52:06 -0500
commitef0830bfe241b544b05bd3081f5bba03af57fe0d (patch)
tree28b6c45fdd03288bbf43b77f42025d1773622f13 /shared-bindings
parent9dbea36eac9a78cf324bba8d32a5cb2c9940d411 (diff)
parente778fc1f876116fd8f07b95f9eb8439745988fba (diff)
merge from upstream + wip
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/alarm/__init__.c38
-rw-r--r--shared-bindings/alarm/time/TimeAlarm.c (renamed from shared-bindings/alarm/time/MonotonicTimeAlarm.c)36
-rw-r--r--shared-bindings/alarm/time/TimeAlarm.h (renamed from shared-bindings/alarm/time/MonotonicTimeAlarm.h)8
-rw-r--r--shared-bindings/displayio/EPaperDisplay.c24
-rw-r--r--shared-bindings/displayio/EPaperDisplay.h2
-rw-r--r--shared-bindings/i2cperipheral/I2CPeripheral.c8
-rw-r--r--shared-bindings/ps2io/Ps2.c5
-rw-r--r--shared-bindings/random/__init__.h2
-rw-r--r--shared-bindings/supervisor/__init__.c44
-rw-r--r--shared-bindings/time/__init__.c5
-rw-r--r--shared-bindings/time/__init__.h2
11 files changed, 77 insertions, 97 deletions
diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c
index a3ecdd2ba..4aa6c8457 100644
--- a/shared-bindings/alarm/__init__.c
+++ b/shared-bindings/alarm/__init__.c
@@ -29,7 +29,7 @@
#include "shared-bindings/alarm/__init__.h"
#include "shared-bindings/alarm/pin/PinAlarm.h"
-#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h"
+#include "shared-bindings/alarm/time/TimeAlarm.h"
//| """Power-saving light and deep sleep. Alarms can be set to wake up from sleep.
//|
@@ -42,12 +42,9 @@
//| peripherals, such as I2C, are left on.
//|
//| Deep sleep shuts down power to nearly all of the chip including the CPU and RAM. This can save
-//| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when woken
-//| up. If the board is not actively connected to a host computer (usually via USB),
-//| CircuitPython will enter deep sleep automatically when the current program finishes its last statement
-//| or calls ``sys.exit()``.
-//| If the board is connected, the board will not enter deep sleep unless `supervisor.exit_and_deep_sleep()`
-//| is called explicitly.
+//| a more significant amount of power, but CircuitPython must start ``code.py`` from the beginning when
+//| awakened.
+
//|
//| An error includes an uncaught exception, or sys.exit() called with a non-zero argument
//|
@@ -60,7 +57,7 @@
void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) {
for (size_t i = 0; i < n_args; i++) {
if (MP_OBJ_IS_TYPE(objs[i], &alarm_pin_pin_alarm_type) ||
- MP_OBJ_IS_TYPE(objs[i], &alarm_time_monotonic_time_alarm_type)) {
+ MP_OBJ_IS_TYPE(objs[i], &alarm_time_time_alarm_type)) {
continue;
}
mp_raise_TypeError_varg(translate("Expected an alarm"));
@@ -68,8 +65,8 @@ void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) {
}
//| def sleep_until_alarms(*alarms: Alarm) -> Alarm:
-//| """Performs a light sleep until woken by one of the alarms. The alarm caused the wake-up
-//| is returned, and is also available as `alarm.wake_alarm`
+//| """Go into a light sleep until awakened one of the alarms. The alarm causing the wake-up
+//| is returned, and is also available as `alarm.wake_alarm`.
//| """
//| ...
//|
@@ -80,26 +77,26 @@ STATIC mp_obj_t alarm_sleep_until_alarms(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_sleep_until_alarms);
-//| def set_deep_sleep_alarms(*alarms: Alarm) -> None:
-//| """Set one or more alarms to wake up from a deep sleep.
+//| def exit_and_deep_sleep_until_alarms(*alarms: Alarm) -> None:
+//| """Exit the program and go into a deep sleep, until awakened by one of the alarms.
//|
-//| When awakened, the microcontroller will restart and run ``boot.py`` and ``code.py``
+//| When awakened, the microcontroller will restart and will run ``boot.py`` and ``code.py``
//| from the beginning.
//|
//| An alarm equivalent to the one that caused the wake-up is available as `alarm.wake_alarm`.
//| Its type and/or attributes may not correspond exactly to the original alarm.
-//| For time-base alarms, currently, an `alarm.time.MonotonicTimeAlarm()` is created.
+//| For time-base alarms, currently, an `alarm.time.TimeAlarm()` is created.
//|
-//| If you call this routine more than once, only the last set of alarms given will be used.
+//| If no alarms are specified, the microcontroller will deep sleep until reset.
//| """
//| ...
//|
-STATIC mp_obj_t alarm_set_deep_sleep_alarms(size_t n_args, const mp_obj_t *args) {
+STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) {
validate_objs_are_alarms(n_args, args);
- common_hal_alarm_set_deep_sleep_alarms(n_args, args);
+ common_hal_exit_and_deep_sleep_until_alarms(n_args, args);
return mp_const_none;
}
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_set_deep_sleep_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_set_deep_sleep_alarms);
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms);
//| """The `alarm.pin` module contains alarm attributes and classes related to pins.
//| """
@@ -123,7 +120,7 @@ STATIC const mp_obj_module_t alarm_pin_module = {
STATIC const mp_map_elem_t alarm_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) },
- { MP_ROM_QSTR(MP_QSTR_MonotonicTimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_monotonic_time_alarm_type) },
+ { MP_ROM_QSTR(MP_QSTR_TimeAlarm), MP_OBJ_FROM_PTR(&alarm_time_time_alarm_type) },
};
STATIC MP_DEFINE_CONST_DICT(alarm_time_globals, alarm_time_globals_table);
@@ -140,7 +137,8 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_wake_alarm), mp_const_none },
{ MP_ROM_QSTR(MP_QSTR_sleep_until_alarms), MP_OBJ_FROM_PTR(&alarm_sleep_until_alarms_obj) },
- { MP_ROM_QSTR(MP_QSTR_set_deep_sleep_alarms), MP_OBJ_FROM_PTR(&alarm_set_deep_sleep_alarms_obj) },
+ { MP_ROM_QSTR(MP_QSTR_exit_and_deep_sleep_until_alarms),
+ MP_OBJ_FROM_PTR(&alarm_exit_and_deep_sleep_until_alarms_obj) },
{ MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) },
{ MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) }
diff --git a/shared-bindings/alarm/time/MonotonicTimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c
index 6ee411e88..864ece284 100644
--- a/shared-bindings/alarm/time/MonotonicTimeAlarm.c
+++ b/shared-bindings/alarm/time/TimeAlarm.c
@@ -26,7 +26,7 @@
#include "shared-bindings/board/__init__.h"
#include "shared-bindings/microcontroller/__init__.h"
-#include "shared-bindings/alarm/time/MonotonicTimeAlarm.h"
+#include "shared-bindings/alarm/time/TimeAlarm.h"
#include "py/nlr.h"
#include "py/obj.h"
@@ -34,7 +34,7 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
-//| class MonotonicTimeAlarm:
+//| class TimeAlarm:
//| """Trigger an alarm when `time.monotonic()` reaches the given value."""
//|
//| def __init__(self, monotonic_time: float) -> None:
@@ -49,16 +49,16 @@
//| """
//| ...
//|
-STATIC mp_obj_t alarm_time_monotonic_time_alarm_make_new(const mp_obj_type_t *type,
+STATIC mp_obj_t alarm_time_time_alarm_make_new(const mp_obj_type_t *type,
mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 1, 1, false);
- alarm_time_monotonic_time_alarm_obj_t *self = m_new_obj(alarm_time_monotonic_time_alarm_obj_t);
- self->base.type = &alarm_time_monotonic_time_alarm_type;
+ alarm_time_time_alarm_obj_t *self = m_new_obj(alarm_time_time_alarm_obj_t);
+ self->base.type = &alarm_time_time_alarm_type;
mp_float_t secs = mp_obj_get_float(args[0]);
- common_hal_alarm_time_monotonic_time_alarm_construct(self, secs);
+ common_hal_alarm_time_time_alarm_construct(self, secs);
return MP_OBJ_FROM_PTR(self);
}
@@ -66,28 +66,28 @@ STATIC mp_obj_t alarm_time_monotonic_time_alarm_make_new(const mp_obj_type_t *ty
//| monotonic_time: float
//| """The time at which to trigger, based on the `time.monotonic()` clock."""
//|
-STATIC mp_obj_t alarm_time_monotonic_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) {
- alarm_time_monotonic_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in);
- return mp_obj_new_float(common_hal_alarm_time_monotonic_time_alarm_get_monotonic_time(self));
+STATIC mp_obj_t alarm_time_time_alarm_obj_get_monotonic_time(mp_obj_t self_in) {
+ alarm_time_time_alarm_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ return mp_obj_new_float(common_hal_alarm_time_time_alarm_get_monotonic_time(self));
}
-MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_monotonic_time_alarm_get_monotonic_time_obj, alarm_time_monotonic_time_alarm_obj_get_monotonic_time);
+MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_time_alarm_get_monotonic_time_obj, alarm_time_time_alarm_obj_get_monotonic_time);
-const mp_obj_property_t alarm_time_monotonic_time_alarm_monotonic_time_obj = {
+const mp_obj_property_t alarm_time_time_alarm_monotonic_time_obj = {
.base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&alarm_time_monotonic_time_alarm_get_monotonic_time_obj,
+ .proxy = {(mp_obj_t)&alarm_time_time_alarm_get_monotonic_time_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
-STATIC const mp_rom_map_elem_t alarm_time_monotonic_time_alarm_locals_dict_table[] = {
- { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_monotonic_time_alarm_monotonic_time_obj) },
+STATIC const mp_rom_map_elem_t alarm_time_time_alarm_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_monotonic_time), MP_ROM_PTR(&alarm_time_time_alarm_monotonic_time_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(alarm_time_monotonic_time_alarm_locals_dict, alarm_time_monotonic_time_alarm_locals_dict_table);
+STATIC MP_DEFINE_CONST_DICT(alarm_time_time_alarm_locals_dict, alarm_time_time_alarm_locals_dict_table);
-const mp_obj_type_t alarm_time_monotonic_time_alarm_type = {
+const mp_obj_type_t alarm_time_time_alarm_type = {
{ &mp_type_type },
.name = MP_QSTR_TimeAlarm,
- .make_new = alarm_time_monotonic_time_alarm_make_new,
- .locals_dict = (mp_obj_t)&alarm_time_monotonic_time_alarm_locals_dict,
+ .make_new = alarm_time_time_alarm_make_new,
+ .locals_dict = (mp_obj_t)&alarm_time_time_alarm_locals_dict,
};
diff --git a/shared-bindings/alarm/time/MonotonicTimeAlarm.h b/shared-bindings/alarm/time/TimeAlarm.h
index 6eb2738ab..ceb3291c9 100644
--- a/shared-bindings/alarm/time/MonotonicTimeAlarm.h
+++ b/shared-bindings/alarm/time/TimeAlarm.h
@@ -29,11 +29,11 @@
#include "py/obj.h"
-#include "common-hal/alarm/time/MonotonicTimeAlarm.h"
+#include "common-hal/alarm/time/TimeAlarm.h"
-extern const mp_obj_type_t alarm_time_monotonic_time_alarm_type;
+extern const mp_obj_type_t alarm_time_time_alarm_type;
-extern void common_hal_alarm_time_monotonic_time_alarm_construct(alarm_time_monotonic_time_alarm_obj_t *self, mp_float_t monotonic_time);
-extern mp_float_t common_hal_alarm_time_monotonic_time_alarm_get_monotonic_time(alarm_time_monotonic_time_alarm_obj_t *self);
+extern void common_hal_alarm_time_time_alarm_construct(alarm_time_time_alarm_obj_t *self, mp_float_t monotonic_time);
+extern mp_float_t common_hal_alarm_time_time_alarm_get_monotonic_time(alarm_time_time_alarm_obj_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_TIME_MONOTONIC_TIME_ALARM_H
diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c
index ebff64008..4f5c47aca 100644
--- a/shared-bindings/displayio/EPaperDisplay.c
+++ b/shared-bindings/displayio/EPaperDisplay.c
@@ -294,6 +294,29 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
+//| rotation: int
+//| """The rotation of the display as an int in degrees."""
+//|
+STATIC mp_obj_t displayio_epaperdisplay_obj_get_rotation(mp_obj_t self_in) {
+ displayio_epaperdisplay_obj_t *self = native_display(self_in);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_rotation(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_rotation_obj, displayio_epaperdisplay_obj_get_rotation);
+STATIC mp_obj_t displayio_epaperdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
+ displayio_epaperdisplay_obj_t *self = native_display(self_in);
+ common_hal_displayio_epaperdisplay_set_rotation(self, mp_obj_get_int(value));
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_rotation_obj, displayio_epaperdisplay_obj_set_rotation);
+
+
+const mp_obj_property_t displayio_epaperdisplay_rotation_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_rotation_obj,
+ (mp_obj_t)&displayio_epaperdisplay_set_rotation_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
@@ -317,6 +340,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_epaperdisplay_rotation_obj) },
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) },
{ MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) },
{ MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) },
diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h
index f785203a4..14d4f6aa9 100644
--- a/shared-bindings/displayio/EPaperDisplay.h
+++ b/shared-bindings/displayio/EPaperDisplay.h
@@ -56,6 +56,8 @@ bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t*
uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self);
uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self);
+uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t* self);
+void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t* self, int rotation);
mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self);
diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c
index b5ac861b4..b5c268eb5 100644
--- a/shared-bindings/i2cperipheral/I2CPeripheral.c
+++ b/shared-bindings/i2cperipheral/I2CPeripheral.c
@@ -166,7 +166,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request(size_t n_args, const mp_obj
if (timeout_ms == 0) {
forever = true;
} else if (timeout_ms > 0) {
- timeout_end = common_hal_time_monotonic() + timeout_ms;
+ timeout_end = common_hal_time_monotonic_ms() + timeout_ms;
}
int last_error = 0;
@@ -200,7 +200,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request(size_t n_args, const mp_obj
}
return mp_obj_new_i2cperipheral_i2c_peripheral_request(self, address, is_read, is_restart);
- } while (forever || common_hal_time_monotonic() < timeout_end);
+ } while (forever || common_hal_time_monotonic_ms() < timeout_end);
if (timeout_ms > 0) {
mp_raise_OSError(MP_ETIMEDOUT);
@@ -322,8 +322,8 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_read(size_t n_args, const m
int i = 0;
uint8_t *buffer = NULL;
- uint64_t timeout_end = common_hal_time_monotonic() + 10 * 1000;
- while (common_hal_time_monotonic() < timeout_end) {
+ uint64_t timeout_end = common_hal_time_monotonic_ms() + 10 * 1000;
+ while (common_hal_time_monotonic_ms() < timeout_end) {
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
break;
diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c
index 0977e08ff..07fa5cebb 100644
--- a/shared-bindings/ps2io/Ps2.c
+++ b/shared-bindings/ps2io/Ps2.c
@@ -116,8 +116,9 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) {
//| ...
//|
STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) {
- (void)n_args;
- common_hal_ps2io_ps2_deinit(args[0]);
+ mp_check_self(MP_OBJ_IS_TYPE(args[0], &ps2io_ps2_type));
+ ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(args[0]);
+ common_hal_ps2io_ps2_deinit(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_ps2_obj___exit__);
diff --git a/shared-bindings/random/__init__.h b/shared-bindings/random/__init__.h
index b5011b1a8..9e058051f 100644
--- a/shared-bindings/random/__init__.h
+++ b/shared-bindings/random/__init__.h
@@ -29,7 +29,7 @@
// This depends on shared_module because nearly all functionality is port
// agnostic. The random module only depends on the common_hal_os_urandom or
-// common_hal_time_monotonic to seed it initially.
+// common_hal_time_monotonic_ms to seed it initially.
void shared_modules_random_seed(mp_uint_t seed);
mp_uint_t shared_modules_random_getrandbits(uint8_t n);
diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c
index 9a7890a87..aaecdcbeb 100644
--- a/shared-bindings/supervisor/__init__.c
+++ b/shared-bindings/supervisor/__init__.c
@@ -47,48 +47,6 @@
//| This object is the sole instance of `supervisor.Runtime`."""
//|
-//| def allow_deep_sleep(*, when_connected: bool = False, on_error: bool = False) -> None:
-//| """Configure when CircuitPython can go into deep sleep. Deep sleep can occur
-//| after a program has finished running or when `supervisor.exit_and_deep_sleep()` is called.
-//|
-//| :param bool when_connected: If ``True``, CircuitPython will go into deep sleep
-//| when a program finishes, even if it is connected to a host computer over USB or other means.
-//| It will disconnect from the host before sleeping.
-//| If ``False``, deep sleep will not be entered if connected.
-//| :param bool on_error: If ``True``, deep sleep will be entered if even a program
-//| terminated due to an exception or fatal error. If ``False``, an error will cause
-//| CircuitPython to stay awake, flashing error codes on the status RGB LED, if available.
-//| """
-//| ...
-//|
-STATIC mp_obj_t supervisor_allow_deep_sleep(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_when_connected, ARG_on_error };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_when_connected, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
- { MP_QSTR_on_error, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
- };
-
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
-
- supervisor_workflow_set_allow_deep_sleep_when_connected(args[ARG_when_connected].u_bool);
- supervisor_workflow_set_allow_deep_sleep_on_error(args[ARG_on_error].u_bool);
-
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_allow_deep_sleep_obj, 0, supervisor_allow_deep_sleep);
-
-//| def exit_and_deep_sleep() -> None:
-//| """Go into deep sleep mode immediately, if not connected to a host computer.
-//| But if connected and ``supervisor.allow_deep_sleep(when_connected=true)``
-//| has not been called, simply restart."""
-//| ...
-
-STATIC mp_obj_t supervisor_exit_and_deep_sleep(void) {
- common_hal_mcu_deep_sleep();
-}
-MP_DEFINE_CONST_FUN_OBJ_0(supervisor_exit_and_deep_sleep_obj, supervisor_exit_and_deep_sleep);
-
//| def enable_autoreload() -> None:
//| """Enable autoreload based on USB file write activity."""
//| ...
@@ -156,8 +114,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_next_stack_limit_obj, supervisor_set_ne
STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) },
- { MP_ROM_QSTR(MP_QSTR_allow_deep_sleep), MP_ROM_PTR(&supervisor_allow_deep_sleep_obj) },
- { MP_ROM_QSTR(MP_QSTR_exit_and_deep_sleep), MP_ROM_PTR(&supervisor_exit_and_deep_sleep_obj) },
{ MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) },
diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c
index 804d5ecd8..2624384af 100644
--- a/shared-bindings/time/__init__.c
+++ b/shared-bindings/time/__init__.c
@@ -51,9 +51,8 @@
//| ...
//|
STATIC mp_obj_t time_monotonic(void) {
- // Returns ms ticks.
- uint64_t time64 = common_hal_time_monotonic();
- return mp_obj_new_float(uint64_to_float(time64) / 1000.0f);
+ uint64_t ticks_ms = common_hal_time_monotonic_ms();
+ return mp_obj_new_float(uint64_to_float(ticks_ms) / 1000.0f);
}
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic);
diff --git a/shared-bindings/time/__init__.h b/shared-bindings/time/__init__.h
index ec96aea24..4e716e9df 100644
--- a/shared-bindings/time/__init__.h
+++ b/shared-bindings/time/__init__.h
@@ -35,7 +35,7 @@
extern mp_obj_t struct_time_from_tm(timeutils_struct_time_t *tm);
extern void struct_time_to_tm(mp_obj_t t, timeutils_struct_time_t *tm);
-extern uint64_t common_hal_time_monotonic(void);
+extern uint64_t common_hal_time_monotonic_ms(void);
extern uint64_t common_hal_time_monotonic_ns(void);
extern void common_hal_time_delay_ms(uint32_t);