summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-12-20 10:22:12 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-12-20 10:22:12 +0100
commit70a8e26e28703a71d4e84e5816fecc2b18310908 (patch)
treee2f580020748184cb319f63c4a17598d6f993483
parent631eadd1283eb75c5ad120a9ffe9ff0fa345a702 (diff)
nrf24l01test: set RX/TX mode via make flag
-rw-r--r--src/app/nrf24l01test/Makefile.inc5
-rw-r--r--src/app/nrf24l01test/main.cc17
2 files changed, 13 insertions, 9 deletions
diff --git a/src/app/nrf24l01test/Makefile.inc b/src/app/nrf24l01test/Makefile.inc
index 67e9c68..6713ddb 100644
--- a/src/app/nrf24l01test/Makefile.inc
+++ b/src/app/nrf24l01test/Makefile.inc
@@ -1,2 +1,7 @@
+override drivers += ,nrf24l01
timer_s ?= 1
loop ?= 1
+
+ifeq (${tx}, 1)
+ COMMON_FLAGS += -DNRF24L01TEST_TX
+endif
diff --git a/src/app/nrf24l01test/main.cc b/src/app/nrf24l01test/main.cc
index e18dd85..3c8b785 100644
--- a/src/app/nrf24l01test/main.cc
+++ b/src/app/nrf24l01test/main.cc
@@ -46,15 +46,14 @@ void loop(void)
}
kout << endl;
-#ifdef MULTIPASS_ARCH_msp430fr5994lp
+#ifdef NRF24L01TEST_TX
//kout << nrf24l01.write("foo", 3, true, true) << " ";
//kout << nrf24l01.write("123456789", 10, true, true) << " ";
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));
+ status = nrf24l01.write("123456789123456789", 20, true, false);
kout << "write: " << status << endl;
kout << "Observe TX = " << hex << nrf24l01.getObserveTx() << endl;
}
@@ -84,7 +83,7 @@ int main(void)
kout << "nrf24l01.setup() ...";
nrf24l01.setup();
- kout << " OK" << endl;
+ kout << " complete" << endl;
kout << "nrf24l01 configure ...";
unsigned char addr[5] = {0, 'D', 'E', 'R', 'F'};
@@ -92,16 +91,16 @@ int main(void)
//nrf24l01.enableAckPayload();
nrf24l01.setDynamicPayloads(true);
nrf24l01.setPALevel(Nrf24l01::RF24_PA_HIGH);
- nrf24l01.setChannel(110);
+ nrf24l01.setChannel(23);
nrf24l01.setDataRate(Nrf24l01::RF24_2MBPS);
nrf24l01.setRetries(15, 15);
-#ifdef MULTIPASS_ARCH_msp430fr5969lp
+#ifdef NRF24L01TEST_TX
+ nrf24l01.openWritingPipe((const uint8_t *)addr);
+#else
nrf24l01.openReadingPipe(1, addr);
nrf24l01.startListening();
-#else
- nrf24l01.openWritingPipe((const uint8_t *)addr);
#endif
- kout << " OK" << endl;
+ kout << " complete" << endl;
gpio.led_on(0);
arch.idle_loop();