Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
multipass
Commits
eafcc35a
Commit
eafcc35a
authored
5 years ago
by
Daniel Friesel
Browse files
Options
Downloads
Patches
Plain Diff
nrf24l01test: more tests
parent
23df73ee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/nrf24l01test/main.cc
+42
-21
42 additions, 21 deletions
src/app/nrf24l01test/main.cc
with
42 additions
and
21 deletions
src/app/nrf24l01test/main.cc
+
42
−
21
View file @
eafcc35a
...
@@ -5,52 +5,72 @@
...
@@ -5,52 +5,72 @@
#include
"driver/counter.h"
#include
"driver/counter.h"
#define TIMEIT(index, functioncall) \
#define TIMEIT(index, functioncall) \
counter.start(); \
counter.start(); \
functioncall; \
functioncall; \
counter.stop(); \
counter.stop(); \
kout << endl << index << " :: " << dec << counter.value << "/" << counter.overflow << endl;
kout << endl \
<< index << " :: " << dec << counter.value << "/" << counter.overflow << endl;
char
buf
[
32
];
char
buf
[
32
];
void
loop
(
void
)
void
loop
(
void
)
{
{
gpio
.
led_toggle
(
1
);
gpio
.
led_toggle
(
1
);
static
uint8_t
do_send
=
0
;
uint8_t
status
=
nrf24l01
.
getStatus
();
uint8_t
status
=
nrf24l01
.
getStatus
();
kout
<<
"status: "
<<
hex
<<
status
;
kout
<<
"status: "
<<
hex
<<
status
;
if
(
status
&
0x40
)
{
if
(
status
&
0x40
)
{
kout
<<
" RX_DR"
;
kout
<<
" RX_DR"
;
}
}
if
(
status
&
0x20
)
{
if
(
status
&
0x20
)
{
kout
<<
" TX_DS"
;
kout
<<
" TX_DS"
;
}
}
if
(
status
&
0x10
)
{
if
(
status
&
0x10
)
{
kout
<<
" MAX_RT"
;
kout
<<
" MAX_RT"
;
}
}
if
((
status
&
0x0e
)
==
0x0e
)
{
if
((
status
&
0x0e
)
==
0x0e
)
{
kout
<<
" RX_EMPTY"
;
kout
<<
" RX_EMPTY"
;
}
}
if
(
status
&
0x01
)
{
if
(
status
&
0x01
)
{
kout
<<
" TX_FULL"
;
kout
<<
" TX_FULL"
;
}
}
if
((
status
&
0x0e
)
<
0x0d
)
{
if
((
status
&
0x0e
)
<
0x0d
)
kout
<<
" @"
<<
(
status
&
0x0e
)
/
2
;
{
kout
<<
" @"
<<
(
status
&
0x0e
)
/
2
;
}
}
kout
<<
endl
;
kout
<<
endl
;
#ifdef MULTIPASS_ARCH_msp430fr5969lp
#ifdef MULTIPASS_ARCH_msp430fr5994lp
kout
<<
"write: "
;
//kout << nrf24l01.write("foo", 3, true, true) << " ";
//kout << nrf24l01.write("foo", 3, true, true) << " ";
//kout << nrf24l01.write("123456789", 10, true, true) << " ";
//kout << nrf24l01.write("123456789", 10, true, true) << " ";
kout
<<
nrf24l01
.
write
(
"123456789123456789"
,
20
,
true
,
true
)
<<
endl
;
if
(
do_send
++
%
2
)
{
// TODO .write(...) ist wenn der Empfänger verschwindet trotzdem noch ein paar mal erfolgreich. Das sieht komisch aus.
nrf24l01
.
flushTx
();
TIMEIT
(
0
,
arch
.
delay_ms
(
10
));
TIMEIT
(
1
,
status
=
nrf24l01
.
write
(
"123456789123456789"
,
20
,
true
,
true
));
kout
<<
"write: "
<<
status
<<
endl
;
kout
<<
"Observe TX = "
<<
hex
<<
nrf24l01
.
getObserveTx
()
<<
endl
;
}
#else
#else
kout
<<
"carrier "
<<
nrf24l01
.
testCarrier
()
<<
" / RPD "
<<
nrf24l01
.
testRPD
();
kout
<<
"carrier "
<<
nrf24l01
.
testCarrier
()
<<
" / RPD "
<<
nrf24l01
.
testRPD
();
if
(
nrf24l01
.
available
())
{
if
(
nrf24l01
.
available
())
{
nrf24l01
.
read
(
buf
,
32
);
nrf24l01
.
read
(
buf
,
32
);
buf
[
31
]
=
0
;
kout
<<
" / data = "
<<
buf
<<
endl
;
kout
<<
" / data = "
<<
buf
<<
endl
;
}
else
{
}
else
{
kout
<<
" / no data"
<<
endl
;
kout
<<
" / no data"
<<
endl
;
}
}
// flush carrier / rpd status
nrf24l01
.
stopListening
();
nrf24l01
.
stopListening
();
nrf24l01
.
startListening
();
nrf24l01
.
startListening
();
#endif
#endif
...
@@ -67,18 +87,19 @@ int main(void)
...
@@ -67,18 +87,19 @@ int main(void)
kout
<<
" OK"
<<
endl
;
kout
<<
" OK"
<<
endl
;
kout
<<
"nrf24l01 configure ..."
;
kout
<<
"nrf24l01 configure ..."
;
unsigned
char
addr
[
5
]
=
{
0
,
'D'
,
'E'
,
'R'
,
'F'
};
unsigned
char
addr
[
5
]
=
{
0
,
'D'
,
'E'
,
'R'
,
'F'
};
nrf24l01
.
setAutoAck
(
1
);
nrf24l01
.
setAutoAck
(
1
);
//nrf24l01.enableAckPayload();
//nrf24l01.enableAckPayload();
nrf24l01
.
setDynamicPayloads
(
fals
e
);
nrf24l01
.
setDynamicPayloads
(
tru
e
);
nrf24l01
.
setPALevel
(
Nrf24l01
::
RF24_PA_
MAX
);
nrf24l01
.
setPALevel
(
Nrf24l01
::
RF24_PA_
HIGH
);
nrf24l01
.
setChannel
(
110
);
nrf24l01
.
setChannel
(
110
);
nrf24l01
.
setDataRate
(
Nrf24l01
::
RF24_2MBPS
);
nrf24l01
.
setDataRate
(
Nrf24l01
::
RF24_2MBPS
);
#ifdef MULTIPASS_ARCH_msp430fr5994lp
nrf24l01
.
setRetries
(
15
,
15
);
#ifdef MULTIPASS_ARCH_msp430fr5969lp
nrf24l01
.
openReadingPipe
(
1
,
addr
);
nrf24l01
.
openReadingPipe
(
1
,
addr
);
nrf24l01
.
startListening
();
nrf24l01
.
startListening
();
#else
#else
nrf24l01
.
openWritingPipe
((
const
uint8_t
*
)
addr
);
nrf24l01
.
openWritingPipe
((
const
uint8_t
*
)
addr
);
#endif
#endif
kout
<<
" OK"
<<
endl
;
kout
<<
" OK"
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment