usb_dfu: fix U_ID decoding

This commit is contained in:
King Kévin 2020-03-15 14:03:52 +01:00
parent 3cec6dfb79
commit a689229acb
1 changed files with 2 additions and 2 deletions

View File

@ -328,11 +328,11 @@ void usb_dfu_setup(void)
for (uint8_t i = 0; i < LENGTH(usb_serial) - 1; i++) { // write the serial
uint32_t id; // current ID part
if (i < 8) {
id = DESIG_UNIQUE_ID0;
id = DESIG_UNIQUE_ID2;
} else if (i < 16) {
id = DESIG_UNIQUE_ID1;
} else {
id = DESIG_UNIQUE_ID2;
id = (DESIG_UNIQUE_ID0 << 16) + (DESIG_UNIQUE_ID0 >> 16);
}
// transform into character
char c = (id >> ((7 - (i % 8)) * 4)) & 0x0f; // get nibble