Don't lose half of the processor's serial number
Before this change, `microcontroller.cpu.uid` returned values where the top 4 bits of each byte were zero, because of an incorrect bitmask used in this function.
This commit is contained in:
parent
fa88446679
commit
c0029e1d97
|
@ -243,7 +243,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
|
||||||
|
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
for (int k=0; k<4; k++) {
|
for (int k=0; k<4; k++) {
|
||||||
raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xf;
|
raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
|
||||||
|
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
for (int k=0; k<4; k++) {
|
for (int k=0; k<4; k++) {
|
||||||
raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xf;
|
raw_id[4 * i + k] = (*(id_addresses[i]) >> k * 8) & 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue