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
c408c5ef
Commit
c408c5ef
authored
Jul 13, 2011
by
maniacbug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify specification of test configs slightly
parent
c13db8f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
tests/pingpair_test/pingpair_test.pde
tests/pingpair_test/pingpair_test.pde
+27
-26
No files found.
tests/pingpair_test/pingpair_test.pde
View file @
c408c5ef
...
...
@@ -87,7 +87,7 @@ int receives_remaining = num_needed; //*< How many ack packets until we declare
int
failures_remaining
=
num_needed
;
//*< How many more failed sends until we declare failure? */
const
int
interval
=
100
;
//*< ms to wait between sends */
char
configuration
=
'
'
;
//*< Configuration key, one char sent in by the test framework to tell us how to configure, ' ' is
default */
char
configuration
=
'
1'
;
//*< Configuration key, one char sent in by the test framework to tell us how to configure, this is the
default */
void
one_ok
(
void
)
{
...
...
@@ -109,6 +109,10 @@ void one_failed(void)
}
}
//
// Setup
//
void
setup
(
void
)
{
//
...
...
@@ -165,32 +169,26 @@ void setup(void)
// We will be using the Ack Payload feature, so please enable it
radio
.
enableAckPayload
();
switch
(
configuration
)
if
(
configuration
==
'2'
)
{
// Config 2 is special radio config
radio
.
setCRCLength
(
RF24_CRC_8
);
radio
.
setDataRate
(
RF24_2MBPS
);
radio
.
setChannel
(
10
);
}
else
{
case
' '
:
case
'1'
:
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_16
);
// Optional: Decrease data rate for improved reliability
radio
.
setDataRate
(
RF24_1MBPS
);
// Optional: Pick a high channel
radio
.
setChannel
(
90
);
break
;
case
'2'
:
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_8
);
radio
.
setDataRate
(
RF24_2MBPS
);
radio
.
setChannel
(
10
);
break
;
default:
printf
(
"ERROR Unknown configuration %c
\n\r
"
,
configuration
);
done
=
true
;
passed
=
false
;
break
;
}
//Otherwise, default radio config
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_16
);
// Optional: Decrease data rate for improved reliability
radio
.
setDataRate
(
RF24_1MBPS
);
// Optional: Pick a high channel
radio
.
setChannel
(
90
);
}
// enable dynamic payloads
radio
.
enableDynamicPayloads
();
...
...
@@ -232,6 +230,9 @@ void setup(void)
attachInterrupt
(
0
,
check_radio
,
FALLING
);
}
//
// Loop
//
static
uint32_t
message_count
=
0
;
static
uint32_t
last_message_count
=
0
;
...
...
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