summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-06-25 12:02:33 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-06-25 12:02:33 +0200
commitf0ad73ff8fe391d2aac4bc437128618647d46b4f (patch)
treed122ee6e6b82f8c196ee64c85d1f68ebad6444fd /src/app
parent6bdbdaddc6d7629f51d5c12d7f3480afdf2234f5 (diff)
Nrf24: dynamic payload size and dynamic acks
Diffstat (limited to 'src/app')
-rw-r--r--src/app/nrf24l01test/main.cc36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/app/nrf24l01test/main.cc b/src/app/nrf24l01test/main.cc
index ad1bc11..187a9c1 100644
--- a/src/app/nrf24l01test/main.cc
+++ b/src/app/nrf24l01test/main.cc
@@ -2,13 +2,45 @@
#include "driver/gpio.h"
#include "driver/stdout.h"
#include "driver/nrf24l01.h"
+#include "driver/counter.h"
+
+#define TIMEIT(index, functioncall) \
+ counter.start(); \
+ functioncall; \
+ counter.stop(); \
+ kout << endl << index << " :: " << dec << counter.value << "/" << counter.overflow << endl;
void loop(void)
{
gpio.led_toggle(1);
- kout << "status: " << hex << nrf24l01.getStatus() << endl;
+ uint8_t status = nrf24l01.getStatus();
+
+ kout << "status: " << hex << status;
+ if (status & 0x40) {
+ kout << " RX_DR";
+ }
+ if (status & 0x20) {
+ kout << " TX_DS";
+ }
+ if (status & 0x10) {
+ kout << " MAX_RT";
+ }
+ if ((status & 0x0e) == 0x0e) {
+ kout << " RX_EMPTY";
+ }
+ if (status & 0x01) {
+ kout << " TX_FULL";
+ }
+ kout << endl;
+
kout << "write: ";
- kout << nrf24l01.write("foo", 3, true) << endl;
+ nrf24l01.setRetries(0, 0);
+ nrf24l01.enableDynamicPayloads();
+ nrf24l01.enableDynamicAck();
+ TIMEIT("blocking write(3)", nrf24l01.write("foo", 3, false, true));
+ TIMEIT("blocking write(10)", nrf24l01.write("123456789", 10, false, true));
+ TIMEIT("blocking write(20)", nrf24l01.write("123456789123456789", 20, false, true));
+ TIMEIT("blocking write(30)", nrf24l01.write("123456789123456789123456789", 30, false, true));
nrf24l01.startListening();
arch.delay_ms(10);
nrf24l01.stopListening();