diff --git a/library.properties b/library.properties index 7863cf8..0a51846 100644 --- a/library.properties +++ b/library.properties @@ -6,5 +6,5 @@ sentence=Arduino Library to gets the Manufacture Serial Number from the Atmel AV paragraph=The ArduinoUniqueID Library use the buildin feature to select the manufacture serial number from the microcontroler. Suported microcontroler: Atmega328pb, Atmega328p, Atmega2560, Attiny85, SAM3X8E, SAMD21, STM32, ESP8266 & ESP32. category=Other url=https://github.com/ricaun/ArduinoUniqueID -architectures=avr, esp8266, esp32, sam, samd, stm32 +architectures=avr, esp8266, esp32, sam, samd, stm32, rp2040, mbed_rp2040, mbed_nano, teensy includes=ArduinoUniqueID.h diff --git a/src/ArduinoUniqueID.cpp b/src/ArduinoUniqueID.cpp index 57df363..1b2044b 100644 --- a/src/ArduinoUniqueID.cpp +++ b/src/ArduinoUniqueID.cpp @@ -175,8 +175,9 @@ ArduinoUniqueID::ArduinoUniqueID() id[14] = mac[4]; id[15] = mac[5]; -#elif defined(ARDUINO_ARCH_MBED_RP2040) - getUniqueSerialNumber(id); + +#elif defined(ARDUINO_ARCH_RP2040) + flash_get_unique_id((uint8_t*) id); #elif defined(ARDUINO_ARCH_MEGAAVR) id[0] = SIGROW.SERNUM0; diff --git a/src/ArduinoUniqueID.h b/src/ArduinoUniqueID.h index 39f9b9e..653afb0 100644 --- a/src/ArduinoUniqueID.h +++ b/src/ArduinoUniqueID.h @@ -17,8 +17,12 @@ #elif defined(ARDUINO_ARCH_SAMD) #elif defined(ARDUINO_ARCH_STM32) #elif defined(TEENSYDUINO) -#elif defined(ARDUINO_ARCH_MBED_RP2040) -//#include + +#elif defined(ARDUINO_ARCH_RP2040) + extern "C" { + #include "hardware/flash.h" + #include "pico/bootrom.h" + } #elif defined(ARDUINO_ARCH_MEGAAVR) #else #error "ArduinoUniqueID only works on AVR, SAM, SAMD, STM32, Teensy, RP2040, megaAVR and ESP Architecture" @@ -55,9 +59,9 @@ #elif defined(TEENSYDUINO) #define UniqueIDsize 16 #define UniqueIDbuffer 16 -#elif defined(ARDUINO_ARCH_MBED_RP2040) -#define UniqueIDsize 32 -#define UniqueIDbuffer 32 +#elif defined(ARDUINO_ARCH_RP2040) + #define UniqueIDsize 8 + #define UniqueIDbuffer 8 #elif defined(ARDUINO_ARCH_MEGAAVR) #define UniqueIDsize 10 #define UniqueIDbuffer 10