Compare commits
5 Commits
f6e59b9de8
...
ebcd0d1d0b
Author | SHA1 | Date |
---|---|---|
maniacbug | ebcd0d1d0b | |
maniacbug | 8eaad77b2c | |
Jason Becht | 49f22eae21 | |
maniacbug | 84e464def4 | |
maniacbug | 2c97186329 |
2
RF24.cpp
2
RF24.cpp
|
@ -649,7 +649,7 @@ void RF24::openReadingPipe(uint8_t child, uint64_t address)
|
||||||
// Note it would be more efficient to set all of the bits for all open
|
// Note it would be more efficient to set all of the bits for all open
|
||||||
// pipes at once. However, I thought it would make the calling code
|
// pipes at once. However, I thought it would make the calling code
|
||||||
// more simple to do it this way.
|
// more simple to do it this way.
|
||||||
write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(child_pipe_enable[child]));
|
write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(pgm_read_byte(&child_pipe_enable[child])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
RF24.h
9
RF24.h
|
@ -637,6 +637,15 @@ public:
|
||||||
*/
|
*/
|
||||||
bool testRPD(void) ;
|
bool testRPD(void) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether this is a real radio, or a mock shim for
|
||||||
|
* debugging. Setting either pin to 0xff is the way to
|
||||||
|
* indicate that this is not a real radio.
|
||||||
|
*
|
||||||
|
* @return true if this is a legitimate radio
|
||||||
|
*/
|
||||||
|
bool isValid() { return ce_pin != 0xff && csn_pin != 0xff; }
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void setup(void)
|
||||||
|
|
||||||
// optionally, reduce the payload size. seems to
|
// optionally, reduce the payload size. seems to
|
||||||
// improve reliability
|
// improve reliability
|
||||||
radio.setPayloadSize(8);
|
//radio.setPayloadSize(8);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open pipes to other nodes for communication
|
// Open pipes to other nodes for communication
|
||||||
|
@ -86,15 +86,15 @@ void setup(void)
|
||||||
// Open 'our' pipe for writing
|
// Open 'our' pipe for writing
|
||||||
// Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)
|
// Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)
|
||||||
|
|
||||||
if ( role == role_ping_out )
|
//if ( role == role_ping_out )
|
||||||
{
|
{
|
||||||
radio.openWritingPipe(pipes[0]);
|
//radio.openWritingPipe(pipes[0]);
|
||||||
radio.openReadingPipe(1,pipes[1]);
|
radio.openReadingPipe(1,pipes[1]);
|
||||||
}
|
}
|
||||||
else
|
//else
|
||||||
{
|
{
|
||||||
radio.openWritingPipe(pipes[1]);
|
//radio.openWritingPipe(pipes[1]);
|
||||||
radio.openReadingPipe(1,pipes[0]);
|
//radio.openReadingPipe(1,pipes[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -4,7 +4,7 @@ PROJECT_LIBS = SPI RF24 ;
|
||||||
|
|
||||||
# (2) Board Information
|
# (2) Board Information
|
||||||
|
|
||||||
UPLOAD_PROTOCOL ?= stk500v1 ;
|
UPLOAD_PROTOCOL ?= arduino ;
|
||||||
UPLOAD_SPEED ?= 57600 ;
|
UPLOAD_SPEED ?= 57600 ;
|
||||||
MCU ?= atmega328p ;
|
MCU ?= atmega328p ;
|
||||||
F_CPU ?= 16000000 ;
|
F_CPU ?= 16000000 ;
|
||||||
|
@ -35,8 +35,8 @@ if $(OS) = MACOSX
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AVR_BIN = /usr/bin ;
|
AVR_BIN ?= /usr/bin ;
|
||||||
AVR_INCLUDE = /usr/lib/avr/include ;
|
AVR_INCLUDE ?= /usr/lib/avr/include ;
|
||||||
AVR_ETC = /etc ;
|
AVR_ETC = /etc ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ void setup(void)
|
||||||
int i = num_led_pins;
|
int i = num_led_pins;
|
||||||
while(i--)
|
while(i--)
|
||||||
{
|
{
|
||||||
pinMode(button_pins[i],OUTPUT);
|
pinMode(led_pins[i],OUTPUT);
|
||||||
led_states[i] = HIGH;
|
led_states[i] = HIGH;
|
||||||
digitalWrite(led_pins[i],led_states[i]);
|
digitalWrite(led_pins[i],led_states[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ if $(OS) = MACOSX
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AVR_BIN ?= /usr/bin ;
|
AVR_BIN ?= /usr/bin ;
|
||||||
AVR_INCLUDE = /usr/lib/avr/include ;
|
AVR_INCLUDE ?= /usr/lib/avr/include ;
|
||||||
AVR_ETC = /etc ;
|
AVR_ETC = /etc ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,8 @@ const int interval = 100; //*< ms to wait between sends */
|
||||||
|
|
||||||
char configuration = '1'; //*< Configuration key, one char sent in by the test framework to tell us how to configure, this is the default */
|
char configuration = '1'; //*< Configuration key, one char sent in by the test framework to tell us how to configure, this is the default */
|
||||||
|
|
||||||
|
uint8_t pipe_number = 1; // Which pipe to send on.
|
||||||
|
|
||||||
void one_ok(void)
|
void one_ok(void)
|
||||||
{
|
{
|
||||||
// Have we received enough yet?
|
// Have we received enough yet?
|
||||||
|
@ -203,6 +205,20 @@ void setup(void)
|
||||||
radio.enableDynamicPayloads();
|
radio.enableDynamicPayloads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Config 4 tests out a higher pipe ##
|
||||||
|
if (configuration == '4' && role == role_sender)
|
||||||
|
{
|
||||||
|
// Set top 4 bytes of the address in pipe 1
|
||||||
|
radio.openReadingPipe(1,pipe & 0xFFFFFFFF00ULL);
|
||||||
|
|
||||||
|
// indicate the pipe to use
|
||||||
|
pipe_number = 5;
|
||||||
|
}
|
||||||
|
else if ( role == role_sender )
|
||||||
|
{
|
||||||
|
radio.openReadingPipe(5,0);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open pipes to other nodes for communication
|
// Open pipes to other nodes for communication
|
||||||
//
|
//
|
||||||
|
@ -216,7 +232,7 @@ void setup(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
radio.openReadingPipe(1,pipe);
|
radio.openReadingPipe(pipe_number,pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -230,7 +246,7 @@ void setup(void)
|
||||||
// Dump the configuration of the rf unit for debugging
|
// Dump the configuration of the rf unit for debugging
|
||||||
//
|
//
|
||||||
|
|
||||||
//radio.printDetails();
|
radio.printDetails();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attach interrupt handler to interrupt #0 (using pin 2)
|
// Attach interrupt handler to interrupt #0 (using pin 2)
|
||||||
|
@ -410,7 +426,7 @@ void check_radio(void)
|
||||||
|
|
||||||
// Add an ack packet for the next time around.
|
// Add an ack packet for the next time around.
|
||||||
// Here we will report back how many bytes we got this time.
|
// Here we will report back how many bytes we got this time.
|
||||||
radio.writeAckPayload( 1, &len, sizeof(len) );
|
radio.writeAckPayload( pipe_number, &len, sizeof(len) );
|
||||||
++message_count;
|
++message_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,3 +14,8 @@ stty 57600 raw ignbrk hup < /dev/ttyUSB0
|
||||||
sleep 1
|
sleep 1
|
||||||
stty 57600 raw ignbrk hup < /dev/ttyUSB1
|
stty 57600 raw ignbrk hup < /dev/ttyUSB1
|
||||||
expect test.ex 3
|
expect test.ex 3
|
||||||
|
sleep 1
|
||||||
|
stty 57600 raw ignbrk hup < /dev/ttyUSB0
|
||||||
|
sleep 1
|
||||||
|
stty 57600 raw ignbrk hup < /dev/ttyUSB1
|
||||||
|
expect test.ex 4
|
||||||
|
|
Loading…
Reference in New Issue