extmod/modmachine: Provide common bindings for 6 bare-metal functions.

Minor changes for consistency are:
- nrf gains: unique_id(), freq() [they do nothing]
- samd: deepsleep() now resets after calling lightsleep()
- esp32: lightsleep()/deepsleep() no longer take kw arg "sleep", instead
  it's positional to match others.  also, passing 0 here will now do a 0ms
  sleep instead of acting like nothing was passed.
  reset_cause() no longer takes any args (before it would just ignore them)
- mimxrt: freq() with an argument and lightsleep() both raise
  NotImplementedError

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-11-24 18:25:30 +11:00
parent 48b5a7b060
commit e1ec6af654
29 changed files with 320 additions and 385 deletions

View File

@@ -50,13 +50,13 @@ STATIC mp_obj_t machine_reset(void) {
// Won't get here, Zephyr has infiniloop on its side
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
STATIC mp_obj_t machine_reset_cause(void) {
printf("Warning: %s is not implemented\n", __func__);
return MP_OBJ_NEW_SMALL_INT(42);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
STATIC void mp_machine_idle(void) {
k_yield();

View File

@@ -3,8 +3,6 @@
#include "py/obj.h"
MP_DECLARE_CONST_FUN_OBJ_0(machine_info_obj);
typedef struct _machine_pin_obj_t {
mp_obj_base_t base;
const struct device *port;