alif/modmachine: Implement machine.unique_id(), fix machine.reset().
They both use SE services. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
2a580b05ad
commit
2f85a19d7d
1 changed files with 6 additions and 2 deletions
|
|
@ -27,6 +27,8 @@
|
||||||
// This file is never compiled standalone, it's included directly from
|
// This file is never compiled standalone, it's included directly from
|
||||||
// extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE.
|
// extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE.
|
||||||
|
|
||||||
|
#include "se_services.h"
|
||||||
|
|
||||||
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
|
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
|
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_type) }, \
|
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_type) }, \
|
||||||
|
|
@ -36,11 +38,13 @@ static void mp_machine_idle(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t mp_machine_unique_id(void) {
|
static mp_obj_t mp_machine_unique_id(void) {
|
||||||
return mp_obj_new_bytes((const uint8_t *)"ABCD", 4);
|
uint8_t id[5];
|
||||||
|
se_services_get_unique_id(id);
|
||||||
|
return mp_obj_new_bytes(id, sizeof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN static void mp_machine_reset(void) {
|
NORETURN static void mp_machine_reset(void) {
|
||||||
NVIC_SystemReset();
|
se_services_reset_soc();
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
|
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue