diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-05 00:57:49 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-05 00:57:49 +0300 |
commit | de12502d89f51c260870b738c0b25a2f133a5e5d (patch) | |
tree | 3cc30de6cdc1674fb02e2472c1e29ea9d49b7378 /esp8266/modmachine.c | |
parent | 81fd5685fcb0bdf80f74db7d81a38c8aef2ef936 (diff) | |
download | micropython-de12502d89f51c260870b738c0b25a2f133a5e5d.tar.gz micropython-de12502d89f51c260870b738c0b25a2f133a5e5d.zip |
esp8266: Move pyb.unique_id() to machine.unique_id().
Diffstat (limited to 'esp8266/modmachine.c')
-rw-r--r-- | esp8266/modmachine.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c index 89cf4fbb90..0dab5104b0 100644 --- a/esp8266/modmachine.c +++ b/esp8266/modmachine.c @@ -63,6 +63,12 @@ STATIC mp_obj_t machine_reset(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset); +STATIC mp_obj_t machine_unique_id(void) { + uint32_t id = system_get_chip_id(); + return mp_obj_new_bytes((byte*)&id, sizeof(id)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id); + typedef struct _esp_timer_obj_t { mp_obj_base_t base; os_timer_t timer; @@ -146,6 +152,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) }, { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) }, + { MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) }, { MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&esp_timer_type) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pyb_pin_type) }, |