ricaun / ArduinoUniqueID

Arduino Library to gets the Manufacture Serial Number from the Atmel AVR, SAM, SAMD, STM32, and ESP Microcontroller.
MIT License
224 stars 50 forks source link

Incorrect endianness during copy since the chip is little endian #17

Open echoGee opened 2 years ago

echoGee commented 2 years ago

https://github.com/ricaun/ArduinoUniqueID/blob/cba84522cfd33302630e781997fb776174cc888c/src/ArduinoUniqueID.cpp#L94-L97

This should be copied in reverse since the architecture is little endian

id[i 4 + 0] = (uint8_t)(pdwUniqueID[i] >> 0); id[i 4 + 1] = (uint8_t)(pdwUniqueID[i] >> 8); id[i 4 + 2] = (uint8_t)(pdwUniqueID[i] >> 16); id[i 4 + 3] = (uint8_t)(pdwUniqueID[i] >> 24);