Ifdef include requested change

This commit is contained in:
OnlineCaveman 2022-10-25 15:56:34 +02:00
parent 02565a0ba3
commit 76762571ea
3 changed files with 13 additions and 20 deletions

View File

@ -1,7 +1,9 @@
#ifdef __SAMD51__
#include <Arduino.h>
#include "samd51_platform.h" #include "samd51_platform.h"
#ifdef __SAMD51__
#include <knx/bits.h> #include <knx/bits.h>
#include <Arduino.h>
#if KNX_FLASH_SIZE % 1024 #if KNX_FLASH_SIZE % 1024
#error "KNX_FLASH_SIZE must be multiple of 1024" #error "KNX_FLASH_SIZE must be multiple of 1024"

View File

@ -1,7 +1,8 @@
#ifdef __SAMD51__
#include "Arduino.h" #include "Arduino.h"
#include "arduino_platform.h" #include "arduino_platform.h"
#ifdef __SAMD51__
class Samd51Platform : public ArduinoPlatform class Samd51Platform : public ArduinoPlatform
{ {
public: public:

View File

@ -1,10 +1,10 @@
#include "samd_platform.h"
#if(defined(__SAMD21E17A__) || \ #if(defined(__SAMD21E17A__) || \
defined(__SAMD21G18A__) || \ defined(__SAMD21G18A__) || \
defined(__SAMD21E18A__) || \ defined(__SAMD21E18A__) || \
defined(__SAMD21J18A__)) defined(__SAMD21J18A__))
#include "samd_platform.h"
#include <knx/bits.h> #include <knx/bits.h>
#include <Arduino.h> #include <Arduino.h>
@ -39,21 +39,11 @@ SamdPlatform::SamdPlatform( HardwareSerial* s) : ArduinoPlatform(s)
uint32_t SamdPlatform::uniqueSerialNumber() uint32_t SamdPlatform::uniqueSerialNumber()
{ {
#if defined (__SAMD51__) #define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x0080A00C)
// SAMD51 from section 9.6 of the datasheet #define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x0080A040)
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x008061FC) #define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x0080A044)
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x00806010) #define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x0080A048)
#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
return SERIAL_NUMBER_WORD_0 ^ SERIAL_NUMBER_WORD_1 ^ SERIAL_NUMBER_WORD_2 ^ SERIAL_NUMBER_WORD_3; return SERIAL_NUMBER_WORD_0 ^ SERIAL_NUMBER_WORD_1 ^ SERIAL_NUMBER_WORD_2 ^ SERIAL_NUMBER_WORD_3;
} }