From df6d2684e6f87f0af6b2a7322190c8b0116c3a46 Mon Sep 17 00:00:00 2001 From: akatran Date: Tue, 26 Jan 2016 23:15:29 +0200 Subject: [PATCH] Support for ATXMega256D3 The RF24Network library can now be included into a Atmel Studio Solution and get compiled as part of the solution. Currently only XMEGA256D3 is supported. --- RF24Network.cpp | 6 +++++- RF24Network.h | 4 ++++ RF24Network_config.h | 5 +++++ Sync.cpp | 18 ++++++++++++------ Sync.h | 6 +++++- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/RF24Network.cpp b/RF24Network.cpp index 0e4ae301..51919ef5 100644 --- a/RF24Network.cpp +++ b/RF24Network.cpp @@ -21,6 +21,10 @@ #include #include #include "RF24Network.h" +#elif defined(__AVR_ATxmega256D3__) + #define XMEGA_D3 + #include "../RF24/RF24.h" + #include "RF24Network.h" #else #include "RF24.h" #include "RF24Network.h" @@ -154,7 +158,7 @@ uint8_t RF24Network::update(void) while ( radio.isValid() && radio.available(&pipe_num) ){ - #if defined (ENABLE_DYNAMIC_PAYLOADS) + #if defined (ENABLE_DYNAMIC_PAYLOADS) && !defined (XMEGA_D3) if( (frame_size = radio.getDynamicPayloadSize() ) < sizeof(RF24NetworkHeader)){ delay(10); continue; diff --git a/RF24Network.h b/RF24Network.h index 5a0835d5..48bdab75 100644 --- a/RF24Network.h +++ b/RF24Network.h @@ -31,6 +31,10 @@ #include // std::pair #include +//ATXMega +#elif defined(__AVR_ATxmega256D3__) + #define XMEGA_D3 + #include "../RF24/RF24.h" #endif diff --git a/RF24Network_config.h b/RF24Network_config.h index b6e1f78a..275b64e1 100644 --- a/RF24Network_config.h +++ b/RF24Network_config.h @@ -76,6 +76,11 @@ #if (defined (__linux) || defined (linux)) && !defined (__ARDUINO_X86__) #include + +//ATXMega +#elif defined(__AVR_ATxmega256D3__) + #define XMEGA_D3 + #include "../RF24/RF24_config.h" #else #include #endif diff --git a/Sync.cpp b/Sync.cpp index b31e9564..d61fc911 100644 --- a/Sync.cpp +++ b/Sync.cpp @@ -9,13 +9,19 @@ // STL headers // C headers #include -// Framework headers -// Library headers -#include -// Project headers -// This component's header -#include +#if defined __AVR_ATxmega256D3__ /* Could not find the previous definition so it is redefined here */ + #define XMEGA_D3 + #include "RF24Network.h" + #include "Sync.h" +#else + // Framework headers + // Library headers + #include + // Project headers + // This component's header + #include +#endif /****************************************************************************/ void Sync::update(void) diff --git a/Sync.h b/Sync.h index 701bebb0..7378b8b1 100644 --- a/Sync.h +++ b/Sync.h @@ -15,7 +15,11 @@ #include // Framework headers // Library headers -#include +#if defined(XMEGA_D3) + #include "RF24Network_config.h" +#else + #include +#endif // Project headers class RF24Network;