Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RF24
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
RF24
Commits
b2500826
Commit
b2500826
authored
Mar 23, 2016
by
TMRh20
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change CONFIG to NRF_CONFIG per #212
parent
d705abd4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
RF24.cpp
RF24.cpp
+16
-16
nRF24L01.h
nRF24L01.h
+1
-1
No files found.
RF24.cpp
View file @
b2500826
...
...
@@ -553,7 +553,7 @@ void RF24::printDetails(void)
print_byte_register
(
PSTR
(
"EN_RXADDR"
),
EN_RXADDR
);
print_byte_register
(
PSTR
(
"RF_CH
\t
"
),
RF_CH
);
print_byte_register
(
PSTR
(
"RF_SETUP"
),
RF_SETUP
);
print_byte_register
(
PSTR
(
"
CONFIG
\t
"
),
CONFIG
);
print_byte_register
(
PSTR
(
"
NRF_CONFIG
\t
"
),
NRF_
CONFIG
);
print_byte_register
(
PSTR
(
"DYNPD/FEATURE"
),
DYNPD
,
2
);
printf_P
(
PSTR
(
"Data Rate
\t
= "
PRIPSTR
"
\r\n
"
),
pgm_read_word
(
&
rf24_datarate_e_str_P
[
getDataRate
()]));
...
...
@@ -626,8 +626,8 @@ bool RF24::begin(void)
// WARNING: Delay is based on P-variant whereby non-P *may* require different timing.
delay
(
5
)
;
// Reset CONFIG and enable 16-bit CRC.
write_register
(
CONFIG
,
0b00001100
)
;
// Reset
NRF_
CONFIG and enable 16-bit CRC.
write_register
(
NRF_
CONFIG
,
0b00001100
)
;
// Set 1500uS (minimum for 32B payload in ESB@250KBPS) timeouts, to make testing a little easier
// WARNING: If this is ever lowered, either 250KBS mode with AA is broken or maximum packet
...
...
@@ -678,7 +678,7 @@ bool RF24::begin(void)
// Enable PTX, do not write CE high so radio will remain in standby I mode ( 130us max to transition to RX or TX instead of 1500us from powerUp )
// PTX should use only 22uA of power
write_register
(
CONFIG
,
(
read_register
(
CONFIG
)
)
&
~
_BV
(
PRIM_RX
)
);
write_register
(
NRF_CONFIG
,
(
read_register
(
NRF_
CONFIG
)
)
&
~
_BV
(
PRIM_RX
)
);
// if setup is 0 or ff then there was no response from module
return
(
setup
!=
0
&&
setup
!=
0xff
);
...
...
@@ -691,7 +691,7 @@ void RF24::startListening(void)
#if !defined (RF24_TINY) && ! defined(LITTLEWIRE)
powerUp
();
#endif
write_register
(
CONFIG
,
read_register
(
CONFIG
)
|
_BV
(
PRIM_RX
));
write_register
(
NRF_CONFIG
,
read_register
(
NRF_
CONFIG
)
|
_BV
(
PRIM_RX
));
write_register
(
NRF_STATUS
,
_BV
(
RX_DR
)
|
_BV
(
TX_DS
)
|
_BV
(
MAX_RT
)
);
ce
(
HIGH
);
// Restore the pipe0 adddress, if exists
...
...
@@ -728,7 +728,7 @@ void RF24::stopListening(void)
flush_tx
();
}
//flush_rx();
write_register
(
CONFIG
,
(
read_register
(
CONFIG
)
)
&
~
_BV
(
PRIM_RX
)
);
write_register
(
NRF_CONFIG
,
(
read_register
(
NRF_
CONFIG
)
)
&
~
_BV
(
PRIM_RX
)
);
#if defined (RF24_TINY) || defined (LITTLEWIRE)
// for 3 pins solution TX mode is only left with additonal powerDown/powerUp cycle
...
...
@@ -748,7 +748,7 @@ void RF24::stopListening(void)
void
RF24
::
powerDown
(
void
)
{
ce
(
LOW
);
// Guarantee CE is low on powerDown
write_register
(
CONFIG
,
read_register
(
CONFIG
)
&
~
_BV
(
PWR_UP
));
write_register
(
NRF_CONFIG
,
read_register
(
NRF_
CONFIG
)
&
~
_BV
(
PWR_UP
));
}
/****************************************************************************/
...
...
@@ -756,11 +756,11 @@ void RF24::powerDown(void)
//Power up now. Radio will not power down unless instructed by MCU for config changes etc.
void
RF24
::
powerUp
(
void
)
{
uint8_t
cfg
=
read_register
(
CONFIG
);
uint8_t
cfg
=
read_register
(
NRF_
CONFIG
);
// if not powered up then power up and wait for the radio to initialize
if
(
!
(
cfg
&
_BV
(
PWR_UP
))){
write_register
(
CONFIG
,
read_register
(
CONFIG
)
|
_BV
(
PWR_UP
));
write_register
(
NRF_CONFIG
,
read_register
(
NRF_
CONFIG
)
|
_BV
(
PWR_UP
));
// For nRF24L01+ to go from power down mode to TX or RX mode it must first pass through stand-by mode.
// There must be a delay of Tpd2stby (see Table 16.) after the nRF24L01+ leaves power down mode before
...
...
@@ -1016,12 +1016,12 @@ bool RF24::txStandBy(uint32_t timeout, bool startTx){
void
RF24
::
maskIRQ
(
bool
tx
,
bool
fail
,
bool
rx
){
uint8_t
config
=
read_register
(
CONFIG
);
uint8_t
config
=
read_register
(
NRF_
CONFIG
);
/* clear the interrupt flags */
config
&=
~
(
1
<<
MASK_MAX_RT
|
1
<<
MASK_TX_DS
|
1
<<
MASK_RX_DR
);
/* set the specified interrupt flags */
config
|=
fail
<<
MASK_MAX_RT
|
tx
<<
MASK_TX_DS
|
rx
<<
MASK_RX_DR
;
write_register
(
CONFIG
,
config
);
write_register
(
NRF_
CONFIG
,
config
);
}
/****************************************************************************/
...
...
@@ -1473,7 +1473,7 @@ rf24_datarate_e RF24::getDataRate( void )
void
RF24
::
setCRCLength
(
rf24_crclength_e
length
)
{
uint8_t
config
=
read_register
(
CONFIG
)
&
~
(
_BV
(
CRCO
)
|
_BV
(
EN_CRC
))
;
uint8_t
config
=
read_register
(
NRF_
CONFIG
)
&
~
(
_BV
(
CRCO
)
|
_BV
(
EN_CRC
))
;
// switch uses RAM (evil!)
if
(
length
==
RF24_CRC_DISABLED
)
...
...
@@ -1489,7 +1489,7 @@ void RF24::setCRCLength(rf24_crclength_e length)
config
|=
_BV
(
EN_CRC
);
config
|=
_BV
(
CRCO
);
}
write_register
(
CONFIG
,
config
)
;
write_register
(
NRF_
CONFIG
,
config
)
;
}
/****************************************************************************/
...
...
@@ -1498,7 +1498,7 @@ rf24_crclength_e RF24::getCRCLength(void)
{
rf24_crclength_e
result
=
RF24_CRC_DISABLED
;
uint8_t
config
=
read_register
(
CONFIG
)
&
(
_BV
(
CRCO
)
|
_BV
(
EN_CRC
))
;
uint8_t
config
=
read_register
(
NRF_
CONFIG
)
&
(
_BV
(
CRCO
)
|
_BV
(
EN_CRC
))
;
uint8_t
AA
=
read_register
(
EN_AA
);
if
(
config
&
_BV
(
EN_CRC
)
||
AA
)
...
...
@@ -1516,8 +1516,8 @@ rf24_crclength_e RF24::getCRCLength(void)
void
RF24
::
disableCRC
(
void
)
{
uint8_t
disable
=
read_register
(
CONFIG
)
&
~
_BV
(
EN_CRC
)
;
write_register
(
CONFIG
,
disable
)
;
uint8_t
disable
=
read_register
(
NRF_
CONFIG
)
&
~
_BV
(
EN_CRC
)
;
write_register
(
NRF_
CONFIG
,
disable
)
;
}
/****************************************************************************/
...
...
nRF24L01.h
View file @
b2500826
...
...
@@ -24,7 +24,7 @@
*/
/* Memory Map */
#define CONFIG 0x00
#define
NRF_
CONFIG 0x00
#define EN_AA 0x01
#define EN_RXADDR 0x02
#define SETUP_AW 0x03
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment