Browse Source

cc3200: Rename pyb.reset() to pyb.hard_reset() and add pyb.unique_id().

pull/1289/head
Daniel Campora 10 years ago
parent
commit
622f241317
  1. 12
      cc3200/mods/modpyb.c
  2. 3
      cc3200/qstrdefsport.h

12
cc3200/mods/modpyb.c

@ -130,6 +130,15 @@ STATIC mp_obj_t pyb_freq(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_freq_obj, pyb_freq);
/// \function unique_id()
/// Returns a string of 6 bytes (48 bits), which is the unique ID for the MCU.
STATIC mp_obj_t pyb_unique_id(void) {
uint8_t mac[SL_BSSID_LENGTH];
wlan_get_mac (mac);
return mp_obj_new_bytes(mac, SL_BSSID_LENGTH);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_unique_id_obj, pyb_unique_id);
/// \function millis()
/// Returns the number of milliseconds since the board was last reset.
///
@ -241,11 +250,12 @@ MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
STATIC const mp_map_elem_t pyb_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pyb) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&pyb_hard_reset_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_hard_reset), (mp_obj_t)&pyb_hard_reset_obj },
#ifdef DEBUG
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&pyb_info_obj },
#endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&pyb_freq_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_unique_id), (mp_obj_t)&pyb_unique_id_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_repl_info), (mp_obj_t)&pyb_set_repl_info_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_repl_uart), (mp_obj_t)&pyb_repl_uart_obj },

3
cc3200/qstrdefsport.h

@ -30,7 +30,7 @@ Q(__name__)
Q(help)
Q(pyb)
Q(info)
Q(reset)
Q(hard_reset)
Q(main)
Q(sync)
Q(gc)
@ -48,6 +48,7 @@ Q(readline)
Q(input)
Q(os)
Q(freq)
Q(unique_id)
Q(repl_info)
Q(disable_irq)
Q(enable_irq)

Loading…
Cancel
Save