Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ed5117f6
Commit
ed5117f6
authored
Apr 19, 2014
by
Damien George
Browse files
stmhal: Add pyb.unique_id, to get unique id of MCU.
parent
44ee42de
Changes
2
Hide whitespace changes
Inline
Side-by-side
stmhal/modpyb.c
View file @
ed5117f6
...
...
@@ -30,6 +30,13 @@
#include
"modpyb.h"
#include
"ff.h"
STATIC
mp_obj_t
pyb_unique_id
(
void
)
{
// get unique id; 96 bits
byte
*
id
=
(
byte
*
)
0x1fff7a10
;
return
mp_obj_new_bytes
(
id
,
12
);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
pyb_unique_id_obj
,
pyb_unique_id
);
// get lots of info about the board
STATIC
mp_obj_t
pyb_info
(
uint
n_args
,
const
mp_obj_t
*
args
)
{
// get and print unique id; 96 bits
...
...
@@ -233,6 +240,7 @@ MP_DECLARE_CONST_FUN_OBJ(pyb_usb_mode_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_unique_id
),
(
mp_obj_t
)
&
pyb_unique_id_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_info
),
(
mp_obj_t
)
&
pyb_info_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_gc
),
(
mp_obj_t
)
&
pyb_gc_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_repl_info
),
(
mp_obj_t
)
&
pyb_set_repl_info_obj
},
...
...
stmhal/qstrdefsport.h
View file @
ed5117f6
...
...
@@ -2,6 +2,7 @@
Q
(
help
)
Q
(
pyb
)
Q
(
unique_id
)
Q
(
info
)
Q
(
sd_test
)
Q
(
present
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment