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
aaa09e18
Commit
aaa09e18
authored
Nov 10, 2016
by
TMRh20
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Per #242 change binary to hex
- Change binary to hex - Assign csDelay value in constructor
parent
b9a4fc67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
RF24.cpp
RF24.cpp
+15
-12
RF24.h
RF24.h
+1
-1
No files found.
RF24.cpp
View file @
aaa09e18
...
...
@@ -357,7 +357,7 @@ void RF24::print_status(uint8_t status)
(
status
&
_BV
(
RX_DR
))
?
1
:
0
,
(
status
&
_BV
(
TX_DS
))
?
1
:
0
,
(
status
&
_BV
(
MAX_RT
))
?
1
:
0
,
((
status
>>
RX_P_NO
)
&
0
b111
),
((
status
>>
RX_P_NO
)
&
0
x07
),
(
status
&
_BV
(
TX_FULL
))
?
1
:
0
);
}
...
...
@@ -368,8 +368,8 @@ void RF24::print_observe_tx(uint8_t value)
{
printf_P
(
PSTR
(
"OBSERVE_TX=%02x: POLS_CNT=%x ARC_CNT=%x
\r\n
"
),
value
,
(
value
>>
PLOS_CNT
)
&
0
b1111
,
(
value
>>
ARC_CNT
)
&
0
b1111
(
value
>>
PLOS_CNT
)
&
0
x0F
,
(
value
>>
ARC_CNT
)
&
0
x0F
);
}
...
...
@@ -417,7 +417,7 @@ void RF24::print_address_register(const char* name, uint8_t reg, uint8_t qty)
RF24
::
RF24
(
uint8_t
_cepin
,
uint8_t
_cspin
)
:
ce_pin
(
_cepin
),
csn_pin
(
_cspin
),
p_variant
(
false
),
payload_size
(
32
),
dynamic_payloads_enabled
(
false
),
addr_width
(
5
)
//,pipe0_reading_address(0)
payload_size
(
32
),
dynamic_payloads_enabled
(
false
),
addr_width
(
5
)
,
csDelay
(
5
)
//,pipe0_reading_address(0)
{
pipe0_reading_address
[
0
]
=
0
;
}
...
...
@@ -426,7 +426,7 @@ RF24::RF24(uint8_t _cepin, uint8_t _cspin):
#if defined (RF24_LINUX) && !defined (MRAA)//RPi constructor
RF24
::
RF24
(
uint8_t
_cepin
,
uint8_t
_cspin
,
uint32_t
_spi_speed
)
:
ce_pin
(
_cepin
),
csn_pin
(
_cspin
),
spi_speed
(
_spi_speed
),
p_variant
(
false
),
payload_size
(
32
),
dynamic_payloads_enabled
(
false
),
addr_width
(
5
)
//,pipe0_reading_address(0)
ce_pin
(
_cepin
),
csn_pin
(
_cspin
),
spi_speed
(
_spi_speed
),
p_variant
(
false
),
payload_size
(
32
),
dynamic_payloads_enabled
(
false
),
addr_width
(
5
)
,
csDelay
(
5
)
//,pipe0_reading_address(0)
{
pipe0_reading_address
[
0
]
=
0
;
}
...
...
@@ -634,7 +634,7 @@ bool RF24::begin(void)
delay
(
5
)
;
// Reset NRF_CONFIG and enable 16-bit CRC.
write_register
(
NRF_CONFIG
,
0
b00001100
)
;
write_register
(
NRF_CONFIG
,
0
x0C
)
;
// 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
...
...
@@ -1071,7 +1071,7 @@ bool RF24::available(uint8_t* pipe_num)
// If the caller wants the pipe number, include that
if
(
pipe_num
){
uint8_t
status
=
get_status
();
*
pipe_num
=
(
status
>>
RX_P_NO
)
&
0
b111
;
*
pipe_num
=
(
status
>>
RX_P_NO
)
&
0
x07
;
}
return
1
;
}
...
...
@@ -1181,7 +1181,10 @@ void RF24::setAddressWidth(uint8_t a_width){
if
(
a_width
-=
2
){
write_register
(
SETUP_AW
,
a_width
%
4
);
addr_width
=
(
a_width
%
4
)
+
2
;
}
}
else
{
write_register
(
SETUP_AW
,
0
);
addr_width
=
2
;
}
}
...
...
@@ -1298,7 +1301,7 @@ void RF24::writeAckPayload(uint8_t pipe, const void* buf, uint8_t len)
beginTransaction
();
uint8_t
*
ptx
=
spi_txbuff
;
uint8_t
size
=
data_len
+
1
;
// Add register value to transmit buffer
*
ptx
++
=
W_ACK_PAYLOAD
|
(
pipe
&
0
b111
);
*
ptx
++
=
W_ACK_PAYLOAD
|
(
pipe
&
0
x07
);
while
(
data_len
--
){
*
ptx
++
=
*
current
++
;
}
...
...
@@ -1307,7 +1310,7 @@ void RF24::writeAckPayload(uint8_t pipe, const void* buf, uint8_t len)
endTransaction
();
#else
beginTransaction
();
_SPI
.
transfer
(
W_ACK_PAYLOAD
|
(
pipe
&
0
b111
)
);
_SPI
.
transfer
(
W_ACK_PAYLOAD
|
(
pipe
&
0
x07
)
);
while
(
data_len
--
)
_SPI
.
transfer
(
*
current
++
);
...
...
@@ -1336,7 +1339,7 @@ bool RF24::isPVariant(void)
void
RF24
::
setAutoAck
(
bool
enable
)
{
if
(
enable
)
write_register
(
EN_AA
,
0
b111111
);
write_register
(
EN_AA
,
0
x3F
);
else
write_register
(
EN_AA
,
0
);
}
...
...
@@ -1379,7 +1382,7 @@ bool RF24::testRPD(void)
void
RF24
::
setPALevel
(
uint8_t
level
)
{
uint8_t
setup
=
read_register
(
RF_SETUP
)
&
0
b11111000
;
uint8_t
setup
=
read_register
(
RF_SETUP
)
&
0
xF8
;
if
(
level
>
3
){
// If invalid level, go to max PA
level
=
(
RF24_PA_MAX
<<
1
)
+
1
;
// +1 to support the SI24R1 chip extra bit
...
...
RF24.h
View file @
aaa09e18
...
...
@@ -928,7 +928,7 @@ s *
* If using interrupts or timed requests, this can be set to 0 Default:5
*/
uint32_t
csDelay
=
5
;
uint32_t
csDelay
;
/**@}*/
/**
...
...
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