diff --git a/README.md b/README.md index 05d62dc..d596256 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ The uniqueness of the serial number is guaranteed only when using all 128 bits. STM32 32-bit Arm Cortex MCUs has a unique 96-bit serial number which is a concatenation of three 32-bit words, the address is different depending on the microcontroller. -The [Arduino Core STM32](https://github.com/stm32duino/Arduino_Core_STM32) has the variable UID_BASE whos contain the first 32-bit word of the serial number. +The [Arduino Core STM32](https://github.com/stm32duino/Arduino_Core_STM32) has the functions HAL_GetUIDw0(), HAL_GetUIDw1() and HAL_GetUIDw2() for 96-bit UID. ## Tested Microcontroller @@ -109,7 +109,7 @@ To make the variable UniqueID8 to work propably the library uses the default byt # Installation * Install the library by [Using the Library Manager](https://www.arduino.cc/en/Guide/Libraries#toc3) -* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.7.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files. +* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.9.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files. ## Examples diff --git a/library.properties b/library.properties index 42baa94..428f1d3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ArduinoUniqueID -version=1.0.8 +version=1.0.9 author=Luiz Henrique Cassettari maintainer=Luiz Henrique Cassettari sentence=Arduino Library to gets the Manufacture Serial Number from the Atmel AVR, SAM, SAMD, STM32, and ESP Microcontroller. diff --git a/src/ArduinoUniqueID.cpp b/src/ArduinoUniqueID.cpp index 376bea0..f5c47de 100644 --- a/src/ArduinoUniqueID.cpp +++ b/src/ArduinoUniqueID.cpp @@ -90,15 +90,15 @@ ArduinoUniqueID::ArduinoUniqueID() #elif defined(ARDUINO_ARCH_STM32) uint32_t pdwUniqueID[3]; - pdwUniqueID[2] = *(uint32_t *)(UID_BASE + 0); - pdwUniqueID[1] = *(uint32_t *)(UID_BASE + 4); - pdwUniqueID[0] = *(uint32_t *)(UID_BASE + 8); + pdwUniqueID[0] = HAL_GetUIDw0(); + pdwUniqueID[1] = HAL_GetUIDw1(); + pdwUniqueID[2] = HAL_GetUIDw2(); for (int i = 0; i < 3; i++) { - id[i*4+3] = (uint8_t)(pdwUniqueID[i] >> 24); - id[i*4+2] = (uint8_t)(pdwUniqueID[i] >> 16); - id[i*4+1] = (uint8_t)(pdwUniqueID[i] >> 8); - id[i*4+0] = (uint8_t)(pdwUniqueID[i] >> 0); + id[i*4+0] = (uint8_t)(pdwUniqueID[i] >> 24); + id[i*4+1] = (uint8_t)(pdwUniqueID[i] >> 16); + id[i*4+2] = (uint8_t)(pdwUniqueID[i] >> 8); + id[i*4+3] = (uint8_t)(pdwUniqueID[i] >> 0); } #endif }