generate unique serial number (#90) (#131)

* generate unique serial number (#90)

* see https://github.com/ricaun/ArduinoUniqueID

* calculated from ESP.getEfuseMac() on ESP32

* ESP.getChipId() on ESP8266

* SERIAL_NUMBER_WORD_0-3 on SAMD

* HAL_GetUIDw0-2() on STM32

* defaults to 0x01020304 on other platforms

* fix variable name for ESP platform

* another fix variable name for ESP platform (need more coffee...)
This commit is contained in:
OutOfSync1
2021-04-12 11:40:56 +02:00
committed by GitHub
parent 036bd54c79
commit e57bbf9dbe
11 changed files with 80 additions and 3 deletions

View File

@@ -20,6 +20,15 @@ Stm32Platform::~Stm32Platform()
delete [] _eepromPtr;
}
uint32_t Stm32Platform::uniqueSerialNumber()
{
uint32_t uniqueId = HAL_GetUIDw0() ^ HAL_GetUIDw1() ^ HAL_GetUIDw2();
printf("uniqueSerialNumber: %0X", uniqueId);
return uniqueId;
}
void Stm32Platform::restart()
{
NVIC_SystemReset();