-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added Unique ID Functions/Updated Support Matrix #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hold of on merging. Just compiled on my new Feather M0 Express, and I'm getting some weird results:
|
Why is that result weird? |
yeah, nevermind. I was actually getting errors on the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting close. Great work!
#endif | ||
|
||
for (int i=0; i<4; i++) { | ||
raw_id[i] = *id_addresses[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need a loop within this one to save the four bytes of each uint32_t into four slots in raw_id
.
uint32_t* id_addresses[2] = {(uint32_t *) 0x060, (uint32_t *) 0x064}; | ||
|
||
for (int i=0; i<2; i++) { | ||
raw_id[i] = *id_addresses[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
@@ -32,7 +32,7 @@ | |||
|
|||
#include "py/objproperty.h" | |||
|
|||
#include "py/objproperty.h" | |||
#include "py/objproperty.h" // <-- is this doubled for a reason? @sommersoft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an oversight, please remove.
//| Returns a bytearray object. Use the CPython ``struct`` | ||
//| library to unpack the bytearray. Unpacked result is | ||
//| a singleton (single item tuple). | ||
//| _Note: ``struct`` is currently not available on the nRF port._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mention struct here. People can do what they want with it afterwards.
@@ -93,9 +93,34 @@ const mp_obj_property_t mcu_processor_temperature_obj = { | |||
}, | |||
}; | |||
|
|||
//| .. attribute:: unique id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..attribute:: uid
It should match the entry in mcu_processor_locals_dict_table
below.
Changes made. SAMD tested on Feather M0 Express; nRF tested on Feather nRF52. |
Please rebase these onto latest master. Ping me on discord if you need help. |
shared_bindings/index.rst: updated Support Matrix format as discussed in PR adafruit#503 & Issue adafruit#448.
shared-bindings/microcontroller/Processor.c & .h: added UID lookup functionality for use with all ports. See Issue adafruit#462.
ports/atmel-samd/common-hal/microcontroller/Processor.c & .h: added UID lookup function for SAMD ports. See Issue adafruit#462.
shared-bindings/index.rst: corrected term agreement/grammar for previous Support Matrix update. See PR adafruit#503 & Issue adafruit#448.
/esp8266/common-hal/microcontroller.h: added UID length definition
/esp8266/common-hal/microcontroller/Processor.c: added UID function
modified: ports/atmel-samd/common-hal/microcontroller/Processor.h modified: shared-bindings/microcontroller/Processor.c modified: shared-bindings/microcontroller/Processor.h
modified: ports/atmel-samd/common-hal/microcontroller/Processor.h modified: shared-bindings/microcontroller/Processor.c modified: shared-bindings/microcontroller/Processor.h
/ports/nrf/common-hal/microcontroller/Processor.h: add UID length definition.
/ports/nrf/common-hal/microcontroller/Processor.c: add UID function. See Issue adafruit#462.
/shared-bindings/microcontroller/Processor.c: added a note to `microcontroller.cpu.uid` (Issue adafruit#462) that ``struct`` is not currently available on the nRF port.
/ports/atmel-samd/common-hal/microcontroller.c: corrected `raw_id[]` assignment per requested changes in PR adafruit#527
/ports/nrf/common-hal/microcontroller.c: corrected `raw_id[]` assignment per requested changes in PR adafruit#527
/shared-bindings/microcontroller/Processor.c: corrected Sphinx documentation per requested changes in PR adafruit#527
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code still looks good! Will wait for Travis and then merge.
/shared-bindings/index.rst: updated Support Matrix format as discussed in PR #503 & Issue #448.
Issue #462 :
/shared-bindings/microcontroller/Processor.x:
struct
for bytearray unpacking./ports/XXXX/common-hal/microcontroller/Processor.x:
machine.unique_id
(which is still available).P.S. I apologize for the merges/etc...trying to minimize the squashes necessary. Not sure I made that mark...