Maniacbug's nRF24L01 arduino library ported to mbed. Functional with minor issues.
Fork of nRF24L01P_Maniacbug by
Revision 7:8858f26d373f, committed 2014-10-03
- Comitter:
- kenno
- Date:
- Fri Oct 03 04:39:21 2014 +0000
- Parent:
- 6:56b693b59e16
- Child:
- 8:ea2d2e86df4f
- Commit message:
- Renamed 'STATUS' to 'RF_STATUS' to avoid conflict with a TPM struct field in FRDM-KL05Z.
Changed in this revision
| nRF24L01P_Maniacbug.cpp | Show annotated file Show diff for this revision Revisions of this file |
| nRF24L01P_Maniacbug.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/nRF24L01P_Maniacbug.cpp Tue Jun 11 08:33:14 2013 +0000
+++ b/nRF24L01P_Maniacbug.cpp Fri Oct 03 04:39:21 2014 +0000
@@ -313,17 +313,17 @@
{
print_status(get_status());
- print_address_register(("RX_ADDR_P0-1"),RX_ADDR_P0,2);
- print_byte_register(("RX_ADDR_P2-5"),RX_ADDR_P2,4);
- print_address_register(("TX_ADDR"),TX_ADDR);
+ print_address_register(("RX_ADDR_P0-1\t"),RX_ADDR_P0,2);
+ print_byte_register(("RX_ADDR_P2-5\t"),RX_ADDR_P2,4);
+ print_address_register(("TX_ADDR\t\t"),TX_ADDR);
- print_byte_register(("RX_PW_P0-6"),RX_PW_P0,6);
- print_byte_register(("EN_AA"),EN_AA);
- print_byte_register(("EN_RXADDR"),EN_RXADDR);
- print_byte_register(("RF_CH"),RF_CH);
- print_byte_register(("RF_SETUP"),RF_SETUP);
- print_byte_register(("CONFIG"),CONFIG);
- print_byte_register(("DYNPD/FEATURE"),DYNPD,2);
+ print_byte_register(("RX_PW_P0-6\t"),RX_PW_P0,6);
+ print_byte_register(("EN_AA\t\t"),EN_AA);
+ print_byte_register(("EN_RXADDR\t"),EN_RXADDR);
+ print_byte_register(("RF_CH\t\t"),RF_CH);
+ print_byte_register(("RF_SETUP\t"),RF_SETUP);
+ print_byte_register(("CONFIG\t\t"),CONFIG);
+ print_byte_register(("DYNPD/FEATURE\t"),DYNPD,2);
printf(("Data Rate\t = %s\r\n"), rf24_datarate_e_str_P[getDataRate()]);
printf(("Model\t\t = %s\r\n"), rf24_model_e_str_P[isPVariant()]);
@@ -383,7 +383,7 @@
// Reset current status
// Notice reset and flush is the last thing we do
- write_register(STATUS,_BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
+ write_register(RF_STATUS,_BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
// Set up default configuration. Callers can always change it later.
// This channel should be universally safe and not bleed over into adjacent
@@ -403,7 +403,7 @@
void RF24::startListening(void)
{
write_register(CONFIG, read_register(CONFIG) | _BV(PWR_UP) | _BV(PRIM_RX));
- write_register(STATUS, _BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
+ write_register(RF_STATUS, _BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
// Restore the pipe0 adddress, if exists
if (pipe0_reading_address)
@@ -572,12 +572,12 @@
// ??? Should this REALLY be cleared now? Or wait until we
// actually READ the payload?
- write_register(STATUS,_BV(RX_DR) );
+ write_register(RF_STATUS,_BV(RX_DR) );
// Handle ack payload receipt
if ( status & _BV(TX_DS) )
{
- write_register(STATUS,_BV(TX_DS));
+ write_register(RF_STATUS,_BV(TX_DS));
}
}
@@ -601,7 +601,7 @@
{
// Read the status & reset the status in one easy call
// Or is that such a good idea?
- uint8_t status = write_register(STATUS,_BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
+ uint8_t status = write_register(RF_STATUS,_BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
// Report to the user what happened
tx_ok = status & _BV(TX_DS);
--- a/nRF24L01P_Maniacbug.h Tue Jun 11 08:33:14 2013 +0000 +++ b/nRF24L01P_Maniacbug.h Fri Oct 03 04:39:21 2014 +0000 @@ -30,7 +30,7 @@ #define SETUP_RETR 0x04 #define RF_CH 0x05 #define RF_SETUP 0x06 -#define STATUS 0x07 +#define RF_STATUS 0x07 #define OBSERVE_TX 0x08 #define CD 0x09 #define RX_ADDR_P0 0x0A
S. Ken San
