File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ STATIC mp_obj_t machine_reset(void) {
6363}
6464STATIC MP_DEFINE_CONST_FUN_OBJ_0 (machine_reset_obj , machine_reset );
6565
66+ STATIC mp_obj_t machine_unique_id (void ) {
67+ uint32_t id = system_get_chip_id ();
68+ return mp_obj_new_bytes ((byte * )& id , sizeof (id ));
69+ }
70+ STATIC MP_DEFINE_CONST_FUN_OBJ_0 (machine_unique_id_obj , machine_unique_id );
71+
6672typedef struct _esp_timer_obj_t {
6773 mp_obj_base_t base ;
6874 os_timer_t timer ;
@@ -146,6 +152,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
146152
147153 { MP_ROM_QSTR (MP_QSTR_freq ), MP_ROM_PTR (& machine_freq_obj ) },
148154 { MP_ROM_QSTR (MP_QSTR_reset ), MP_ROM_PTR (& machine_reset_obj ) },
155+ { MP_ROM_QSTR (MP_QSTR_unique_id ), MP_ROM_PTR (& machine_unique_id_obj ) },
149156
150157 { MP_ROM_QSTR (MP_QSTR_Timer ), MP_ROM_PTR (& esp_timer_type ) },
151158 { MP_ROM_QSTR (MP_QSTR_Pin ), MP_ROM_PTR (& pyb_pin_type ) },
Original file line number Diff line number Diff line change @@ -125,12 +125,6 @@ STATIC mp_obj_t pyb_udelay(mp_obj_t usec_in) {
125125}
126126STATIC MP_DEFINE_CONST_FUN_OBJ_1 (pyb_udelay_obj , pyb_udelay );
127127
128- STATIC mp_obj_t pyb_unique_id (void ) {
129- uint32_t id = system_get_chip_id ();
130- return mp_obj_new_bytes ((byte * )& id , sizeof (id ));
131- }
132- STATIC MP_DEFINE_CONST_FUN_OBJ_0 (pyb_unique_id_obj , pyb_unique_id );
133-
134128STATIC const mp_map_elem_t pyb_module_globals_table [] = {
135129 { MP_OBJ_NEW_QSTR (MP_QSTR___name__ ), MP_OBJ_NEW_QSTR (MP_QSTR_pyb ) },
136130
You can’t perform that action at this time.
0 commit comments