summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
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();