diff --git a/src/samd51_platform.cpp b/src/samd51_platform.cpp index ad2b6b2..0a30973 100644 --- a/src/samd51_platform.cpp +++ b/src/samd51_platform.cpp @@ -1,7 +1,9 @@ -#ifdef __SAMD51__ -#include #include "samd51_platform.h" + +#ifdef __SAMD51__ + #include +#include #if KNX_FLASH_SIZE % 1024 #error "KNX_FLASH_SIZE must be multiple of 1024" diff --git a/src/samd51_platform.h b/src/samd51_platform.h index 3063d08..491a63b 100644 --- a/src/samd51_platform.h +++ b/src/samd51_platform.h @@ -1,7 +1,8 @@ -#ifdef __SAMD51__ #include "Arduino.h" #include "arduino_platform.h" +#ifdef __SAMD51__ + class Samd51Platform : public ArduinoPlatform { public: diff --git a/src/samd_platform.cpp b/src/samd_platform.cpp index eb100da..be888fb 100644 --- a/src/samd_platform.cpp +++ b/src/samd_platform.cpp @@ -1,10 +1,10 @@ +#include "samd_platform.h" + #if(defined(__SAMD21E17A__) || \ defined(__SAMD21G18A__) || \ defined(__SAMD21E18A__) || \ defined(__SAMD21J18A__)) -#include "samd_platform.h" - #include #include @@ -39,21 +39,11 @@ SamdPlatform::SamdPlatform( HardwareSerial* s) : ArduinoPlatform(s) uint32_t SamdPlatform::uniqueSerialNumber() { - #if defined (__SAMD51__) - // SAMD51 from section 9.6 of the datasheet - #define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x008061FC) - #define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x00806010) - #define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x00806014) - #define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x00806018) - #else - //#elif defined (__SAMD21E17A__) || defined(__SAMD21G18A__) || defined(__SAMD21E18A__) || defined(__SAMD21J18A__) - // SAMD21 from section 9.3.3 of the datasheet - #define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x0080A00C) - #define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x0080A040) - #define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x0080A044) - #define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x0080A048) - #endif - + #define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x0080A00C) + #define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x0080A040) + #define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x0080A044) + #define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x0080A048) + return SERIAL_NUMBER_WORD_0 ^ SERIAL_NUMBER_WORD_1 ^ SERIAL_NUMBER_WORD_2 ^ SERIAL_NUMBER_WORD_3; }