Skip to content

Commit

Permalink
Moved network startup into main(), so it only fires up the network ON…
Browse files Browse the repository at this point in the history
…CE. Compiles only, not tested.
  • Loading branch information
maniacbug committed Dec 21, 2011
1 parent e592e2e commit 37e55d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 0 additions & 4 deletions tests/unit/PingTest.test
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ public:
}
void setUp()
{
SPI.begin();
radio.begin();
network.begin(/* channel */100,/* this node */0);

// Reset remote to initial state
RF24NetworkHeader header(/*to node*/ 1, /*type*/ 'R' /*Reset*/);
network.write(header,0,0);
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/SyncTest.test
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public:
}
void setUp()
{
SPI.begin();
radio.begin();
network.begin(/* channel */100,/* this node */0);

pSync = new Sync(network);
pSync->begin(/* other node*/ 1);
p_sync_data = new(sync_data_t);
Expand Down
26 changes: 19 additions & 7 deletions tests/unit/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,32 @@
#include <cxxtest/RealDescriptions.h>
#include <cxxtest/TestMain.h>
#include <cxxtest/ErrorPrinter.h>
#include <cxxtest/Root.cpp>

#include <RF24Network_config.h>
#include <RF24Network.h>
#include <RF24.h>

extern void board_start(const char*);
extern RF24Network network;
extern RF24 radio;

int main( void ) {
CxxTest::ErrorPrinter tmp;
int main( void )
{
CxxTest::ErrorPrinter tmp;

while(1)
{
board_start(__FILE__);

SPI.begin();
radio.begin();
network.begin(/* channel */100,/* this node */0);

CxxTest::Main<CxxTest::ErrorPrinter>( tmp, 0, NULL );

printf("Tests complete. Stopping\r\n");
while(1)
{
}
printf("Tests complete. Restarting...\r\n");
}
}
#include <cxxtest/Root.cpp>
const char* CxxTest::RealWorldDescription::_worldName = "cxxtest";
// vim:cin:ai:sts=2 sw=2 ft=cpp

0 comments on commit 37e55d4

Please sign in to comment.