Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akatran committed Jan 26, 2016
1 parent 4812504 commit df6d268
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
6 changes: 5 additions & 1 deletion RF24Network.cpp
Expand Up @@ -21,6 +21,10 @@
#include <algorithm>
#include <RF24/RF24.h>
#include "RF24Network.h"
#elif defined(__AVR_ATxmega256D3__)
#define XMEGA_D3
#include "../RF24/RF24.h"
#include "RF24Network.h"
#else
#include "RF24.h"
#include "RF24Network.h"
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions RF24Network.h
Expand Up @@ -31,6 +31,10 @@
#include <utility> // std::pair
#include <queue>

//ATXMega
#elif defined(__AVR_ATxmega256D3__)
#define XMEGA_D3
#include "../RF24/RF24.h"
#endif


Expand Down
5 changes: 5 additions & 0 deletions RF24Network_config.h
Expand Up @@ -76,6 +76,11 @@

#if (defined (__linux) || defined (linux)) && !defined (__ARDUINO_X86__)
#include <RF24/RF24_config.h>

//ATXMega
#elif defined(__AVR_ATxmega256D3__)
#define XMEGA_D3
#include "../RF24/RF24_config.h"
#else
#include <RF24_config.h>
#endif
Expand Down
18 changes: 12 additions & 6 deletions Sync.cpp
Expand Up @@ -9,13 +9,19 @@
// STL headers
// C headers
#include <stdlib.h>
// Framework headers
// Library headers
#include <RF24Network.h>
// Project headers
// This component's header
#include <Sync.h>

#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 <RF24Network.h>
// Project headers
// This component's header
#include <Sync.h>
#endif
/****************************************************************************/

void Sync::update(void)
Expand Down
6 changes: 5 additions & 1 deletion Sync.h
Expand Up @@ -15,7 +15,11 @@
#include <string.h>
// Framework headers
// Library headers
#include <RF24Network_config.h>
#if defined(XMEGA_D3)
#include "RF24Network_config.h"
#else
#include <RF24Network_config.h>
#endif
// Project headers

class RF24Network;
Expand Down

0 comments on commit df6d268

Please sign in to comment.