From 98c5775f7c27038ca49faba138383b0861e3d44d Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Wed, 13 Mar 2024 23:03:45 +0000 Subject: [PATCH] deploy: 29b8745657fab37b7a3cb19a61e402c5ebf9be7f --- html/annotated.html | 2 +- html/classes.html | 2 +- html/classnrf__to__nrf-members.html | 2 +- html/classnrf__to__nrf.html | 90 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- html/examples.html | 2 +- ..._2mqtt_basic_2mqtt_basic_8ino-example.html | 4 +- ...24Mesh_ExampleEncryption_8ino-example.html | 10 +- ...xample_2RF24Mesh_Example_8ino-example.html | 6 +- ...Example_MasterEncryption_8ino-example.html | 6 +- ...2helloworld_rxEncryption_8ino-example.html | 8 +- ...oworld_rx_2helloworld_rx_8ino-example.html | 4 +- ...2helloworld_txEncryption_8ino-example.html | 8 +- ...oworld_tx_2helloworld_tx_8ino-example.html | 4 +- ...2AcknowledgementPayloads_8ino-example.html | 24 +- ...GettingStartedEncryption_8ino-example.html | 22 +- ...gStarted_2GettingStarted_8ino-example.html | 20 +- ..._2RF24_2scanner_2scanner_8ino-example.html | 12 +- html/files.html | 2 +- html/functions.html | 2 +- html/functions_func.html | 2 +- html/functions_vars.html | 2 +- html/globals.html | 2 +- html/globals_defs.html | 2 +- html/globals_enum.html | 2 +- html/globals_eval.html | 2 +- html/globals_func.html | 2 +- html/index.html | 2 +- html/nrf__to__nrf_8cpp.html | 2 +- html/nrf__to__nrf_8cpp_source.html | 2357 +++++++++-------- html/nrf__to__nrf_8h.html | 2 +- html/nrf__to__nrf_8h_source.html | 82 +- src/nrf_to_nrf.cpp | 17 +- 33 files changed, 1355 insertions(+), 1353 deletions(-) diff --git a/html/annotated.html b/html/annotated.html index bf941d3..823f345 100644 --- a/html/annotated.html +++ b/html/annotated.html @@ -107,7 +107,7 @@ diff --git a/html/classes.html b/html/classes.html index b23443a..caa7a10 100644 --- a/html/classes.html +++ b/html/classes.html @@ -108,7 +108,7 @@ diff --git a/html/classnrf__to__nrf-members.html b/html/classnrf__to__nrf-members.html index 4ef0896..0938329 100644 --- a/html/classnrf__to__nrf-members.html +++ b/html/classnrf__to__nrf-members.html @@ -160,7 +160,7 @@ diff --git a/html/classnrf__to__nrf.html b/html/classnrf__to__nrf.html index 48c0ca8..b06461b 100644 --- a/html/classnrf__to__nrf.html +++ b/html/classnrf__to__nrf.html @@ -347,7 +347,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, and examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 352 of file nrf_to_nrf.cpp.

+

Definition at line 353 of file nrf_to_nrf.cpp.

@@ -383,7 +383,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, and examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 364 of file nrf_to_nrf.cpp.

+

Definition at line 365 of file nrf_to_nrf.cpp.

@@ -410,7 +410,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino, and examples/RF24/scanner/scanner.ino.
-

Definition at line 703 of file nrf_to_nrf.cpp.

+

Definition at line 704 of file nrf_to_nrf.cpp.

@@ -442,7 +442,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino, and examples/RF24/scanner/scanner.ino.
-

Definition at line 726 of file nrf_to_nrf.cpp.

+

Definition at line 727 of file nrf_to_nrf.cpp.

@@ -468,7 +468,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, and examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 933 of file nrf_to_nrf.cpp.

+

Definition at line 934 of file nrf_to_nrf.cpp.

@@ -490,7 +490,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, and examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 975 of file nrf_to_nrf.cpp.

+

Definition at line 976 of file nrf_to_nrf.cpp.

@@ -512,7 +512,7 @@

Examples
examples/RF24Mesh/RF24Mesh_Example/RF24Mesh_Example.ino, and examples/RF24Mesh/RF24Mesh_ExampleEncryption/RF24Mesh_ExampleEncryption.ino.
-

Definition at line 1051 of file nrf_to_nrf.cpp.

+

Definition at line 1052 of file nrf_to_nrf.cpp.

@@ -541,7 +541,7 @@

Not currently fully functional, calls the regular write();

-

Definition at line 1032 of file nrf_to_nrf.cpp.

+

Definition at line 1033 of file nrf_to_nrf.cpp.

@@ -577,7 +577,7 @@

txStandBy() to take the radio out of TX state or call startListening() to go into RX mode

-

Definition at line 553 of file nrf_to_nrf.cpp.

+

Definition at line 554 of file nrf_to_nrf.cpp.

@@ -608,7 +608,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino.
-

Definition at line 653 of file nrf_to_nrf.cpp.

+

Definition at line 654 of file nrf_to_nrf.cpp.

@@ -630,7 +630,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino.
-

Definition at line 695 of file nrf_to_nrf.cpp.

+

Definition at line 696 of file nrf_to_nrf.cpp.

@@ -650,7 +650,7 @@

Same as NRF24

-

Definition at line 699 of file nrf_to_nrf.cpp.

+

Definition at line 700 of file nrf_to_nrf.cpp.

@@ -690,7 +690,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino.
-

Definition at line 750 of file nrf_to_nrf.cpp.

+

Definition at line 751 of file nrf_to_nrf.cpp.

@@ -710,7 +710,7 @@

Same as NRF24

-

Definition at line 758 of file nrf_to_nrf.cpp.

+

Definition at line 759 of file nrf_to_nrf.cpp.

@@ -732,7 +732,7 @@

Examples
examples/RF24/scanner/scanner.ino, examples/RF24Network/helloworld_rx/helloworld_rx.ino, examples/RF24Network/helloworld_rxEncryption/helloworld_rxEncryption.ino, examples/RF24Network/helloworld_tx/helloworld_tx.ino, and examples/RF24Network/helloworld_txEncryption/helloworld_txEncryption.ino.
-

Definition at line 772 of file nrf_to_nrf.cpp.

+

Definition at line 773 of file nrf_to_nrf.cpp.

@@ -752,7 +752,7 @@

Same as NRF24

-

Definition at line 776 of file nrf_to_nrf.cpp.

+

Definition at line 777 of file nrf_to_nrf.cpp.

@@ -772,7 +772,7 @@

Supported speeds: NRF_1MBPS NRF_2MBPS

-

Definition at line 1055 of file nrf_to_nrf.cpp.

+

Definition at line 1056 of file nrf_to_nrf.cpp.

@@ -799,7 +799,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24/GettingStarted/GettingStarted.ino, examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino, examples/RF24Mesh/RF24Mesh_Example/RF24Mesh_Example.ino, and examples/RF24Mesh/RF24Mesh_ExampleEncryption/RF24Mesh_ExampleEncryption.ino.
-

Definition at line 1076 of file nrf_to_nrf.cpp.

+

Definition at line 1077 of file nrf_to_nrf.cpp.

@@ -819,7 +819,7 @@

Same as NRF24

-

Definition at line 1098 of file nrf_to_nrf.cpp.

+

Definition at line 1099 of file nrf_to_nrf.cpp.

@@ -841,7 +841,7 @@

Examples
examples/RF24/scanner/scanner.ino.
-

Definition at line 780 of file nrf_to_nrf.cpp.

+

Definition at line 781 of file nrf_to_nrf.cpp.

@@ -865,7 +865,7 @@

Note
If using static payloads, acks cannot be enabled & disabled on separate pipes, either ACKs are enabled or not
-

Definition at line 793 of file nrf_to_nrf.cpp.

+

Definition at line 794 of file nrf_to_nrf.cpp.

@@ -893,7 +893,7 @@

Examples
examples/RF24/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/RF24Mesh/RF24Mesh_ExampleEncryption/RF24Mesh_ExampleEncryption.ino, examples/RF24Mesh/RF24Mesh_Example_MasterEncryption/RF24Mesh_Example_MasterEncryption.ino, examples/RF24Network/helloworld_rxEncryption/helloworld_rxEncryption.ino, and examples/RF24Network/helloworld_txEncryption/helloworld_txEncryption.ino.
-

Definition at line 804 of file nrf_to_nrf.cpp.

+

Definition at line 805 of file nrf_to_nrf.cpp.

@@ -913,7 +913,7 @@

Same as NRF24

-

Definition at line 824 of file nrf_to_nrf.cpp.

+

Definition at line 825 of file nrf_to_nrf.cpp.

@@ -935,7 +935,7 @@

Examples
examples/RF24/GettingStarted/GettingStarted.ino, and examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 839 of file nrf_to_nrf.cpp.

+

Definition at line 840 of file nrf_to_nrf.cpp.

@@ -957,7 +957,7 @@

Examples
examples/RF24/GettingStarted/GettingStarted.ino.
-

Definition at line 855 of file nrf_to_nrf.cpp.

+

Definition at line 856 of file nrf_to_nrf.cpp.

@@ -977,7 +977,7 @@

Same as NRF24

-

Definition at line 1129 of file nrf_to_nrf.cpp.

+

Definition at line 1130 of file nrf_to_nrf.cpp.

@@ -997,7 +997,7 @@

Same as NRF24

-

Definition at line 1151 of file nrf_to_nrf.cpp.

+

Definition at line 1152 of file nrf_to_nrf.cpp.

@@ -1039,7 +1039,7 @@

Same as NRF24

-

Definition at line 862 of file nrf_to_nrf.cpp.

+

Definition at line 863 of file nrf_to_nrf.cpp.

@@ -1063,7 +1063,7 @@

Same as NRF24

-

Definition at line 871 of file nrf_to_nrf.cpp.

+

Definition at line 872 of file nrf_to_nrf.cpp.

@@ -1083,7 +1083,7 @@

Same as NRF24

-

Definition at line 912 of file nrf_to_nrf.cpp.

+

Definition at line 913 of file nrf_to_nrf.cpp.

@@ -1103,7 +1103,7 @@

Same as NRF24

-

Definition at line 1203 of file nrf_to_nrf.cpp.

+

Definition at line 1204 of file nrf_to_nrf.cpp.

@@ -1125,7 +1125,7 @@

Examples
examples/RF24Ethernet/mqtt_basic/mqtt_basic.ino.
-

Definition at line 1218 of file nrf_to_nrf.cpp.

+

Definition at line 1219 of file nrf_to_nrf.cpp.

@@ -1145,7 +1145,7 @@

When powering up from powerdown ALL radio settings will need to be re-applied

-

Definition at line 1188 of file nrf_to_nrf.cpp.

+

Definition at line 1189 of file nrf_to_nrf.cpp.

@@ -1165,7 +1165,7 @@

When called ALL radio settings will be reverted to default

-

Definition at line 1196 of file nrf_to_nrf.cpp.

+

Definition at line 1197 of file nrf_to_nrf.cpp.

@@ -1186,7 +1186,7 @@

Definition at line 995 of file nrf_to_nrf.cpp.

+

Definition at line 996 of file nrf_to_nrf.cpp.

@@ -1211,7 +1211,7 @@

Definition at line 1013 of file nrf_to_nrf.cpp.

+

Definition at line 1014 of file nrf_to_nrf.cpp.

@@ -1238,7 +1238,7 @@

Examples
examples/RF24/scanner/scanner.ino.
-

Definition at line 1166 of file nrf_to_nrf.cpp.

+

Definition at line 1167 of file nrf_to_nrf.cpp.

@@ -1263,7 +1263,7 @@

Definition at line 1181 of file nrf_to_nrf.cpp.

+

Definition at line 1182 of file nrf_to_nrf.cpp.

@@ -1283,7 +1283,7 @@

Same as NRF24

-

Definition at line 1122 of file nrf_to_nrf.cpp.

+

Definition at line 1123 of file nrf_to_nrf.cpp.

@@ -1327,7 +1327,7 @@

Function to encrypt data

-

Definition at line 1312 of file nrf_to_nrf.cpp.

+

Definition at line 1313 of file nrf_to_nrf.cpp.

@@ -1351,7 +1351,7 @@

Function to decrypt data

-

Definition at line 1344 of file nrf_to_nrf.cpp.

+

Definition at line 1345 of file nrf_to_nrf.cpp.

@@ -1373,7 +1373,7 @@

Examples
examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino, examples/RF24Mesh/RF24Mesh_ExampleEncryption/RF24Mesh_ExampleEncryption.ino, examples/RF24Mesh/RF24Mesh_Example_MasterEncryption/RF24Mesh_Example_MasterEncryption.ino, examples/RF24Network/helloworld_rxEncryption/helloworld_rxEncryption.ino, and examples/RF24Network/helloworld_txEncryption/helloworld_txEncryption.ino.
-

Definition at line 1377 of file nrf_to_nrf.cpp.

+

Definition at line 1378 of file nrf_to_nrf.cpp.

@@ -1395,7 +1395,7 @@

Examples
examples/RF24/GettingStartedEncryption/GettingStartedEncryption.ino.
-

Definition at line 1385 of file nrf_to_nrf.cpp.

+

Definition at line 1386 of file nrf_to_nrf.cpp.

@@ -1415,7 +1415,7 @@

Set IV for encryption. This is only used for manual encryption, a random IV is generated using the on-board RNG for encryption during normal operation.

-

Definition at line 1393 of file nrf_to_nrf.cpp.

+

Definition at line 1394 of file nrf_to_nrf.cpp.

@@ -1500,7 +1500,7 @@

diff --git a/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index ba0c9b6..e0a9f2e 100644 --- a/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -113,7 +113,7 @@ diff --git a/html/examples.html b/html/examples.html index 2990c24..7492e41 100644 --- a/html/examples.html +++ b/html/examples.html @@ -109,7 +109,7 @@ diff --git a/html/examples_2RF24Ethernet_2mqtt_basic_2mqtt_basic_8ino-example.html b/html/examples_2RF24Ethernet_2mqtt_basic_2mqtt_basic_8ino-example.html index 84b754c..26356f7 100644 --- a/html/examples_2RF24Ethernet_2mqtt_basic_2mqtt_basic_8ino-example.html +++ b/html/examples_2RF24Ethernet_2mqtt_basic_2mqtt_basic_8ino-example.html @@ -232,12 +232,12 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void printDetails()
+
void printDetails()
diff --git a/html/examples_2RF24Mesh_2RF24Mesh_ExampleEncryption_2RF24Mesh_ExampleEncryption_8ino-example.html b/html/examples_2RF24Mesh_2RF24Mesh_ExampleEncryption_2RF24Mesh_ExampleEncryption_8ino-example.html index e5022bd..4b0bc91 100644 --- a/html/examples_2RF24Mesh_2RF24Mesh_ExampleEncryption_2RF24Mesh_ExampleEncryption_8ino-example.html +++ b/html/examples_2RF24Mesh_2RF24Mesh_ExampleEncryption_2RF24Mesh_ExampleEncryption_8ino-example.html @@ -198,18 +198,18 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setPALevel(uint8_t level, bool lnaEnable=true)
-
bool isChipConnected()
-
void setKey(uint8_t key[CCM_KEY_SIZE])
+
void setPALevel(uint8_t level, bool lnaEnable=true)
+
bool isChipConnected()
+
void setKey(uint8_t key[CCM_KEY_SIZE])
bool begin()
bool enableEncryption
Definition nrf_to_nrf.h:467
-
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
+
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
@ NRF_PA_MIN
Definition nrf_to_nrf.h:50
diff --git a/html/examples_2RF24Mesh_2RF24Mesh_Example_2RF24Mesh_Example_8ino-example.html b/html/examples_2RF24Mesh_2RF24Mesh_Example_2RF24Mesh_Example_8ino-example.html index 21a5a96..07784ea 100644 --- a/html/examples_2RF24Mesh_2RF24Mesh_Example_2RF24Mesh_Example_8ino-example.html +++ b/html/examples_2RF24Mesh_2RF24Mesh_Example_2RF24Mesh_Example_8ino-example.html @@ -191,14 +191,14 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setPALevel(uint8_t level, bool lnaEnable=true)
-
bool isChipConnected()
+
void setPALevel(uint8_t level, bool lnaEnable=true)
+
bool isChipConnected()
@ NRF_PA_MIN
Definition nrf_to_nrf.h:50
diff --git a/html/examples_2RF24Mesh_2RF24Mesh_Example_MasterEncryption_2RF24Mesh_Example_MasterEncryption_8ino-example.html b/html/examples_2RF24Mesh_2RF24Mesh_Example_MasterEncryption_2RF24Mesh_Example_MasterEncryption_8ino-example.html index 2c7f972..bc308d3 100644 --- a/html/examples_2RF24Mesh_2RF24Mesh_Example_MasterEncryption_2RF24Mesh_Example_MasterEncryption_8ino-example.html +++ b/html/examples_2RF24Mesh_2RF24Mesh_Example_MasterEncryption_2RF24Mesh_Example_MasterEncryption_8ino-example.html @@ -179,15 +179,15 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setKey(uint8_t key[CCM_KEY_SIZE])
+
void setKey(uint8_t key[CCM_KEY_SIZE])
bool begin()
bool enableEncryption
Definition nrf_to_nrf.h:467
-
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
+
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
diff --git a/html/examples_2RF24Network_2helloworld_rxEncryption_2helloworld_rxEncryption_8ino-example.html b/html/examples_2RF24Network_2helloworld_rxEncryption_2helloworld_rxEncryption_8ino-example.html index 9dff8db..0f5d385 100644 --- a/html/examples_2RF24Network_2helloworld_rxEncryption_2helloworld_rxEncryption_8ino-example.html +++ b/html/examples_2RF24Network_2helloworld_rxEncryption_2helloworld_rxEncryption_8ino-example.html @@ -149,16 +149,16 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setChannel(uint8_t channel)
-
void setKey(uint8_t key[CCM_KEY_SIZE])
+
void setChannel(uint8_t channel)
+
void setKey(uint8_t key[CCM_KEY_SIZE])
bool begin()
bool enableEncryption
Definition nrf_to_nrf.h:467
-
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
+
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
diff --git a/html/examples_2RF24Network_2helloworld_rx_2helloworld_rx_8ino-example.html b/html/examples_2RF24Network_2helloworld_rx_2helloworld_rx_8ino-example.html index fb8b4fb..1e4917f 100644 --- a/html/examples_2RF24Network_2helloworld_rx_2helloworld_rx_8ino-example.html +++ b/html/examples_2RF24Network_2helloworld_rx_2helloworld_rx_8ino-example.html @@ -142,13 +142,13 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setChannel(uint8_t channel)
+
void setChannel(uint8_t channel)
bool begin()
diff --git a/html/examples_2RF24Network_2helloworld_txEncryption_2helloworld_txEncryption_8ino-example.html b/html/examples_2RF24Network_2helloworld_txEncryption_2helloworld_txEncryption_8ino-example.html index b41df71..3abd5d7 100644 --- a/html/examples_2RF24Network_2helloworld_txEncryption_2helloworld_txEncryption_8ino-example.html +++ b/html/examples_2RF24Network_2helloworld_txEncryption_2helloworld_txEncryption_8ino-example.html @@ -157,16 +157,16 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setChannel(uint8_t channel)
-
void setKey(uint8_t key[CCM_KEY_SIZE])
+
void setChannel(uint8_t channel)
+
void setKey(uint8_t key[CCM_KEY_SIZE])
bool begin()
bool enableEncryption
Definition nrf_to_nrf.h:467
-
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
+
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
diff --git a/html/examples_2RF24Network_2helloworld_tx_2helloworld_tx_8ino-example.html b/html/examples_2RF24Network_2helloworld_tx_2helloworld_tx_8ino-example.html index d0838dc..5e2c62c 100644 --- a/html/examples_2RF24Network_2helloworld_tx_2helloworld_tx_8ino-example.html +++ b/html/examples_2RF24Network_2helloworld_tx_2helloworld_tx_8ino-example.html @@ -149,13 +149,13 @@
}
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void setChannel(uint8_t channel)
+
void setChannel(uint8_t channel)
bool begin()
diff --git a/html/examples_2RF24_2AcknowledgementPayloads_2AcknowledgementPayloads_8ino-example.html b/html/examples_2RF24_2AcknowledgementPayloads_2AcknowledgementPayloads_8ino-example.html index 4aba02b..322b7bf 100644 --- a/html/examples_2RF24_2AcknowledgementPayloads_2AcknowledgementPayloads_8ino-example.html +++ b/html/examples_2RF24_2AcknowledgementPayloads_2AcknowledgementPayloads_8ino-example.html @@ -290,25 +290,25 @@
}
} // loop
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void startListening(bool resetAddresses=true)
-
void openReadingPipe(uint8_t child, const uint8_t *address)
+
void startListening(bool resetAddresses=true)
+
void openReadingPipe(uint8_t child, const uint8_t *address)
bool available()
-
void setPALevel(uint8_t level, bool lnaEnable=true)
-
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
-
uint8_t getDynamicPayloadSize()
+
void setPALevel(uint8_t level, bool lnaEnable=true)
+
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
+
uint8_t getDynamicPayloadSize()
bool begin()
-
bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
-
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
-
void enableAckPayload()
-
void openWritingPipe(const uint8_t *address)
-
void read(void *buf, uint8_t len)
-
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
+
bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
+
void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
+
void enableAckPayload()
+
void openWritingPipe(const uint8_t *address)
+
void read(void *buf, uint8_t len)
+
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
@ NRF_PA_MAX
Definition nrf_to_nrf.h:62
diff --git a/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html b/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html index 4930673..a3c8bb6 100644 --- a/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html +++ b/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html @@ -253,25 +253,25 @@
} // loop
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void startListening(bool resetAddresses=true)
-
void openReadingPipe(uint8_t child, const uint8_t *address)
+
void startListening(bool resetAddresses=true)
+
void openReadingPipe(uint8_t child, const uint8_t *address)
bool available()
-
void setPALevel(uint8_t level, bool lnaEnable=true)
-
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
-
void setCounter(uint64_t counter)
-
void setKey(uint8_t key[CCM_KEY_SIZE])
+
void setPALevel(uint8_t level, bool lnaEnable=true)
+
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
+
void setCounter(uint64_t counter)
+
void setKey(uint8_t key[CCM_KEY_SIZE])
bool begin()
bool enableEncryption
Definition nrf_to_nrf.h:467
-
void openWritingPipe(const uint8_t *address)
-
void read(void *buf, uint8_t len)
-
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
-
void setPayloadSize(uint8_t size)
+
void openWritingPipe(const uint8_t *address)
+
void read(void *buf, uint8_t len)
+
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
+
void setPayloadSize(uint8_t size)
@ NRF_PA_LOW
Definition nrf_to_nrf.h:54
diff --git a/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html b/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html index 3bb98c2..51f4c59 100644 --- a/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html +++ b/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html @@ -239,23 +239,23 @@
} // loop
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void startListening(bool resetAddresses=true)
-
void openReadingPipe(uint8_t child, const uint8_t *address)
+
void startListening(bool resetAddresses=true)
+
void openReadingPipe(uint8_t child, const uint8_t *address)
bool available()
-
void setPALevel(uint8_t level, bool lnaEnable=true)
-
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
+
void setPALevel(uint8_t level, bool lnaEnable=true)
+
bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
bool begin()
-
void openWritingPipe(const uint8_t *address)
-
void read(void *buf, uint8_t len)
-
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
-
void setPayloadSize(uint8_t size)
-
uint8_t getPayloadSize()
+
void openWritingPipe(const uint8_t *address)
+
void read(void *buf, uint8_t len)
+
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
+
void setPayloadSize(uint8_t size)
+
uint8_t getPayloadSize()
@ NRF_PA_LOW
Definition nrf_to_nrf.h:54
diff --git a/html/examples_2RF24_2scanner_2scanner_8ino-example.html b/html/examples_2RF24_2scanner_2scanner_8ino-example.html index 7e00e38..f38deab 100644 --- a/html/examples_2RF24_2scanner_2scanner_8ino-example.html +++ b/html/examples_2RF24_2scanner_2scanner_8ino-example.html @@ -226,17 +226,17 @@
} //If constCarrierMode == 0
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:115
-
void startListening(bool resetAddresses=true)
-
bool testCarrier(uint8_t RSSI=65)
-
void setChannel(uint8_t channel)
+
void startListening(bool resetAddresses=true)
+
bool testCarrier(uint8_t RSSI=65)
+
void setChannel(uint8_t channel)
bool begin()
-
void setAutoAck(bool enable)
-
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
+
void setAutoAck(bool enable)
+
void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
diff --git a/html/files.html b/html/files.html index 709947b..dead569 100644 --- a/html/files.html +++ b/html/files.html @@ -108,7 +108,7 @@ diff --git a/html/functions.html b/html/functions.html index 87b2731..7419f1a 100644 --- a/html/functions.html +++ b/html/functions.html @@ -230,7 +230,7 @@

- w -

    diff --git a/html/functions_func.html b/html/functions_func.html index 7d0d846..374a259 100644 --- a/html/functions_func.html +++ b/html/functions_func.html @@ -221,7 +221,7 @@

    - w -

      diff --git a/html/functions_vars.html b/html/functions_vars.html index 0f55cb8..3734766 100644 --- a/html/functions_vars.html +++ b/html/functions_vars.html @@ -112,7 +112,7 @@ diff --git a/html/globals.html b/html/globals.html index 0a48b14..bc552f4 100644 --- a/html/globals.html +++ b/html/globals.html @@ -191,7 +191,7 @@

      - t -

        diff --git a/html/globals_defs.html b/html/globals_defs.html index f30f162..9b3a58c 100644 --- a/html/globals_defs.html +++ b/html/globals_defs.html @@ -133,7 +133,7 @@ diff --git a/html/globals_enum.html b/html/globals_enum.html index ad56c80..42217b6 100644 --- a/html/globals_enum.html +++ b/html/globals_enum.html @@ -112,7 +112,7 @@ diff --git a/html/globals_eval.html b/html/globals_eval.html index dcd1327..a34d8d7 100644 --- a/html/globals_eval.html +++ b/html/globals_eval.html @@ -120,7 +120,7 @@ diff --git a/html/globals_func.html b/html/globals_func.html index b15b403..eac3c0a 100644 --- a/html/globals_func.html +++ b/html/globals_func.html @@ -111,7 +111,7 @@ diff --git a/html/index.html b/html/index.html index 3630acc..94c84ca 100644 --- a/html/index.html +++ b/html/index.html @@ -101,7 +101,7 @@ diff --git a/html/nrf__to__nrf_8cpp.html b/html/nrf__to__nrf_8cpp.html index c1e9561..de27960 100644 --- a/html/nrf__to__nrf_8cpp.html +++ b/html/nrf__to__nrf_8cpp.html @@ -268,7 +268,7 @@

        diff --git a/html/nrf__to__nrf_8cpp_source.html b/html/nrf__to__nrf_8cpp_source.html index b9b4ffa..190e34e 100644 --- a/html/nrf__to__nrf_8cpp_source.html +++ b/html/nrf__to__nrf_8cpp_source.html @@ -416,1237 +416,1238 @@
        294 }
        295 NRF_RADIO->TXADDRESS = txAddress;
        296 startListening(false);
        -
        297 }
        -
        298
        -
        299 // If the packet has the same ID number and data, it is most likely a
        -
        300 // duplicate
        -
        301 if(NRF_RADIO->CRCCNF != 0){ //If CRC enabled, check this data
        -
        302 if (packetCtr == lastPacketCounter && packetData == lastData) {
        -
        303 NRF_RADIO->TASKS_START = 1;
        -
        304 return 0;
        -
        305 }
        +
        297
        +
        298 // If the packet has the same ID number and data, it is most likely a
        +
        299 // duplicate
        +
        300 if(NRF_RADIO->CRCCNF != 0) { //If CRC enabled, check this data
        +
        301 if (packetCtr == lastPacketCounter && packetData == lastData) {
        +
        302 NRF_RADIO->TASKS_START = 1;
        +
        303 return 0;
        +
        304 }
        +
        305 }
        306 }
        -
        307#if defined CCM_ENCRYPTION_ENABLED
        -
        308 if (enableEncryption) {
        -
        309 ccmData.counter = counter;
        -
        310 memcpy(&ccmData.iv[0], &tmpIV[0], CCM_IV_SIZE);
        -
        311 if (DPL) {
        -
        312 if (!decrypt(&rxBuffer[1], rxBuffer[0] - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
        -
        313 Serial.println("DECRYPT FAIL");
        -
        314 NRF_RADIO->TASKS_START = 1;
        -
        315 return 0;
        -
        316 }
        -
        317 }
        -
        318 else {
        -
        319 if (!decrypt(&rxBuffer[1], staticPayloadSize - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
        -
        320 Serial.println("DECRYPT FAIL");
        -
        321 NRF_RADIO->TASKS_START = 1;
        -
        322 return 0;
        -
        323 }
        -
        324 }
        -
        325
        -
        326 memset(&rxBuffer[1], 0, sizeof(rxBuffer) - 1);
        -
        327
        -
        328 if (DPL) {
        -
        329 rxBuffer[0] -= (CCM_MIC_SIZE + CCM_IV_SIZE + CCM_COUNTER_SIZE);
        -
        330 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], rxBuffer[0]);
        -
        331
        -
        332 }
        -
        333 else {
        -
        334 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], staticPayloadSize - (CCM_MIC_SIZE - CCM_IV_SIZE - CCM_COUNTER_SIZE));
        -
        335 }
        -
        336 }
        -
        337#endif
        -
        338 lastPacketCounter = packetCtr;
        -
        339 lastData = packetData;
        -
        340 payloadAvailable = true;
        -
        341 return 1;
        -
        342 }
        -
        343 if(NRF_RADIO->EVENTS_CRCERROR) {
        -
        344 NRF_RADIO->EVENTS_CRCERROR = 0;
        -
        345 NRF_RADIO->TASKS_START = 1;
        -
        346 }
        -
        347 return 0;
        -
        348}
        +
        307
        +
        308#if defined CCM_ENCRYPTION_ENABLED
        +
        309 if (enableEncryption) {
        +
        310 ccmData.counter = counter;
        +
        311 memcpy(&ccmData.iv[0], &tmpIV[0], CCM_IV_SIZE);
        +
        312 if (DPL) {
        +
        313 if (!decrypt(&rxBuffer[1], rxBuffer[0] - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
        +
        314 Serial.println("DECRYPT FAIL");
        +
        315 NRF_RADIO->TASKS_START = 1;
        +
        316 return 0;
        +
        317 }
        +
        318 }
        +
        319 else {
        +
        320 if (!decrypt(&rxBuffer[1], staticPayloadSize - CCM_IV_SIZE - CCM_COUNTER_SIZE)) {
        +
        321 Serial.println("DECRYPT FAIL");
        +
        322 NRF_RADIO->TASKS_START = 1;
        +
        323 return 0;
        +
        324 }
        +
        325 }
        +
        326
        +
        327 memset(&rxBuffer[1], 0, sizeof(rxBuffer) - 1);
        +
        328
        +
        329 if (DPL) {
        +
        330 rxBuffer[0] -= (CCM_MIC_SIZE + CCM_IV_SIZE + CCM_COUNTER_SIZE);
        +
        331 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], rxBuffer[0]);
        +
        332
        +
        333 }
        +
        334 else {
        +
        335 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], staticPayloadSize - (CCM_MIC_SIZE - CCM_IV_SIZE - CCM_COUNTER_SIZE));
        +
        336 }
        +
        337 }
        +
        338#endif
        +
        339 lastPacketCounter = packetCtr;
        +
        340 lastData = packetData;
        +
        341 payloadAvailable = true;
        +
        342 return 1;
        +
        343 }
        +
        344 if(NRF_RADIO->EVENTS_CRCERROR) {
        +
        345 NRF_RADIO->EVENTS_CRCERROR = 0;
        +
        346 NRF_RADIO->TASKS_START = 1;
        +
        347 }
        +
        348 return 0;
        +
        349}
        -
        349
        -
        350/**********************************************************************************************************/
        -
        351
        -
        -
        352void nrf_to_nrf::read(void* buf, uint8_t len)
        -
        353{
        -
        354 memcpy(buf, &rxBuffer[1], len);
        -
        355 ackPayloadAvailable = false;
        -
        356 if (inRxMode) {
        -
        357 NRF_RADIO->TASKS_START = 1;
        -
        358 }
        -
        359 payloadAvailable = false;
        -
        360}
        +
        350
        +
        351/**********************************************************************************************************/
        +
        352
        +
        +
        353void nrf_to_nrf::read(void* buf, uint8_t len)
        +
        354{
        +
        355 memcpy(buf, &rxBuffer[1], len);
        +
        356 ackPayloadAvailable = false;
        +
        357 if (inRxMode) {
        +
        358 NRF_RADIO->TASKS_START = 1;
        +
        359 }
        +
        360 payloadAvailable = false;
        +
        361}
        -
        361
        -
        362/**********************************************************************************************************/
        -
        363
        -
        -
        364bool nrf_to_nrf::write(void* buf, uint8_t len, bool multicast, bool doEncryption)
        -
        365{
        -
        366
        -
        367 uint8_t PID = ackPID;
        -
        368 if (DPL) {
        -
        369 PID = ((ackPID += 1) % 7) << 1;
        -
        370 }
        -
        371 else {
        -
        372 PID = ackPID++;
        -
        373 }
        -
        374 uint8_t payloadSize = 0;
        -
        375
        -
        376#if defined CCM_ENCRYPTION_ENABLED
        -
        377 uint8_t tmpIV[CCM_IV_SIZE];
        -
        378 uint32_t tmpCounter = 0;
        -
        379 uint8_t tmpBuffer[MAX_PACKET_SIZE + CCM_MIC_SIZE + CCM_START_SIZE];
        -
        380
        -
        381 if (enableEncryption && doEncryption) {
        -
        382 if (len) {
        -
        383
        -
        384 for (int i = 0; i < CCM_IV_SIZE; i++) {
        -
        385 while (!NRF_RNG->EVENTS_VALRDY) {}
        -
        386 NRF_RNG->EVENTS_VALRDY = 0;
        -
        387 tmpIV[i] = NRF_RNG->VALUE;
        -
        388 ccmData.iv[i] = tmpIV[i];
        -
        389 }
        -
        390 tmpCounter = packetCounter;
        -
        391 ccmData.counter = tmpCounter;
        -
        392
        -
        393 if (!encrypt(buf, len)) {
        -
        394 return 0;
        -
        395 }
        -
        396
        -
        397 memcpy(tmpBuffer, &outBuffer[CCM_START_SIZE], len + CCM_MIC_SIZE);
        - -
        399 packetCounter++;
        -
        400 if (packetCounter > 200000) {
        -
        401 packetCounter = 0;
        -
        402 }
        -
        403 }
        -
        404 }
        -
        405#endif
        -
        406
        -
        407 for (int i = 0; i < (retries + 1); i++) {
        -
        408 ARC = i;
        -
        409 if (DPL) {
        -
        410 radioData[0] = len;
        -
        411 radioData[1] = PID;
        -
        412 }
        -
        413 else {
        -
        414 radioData[1] = 0;
        -
        415 radioData[0] = PID;
        -
        416 }
        -
        417
        -
        418 uint8_t dataStart = 0;
        -
        419
        -
        420#if defined CCM_ENCRYPTION_ENABLED
        -
        421
        +
        362
        +
        363/**********************************************************************************************************/
        +
        364
        +
        +
        365bool nrf_to_nrf::write(void* buf, uint8_t len, bool multicast, bool doEncryption)
        +
        366{
        +
        367
        +
        368 uint8_t PID = ackPID;
        +
        369 if (DPL) {
        +
        370 PID = ((ackPID += 1) % 7) << 1;
        +
        371 }
        +
        372 else {
        +
        373 PID = ackPID++;
        +
        374 }
        +
        375 uint8_t payloadSize = 0;
        +
        376
        +
        377#if defined CCM_ENCRYPTION_ENABLED
        +
        378 uint8_t tmpIV[CCM_IV_SIZE];
        +
        379 uint32_t tmpCounter = 0;
        +
        380 uint8_t tmpBuffer[MAX_PACKET_SIZE + CCM_MIC_SIZE + CCM_START_SIZE];
        +
        381
        +
        382 if (enableEncryption && doEncryption) {
        +
        383 if (len) {
        +
        384
        +
        385 for (int i = 0; i < CCM_IV_SIZE; i++) {
        +
        386 while (!NRF_RNG->EVENTS_VALRDY) {}
        +
        387 NRF_RNG->EVENTS_VALRDY = 0;
        +
        388 tmpIV[i] = NRF_RNG->VALUE;
        +
        389 ccmData.iv[i] = tmpIV[i];
        +
        390 }
        +
        391 tmpCounter = packetCounter;
        +
        392 ccmData.counter = tmpCounter;
        +
        393
        +
        394 if (!encrypt(buf, len)) {
        +
        395 return 0;
        +
        396 }
        +
        397
        +
        398 memcpy(tmpBuffer, &outBuffer[CCM_START_SIZE], len + CCM_MIC_SIZE);
        + +
        400 packetCounter++;
        +
        401 if (packetCounter > 200000) {
        +
        402 packetCounter = 0;
        +
        403 }
        +
        404 }
        +
        405 }
        +
        406#endif
        +
        407
        +
        408 for (int i = 0; i < (retries + 1); i++) {
        +
        409 ARC = i;
        +
        410 if (DPL) {
        +
        411 radioData[0] = len;
        +
        412 radioData[1] = PID;
        +
        413 }
        +
        414 else {
        +
        415 radioData[1] = 0;
        +
        416 radioData[0] = PID;
        +
        417 }
        +
        418
        +
        419 uint8_t dataStart = 0;
        +
        420
        +
        421#if defined CCM_ENCRYPTION_ENABLED
        422
        423
        -
        424 if (enableEncryption && doEncryption) {
        -
        425 dataStart = (!DPL && acksEnabled(0) == false) ? CCM_IV_SIZE + CCM_COUNTER_SIZE : CCM_IV_SIZE + CCM_COUNTER_SIZE + 2;
        -
        426 }
        -
        427 else {
        -
        428#endif
        -
        429 dataStart = (!DPL && acksEnabled(0) == false) ? 0 : 2;
        -
        430#if defined CCM_ENCRYPTION_ENABLED
        -
        431 }
        -
        432#endif
        -
        433
        -
        434#if defined CCM_ENCRYPTION_ENABLED
        -
        435 if (enableEncryption && doEncryption) {
        -
        436 memcpy(&radioData[dataStart - CCM_COUNTER_SIZE], &tmpCounter, CCM_COUNTER_SIZE);
        -
        437 memcpy(&radioData[dataStart - CCM_IV_SIZE - CCM_COUNTER_SIZE],&tmpIV[0],CCM_IV_SIZE);
        -
        438 memcpy(&radioData[dataStart], &tmpBuffer[0], len - (CCM_IV_SIZE + CCM_COUNTER_SIZE));
        -
        439 }
        -
        440 else {
        -
        441#endif
        -
        442 memcpy(&radioData[dataStart], buf, len);
        -
        443#if defined CCM_ENCRYPTION_ENABLED
        -
        444 }
        -
        445#endif
        -
        446
        -
        447 if (NRF_RADIO->STATE < 9) {
        -
        448 NRF_RADIO->EVENTS_TXREADY = 0;
        -
        449 NRF_RADIO->TASKS_TXEN = 1;
        -
        450 while (NRF_RADIO->EVENTS_TXREADY == 0) {
        -
        451 }
        -
        452 NRF_RADIO->EVENTS_TXREADY = 0;
        -
        453 }
        -
        454
        -
        455 NRF_RADIO->EVENTS_END = 0;
        -
        456 NRF_RADIO->TASKS_START = 1;
        -
        457 while (NRF_RADIO->EVENTS_END == 0) {
        -
        458 }
        -
        459 NRF_RADIO->EVENTS_END = 0;
        -
        460 if (!multicast && acksPerPipe[NRF_RADIO->TXADDRESS] == true) {
        -
        461 uint32_t rxAddress = NRF_RADIO->RXADDRESSES;
        -
        462 NRF_RADIO->RXADDRESSES = 1 << NRF_RADIO->TXADDRESS;
        -
        463 if (!DPL) {
        -
        464 payloadSize = getPayloadSize();
        - -
        466 }
        -
        467 startListening(false);
        -
        468
        -
        469 uint32_t realAckTimeout = ackTimeout;
        -
        470 if (!DPL) {
        -
        471 if (NRF_RADIO->MODE == (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos)) {
        -
        472 realAckTimeout -= ACK_TIMEOUT_1MBPS_OFFSET;
        -
        473 } else if (NRF_RADIO->MODE == (RADIO_MODE_MODE_Nrf_250Kbit << RADIO_MODE_MODE_Pos)) {
        -
        474 realAckTimeout -= ACK_TIMEOUT_250KBPS_OFFSET;
        -
        475 } else {
        -
        476 realAckTimeout -= ACK_TIMEOUT_2MBPS_OFFSET;
        -
        477 }
        -
        478 }else{
        -
        479 if(ackPayloadsEnabled && staticPayloadSize <= DEFAULT_MAX_PAYLOAD_SIZE ){
        -
        480 realAckTimeout += 200;
        -
        481 }else{
        -
        482 realAckTimeout += ACK_PAYLOAD_TIMEOUT_OFFSET;
        -
        483 }
        -
        484 }
        -
        485 uint32_t ack_timeout = micros();
        -
        486 while (!NRF_RADIO->EVENTS_CRCOK && !NRF_RADIO->EVENTS_CRCERROR) {
        -
        487 if (micros() - ack_timeout > realAckTimeout) {
        -
        488 break;
        -
        489 }
        -
        490 }
        -
        491 if (NRF_RADIO->EVENTS_CRCOK) {
        -
        492 if (ackPayloadsEnabled && radioData[0] > 0) {
        -
        493#if defined CCM_ENCRYPTION_ENABLED
        -
        494 if(enableEncryption && doEncryption){
        -
        495 memcpy(&rxBuffer[1], &radioData[2 + CCM_COUNTER_SIZE + CCM_IV_SIZE] , max(0, radioData[0] - CCM_COUNTER_SIZE - CCM_IV_SIZE));
        -
        496 }else{
        -
        497 memcpy(&rxBuffer[1], &radioData[2] , radioData[0]);
        -
        498 }
        -
        499#else
        -
        500 memcpy(&rxBuffer[1], &radioData[2], radioData[0]);
        -
        501#endif
        -
        502
        -
        503#if defined CCM_ENCRYPTION_ENABLED
        -
        504 if (enableEncryption && radioData[0] > 0) {
        -
        505 memcpy(ccmData.iv, &radioData[2], CCM_IV_SIZE);
        -
        506 memcpy(&ccmData.counter, &radioData[2 + CCM_IV_SIZE], CCM_COUNTER_SIZE);
        -
        507
        -
        508 if (!decrypt(&rxBuffer[1], radioData[0])) {
        -
        509 Serial.println("DECRYPT FAIL");
        -
        510 return 0;
        -
        511 }
        - - -
        514 }
        -
        515 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], radioData[0]);
        -
        516 }
        -
        517#endif
        -
        518 rxBuffer[0] = radioData[0];
        -
        519 ackPayloadAvailable = true;
        -
        520 ackAvailablePipeNo = NRF_RADIO->RXMATCH;
        -
        521 }
        -
        522 NRF_RADIO->EVENTS_CRCOK = 0;
        -
        523 stopListening(false, false);
        -
        524 if (!DPL) {
        -
        525 setPayloadSize(payloadSize);
        -
        526 }
        -
        527 NRF_RADIO->RXADDRESSES = rxAddress;
        -
        528 lastTxResult = true;
        -
        529 return 1;
        -
        530 }
        -
        531 else if (NRF_RADIO->EVENTS_CRCERROR) {
        -
        532 NRF_RADIO->EVENTS_CRCERROR = 0;
        -
        533 }
        -
        534 uint32_t duration = 258 * retryDuration;
        -
        535 delayMicroseconds(duration);
        -
        536 stopListening(false, false);
        -
        537 if (!DPL) {
        -
        538 setPayloadSize(payloadSize);
        -
        539 }
        -
        540 NRF_RADIO->RXADDRESSES = rxAddress;
        -
        541 }
        -
        542 else {
        -
        543 lastTxResult = true;
        -
        544 return 1;
        -
        545 }
        -
        546 }
        -
        547 lastTxResult = false;
        -
        548 return 0;
        -
        549}
        +
        424
        +
        425 if (enableEncryption && doEncryption) {
        +
        426 dataStart = (!DPL && acksEnabled(0) == false) ? CCM_IV_SIZE + CCM_COUNTER_SIZE : CCM_IV_SIZE + CCM_COUNTER_SIZE + 2;
        +
        427 }
        +
        428 else {
        +
        429#endif
        +
        430 dataStart = (!DPL && acksEnabled(0) == false) ? 0 : 2;
        +
        431#if defined CCM_ENCRYPTION_ENABLED
        +
        432 }
        +
        433#endif
        +
        434
        +
        435#if defined CCM_ENCRYPTION_ENABLED
        +
        436 if (enableEncryption && doEncryption) {
        +
        437 memcpy(&radioData[dataStart - CCM_COUNTER_SIZE], &tmpCounter, CCM_COUNTER_SIZE);
        +
        438 memcpy(&radioData[dataStart - CCM_IV_SIZE - CCM_COUNTER_SIZE],&tmpIV[0],CCM_IV_SIZE);
        +
        439 memcpy(&radioData[dataStart], &tmpBuffer[0], len - (CCM_IV_SIZE + CCM_COUNTER_SIZE));
        +
        440 }
        +
        441 else {
        +
        442#endif
        +
        443 memcpy(&radioData[dataStart], buf, len);
        +
        444#if defined CCM_ENCRYPTION_ENABLED
        +
        445 }
        +
        446#endif
        +
        447
        +
        448 if (NRF_RADIO->STATE < 9) {
        +
        449 NRF_RADIO->EVENTS_TXREADY = 0;
        +
        450 NRF_RADIO->TASKS_TXEN = 1;
        +
        451 while (NRF_RADIO->EVENTS_TXREADY == 0) {
        +
        452 }
        +
        453 NRF_RADIO->EVENTS_TXREADY = 0;
        +
        454 }
        +
        455
        +
        456 NRF_RADIO->EVENTS_END = 0;
        +
        457 NRF_RADIO->TASKS_START = 1;
        +
        458 while (NRF_RADIO->EVENTS_END == 0) {
        +
        459 }
        +
        460 NRF_RADIO->EVENTS_END = 0;
        +
        461 if (!multicast && acksPerPipe[NRF_RADIO->TXADDRESS] == true) {
        +
        462 uint32_t rxAddress = NRF_RADIO->RXADDRESSES;
        +
        463 NRF_RADIO->RXADDRESSES = 1 << NRF_RADIO->TXADDRESS;
        +
        464 if (!DPL) {
        +
        465 payloadSize = getPayloadSize();
        + +
        467 }
        +
        468 startListening(false);
        +
        469
        +
        470 uint32_t realAckTimeout = ackTimeout;
        +
        471 if (!DPL) {
        +
        472 if (NRF_RADIO->MODE == (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos)) {
        +
        473 realAckTimeout -= ACK_TIMEOUT_1MBPS_OFFSET;
        +
        474 } else if (NRF_RADIO->MODE == (RADIO_MODE_MODE_Nrf_250Kbit << RADIO_MODE_MODE_Pos)) {
        +
        475 realAckTimeout -= ACK_TIMEOUT_250KBPS_OFFSET;
        +
        476 } else {
        +
        477 realAckTimeout -= ACK_TIMEOUT_2MBPS_OFFSET;
        +
        478 }
        +
        479 }else{
        +
        480 if(ackPayloadsEnabled && staticPayloadSize <= DEFAULT_MAX_PAYLOAD_SIZE ){
        +
        481 realAckTimeout += 200;
        +
        482 }else{
        +
        483 realAckTimeout += ACK_PAYLOAD_TIMEOUT_OFFSET;
        +
        484 }
        +
        485 }
        +
        486 uint32_t ack_timeout = micros();
        +
        487 while (!NRF_RADIO->EVENTS_CRCOK && !NRF_RADIO->EVENTS_CRCERROR) {
        +
        488 if (micros() - ack_timeout > realAckTimeout) {
        +
        489 break;
        +
        490 }
        +
        491 }
        +
        492 if (NRF_RADIO->EVENTS_CRCOK) {
        +
        493 if (ackPayloadsEnabled && radioData[0] > 0) {
        +
        494#if defined CCM_ENCRYPTION_ENABLED
        +
        495 if(enableEncryption && doEncryption){
        +
        496 memcpy(&rxBuffer[1], &radioData[2 + CCM_COUNTER_SIZE + CCM_IV_SIZE] , max(0, radioData[0] - CCM_COUNTER_SIZE - CCM_IV_SIZE));
        +
        497 }else{
        +
        498 memcpy(&rxBuffer[1], &radioData[2] , radioData[0]);
        +
        499 }
        +
        500#else
        +
        501 memcpy(&rxBuffer[1], &radioData[2], radioData[0]);
        +
        502#endif
        +
        503
        +
        504#if defined CCM_ENCRYPTION_ENABLED
        +
        505 if (enableEncryption && radioData[0] > 0) {
        +
        506 memcpy(ccmData.iv, &radioData[2], CCM_IV_SIZE);
        +
        507 memcpy(&ccmData.counter, &radioData[2 + CCM_IV_SIZE], CCM_COUNTER_SIZE);
        +
        508
        +
        509 if (!decrypt(&rxBuffer[1], radioData[0])) {
        +
        510 Serial.println("DECRYPT FAIL");
        +
        511 return 0;
        +
        512 }
        + + +
        515 }
        +
        516 memcpy(&rxBuffer[1], &outBuffer[CCM_START_SIZE], radioData[0]);
        +
        517 }
        +
        518#endif
        +
        519 rxBuffer[0] = radioData[0];
        +
        520 ackPayloadAvailable = true;
        +
        521 ackAvailablePipeNo = NRF_RADIO->RXMATCH;
        +
        522 }
        +
        523 NRF_RADIO->EVENTS_CRCOK = 0;
        +
        524 stopListening(false, false);
        +
        525 if (!DPL) {
        +
        526 setPayloadSize(payloadSize);
        +
        527 }
        +
        528 NRF_RADIO->RXADDRESSES = rxAddress;
        +
        529 lastTxResult = true;
        +
        530 return 1;
        +
        531 }
        +
        532 else if (NRF_RADIO->EVENTS_CRCERROR) {
        +
        533 NRF_RADIO->EVENTS_CRCERROR = 0;
        +
        534 }
        +
        535 uint32_t duration = 258 * retryDuration;
        +
        536 delayMicroseconds(duration);
        +
        537 stopListening(false, false);
        +
        538 if (!DPL) {
        +
        539 setPayloadSize(payloadSize);
        +
        540 }
        +
        541 NRF_RADIO->RXADDRESSES = rxAddress;
        +
        542 }
        +
        543 else {
        +
        544 lastTxResult = true;
        +
        545 return 1;
        +
        546 }
        +
        547 }
        +
        548 lastTxResult = false;
        +
        549 return 0;
        +
        550}
        -
        550
        -
        551/**********************************************************************************************************/
        -
        552
        -
        -
        553bool nrf_to_nrf::startWrite(void* buf, uint8_t len, bool multicast, bool doEncryption)
        -
        554{
        -
        555
        +
        551
        +
        552/**********************************************************************************************************/
        +
        553
        +
        +
        554bool nrf_to_nrf::startWrite(void* buf, uint8_t len, bool multicast, bool doEncryption)
        +
        555{
        556
        -
        557 uint8_t PID = ackPID;
        -
        558 if (DPL) {
        -
        559 PID = ((ackPID += 1) % 7) << 1;
        -
        560 }
        -
        561 else {
        -
        562 PID = ackPID++;
        -
        563 }
        -
        564
        -
        565#if defined CCM_ENCRYPTION_ENABLED
        -
        566 uint8_t tmpIV[CCM_IV_SIZE];
        -
        567 uint32_t tmpCounter = 0;
        -
        568 uint8_t tmpBuffer[MAX_PACKET_SIZE + CCM_MIC_SIZE + CCM_START_SIZE];
        -
        569
        -
        570 if (enableEncryption && doEncryption) {
        -
        571 if (len) {
        -
        572
        -
        573 for (int i = 0; i < CCM_IV_SIZE; i++) {
        -
        574 while (!NRF_RNG->EVENTS_VALRDY) {}
        -
        575 NRF_RNG->EVENTS_VALRDY = 0;
        -
        576 tmpIV[i] = NRF_RNG->VALUE;
        -
        577 ccmData.iv[i] = tmpIV[i];
        -
        578 }
        -
        579 tmpCounter = packetCounter;
        -
        580 ccmData.counter = tmpCounter;
        -
        581
        -
        582 if (!encrypt(buf, len)) {
        -
        583 return 0;
        -
        584 }
        -
        585
        -
        586 memcpy(tmpBuffer, &outBuffer[CCM_START_SIZE], len + CCM_MIC_SIZE);
        - -
        588 packetCounter++;
        -
        589 if (packetCounter > 200000) {
        -
        590 packetCounter = 0;
        -
        591 }
        -
        592 }
        -
        593 }
        -
        594#endif
        -
        595
        -
        596 // for (int i = 0; i < retries; i++) {
        -
        597 ARC = 0;
        -
        598 if (DPL) {
        -
        599 radioData[0] = len;
        -
        600 radioData[1] = PID;
        -
        601 }
        -
        602 else {
        -
        603 radioData[1] = 0;
        -
        604 radioData[0] = PID;
        -
        605 }
        -
        606
        -
        607 uint8_t dataStart = 0;
        -
        608
        -
        609#if defined CCM_ENCRYPTION_ENABLED
        -
        610
        +
        557
        +
        558 uint8_t PID = ackPID;
        +
        559 if (DPL) {
        +
        560 PID = ((ackPID += 1) % 7) << 1;
        +
        561 }
        +
        562 else {
        +
        563 PID = ackPID++;
        +
        564 }
        +
        565
        +
        566#if defined CCM_ENCRYPTION_ENABLED
        +
        567 uint8_t tmpIV[CCM_IV_SIZE];
        +
        568 uint32_t tmpCounter = 0;
        +
        569 uint8_t tmpBuffer[MAX_PACKET_SIZE + CCM_MIC_SIZE + CCM_START_SIZE];
        +
        570
        +
        571 if (enableEncryption && doEncryption) {
        +
        572 if (len) {
        +
        573
        +
        574 for (int i = 0; i < CCM_IV_SIZE; i++) {
        +
        575 while (!NRF_RNG->EVENTS_VALRDY) {}
        +
        576 NRF_RNG->EVENTS_VALRDY = 0;
        +
        577 tmpIV[i] = NRF_RNG->VALUE;
        +
        578 ccmData.iv[i] = tmpIV[i];
        +
        579 }
        +
        580 tmpCounter = packetCounter;
        +
        581 ccmData.counter = tmpCounter;
        +
        582
        +
        583 if (!encrypt(buf, len)) {
        +
        584 return 0;
        +
        585 }
        +
        586
        +
        587 memcpy(tmpBuffer, &outBuffer[CCM_START_SIZE], len + CCM_MIC_SIZE);
        + +
        589 packetCounter++;
        +
        590 if (packetCounter > 200000) {
        +
        591 packetCounter = 0;
        +
        592 }
        +
        593 }
        +
        594 }
        +
        595#endif
        +
        596
        +
        597 // for (int i = 0; i < retries; i++) {
        +
        598 ARC = 0;
        +
        599 if (DPL) {
        +
        600 radioData[0] = len;
        +
        601 radioData[1] = PID;
        +
        602 }
        +
        603 else {
        +
        604 radioData[1] = 0;
        +
        605 radioData[0] = PID;
        +
        606 }
        +
        607
        +
        608 uint8_t dataStart = 0;
        +
        609
        +
        610#if defined CCM_ENCRYPTION_ENABLED
        611
        612
        -
        613 if (enableEncryption && doEncryption) {
        -
        614 dataStart = (!DPL && acksEnabled(0) == false) ? CCM_IV_SIZE + CCM_COUNTER_SIZE : CCM_IV_SIZE + CCM_COUNTER_SIZE + 2;
        -
        615 }
        -
        616 else {
        -
        617#endif
        -
        618 dataStart = (!DPL && acksEnabled(0) == false) ? 0 : 2;
        -
        619#if defined CCM_ENCRYPTION_ENABLED
        -
        620 }
        -
        621#endif
        -
        622
        -
        623#if defined CCM_ENCRYPTION_ENABLED
        -
        624 if (enableEncryption && doEncryption) {
        -
        625 memcpy(&radioData[dataStart - CCM_COUNTER_SIZE], &tmpCounter, CCM_COUNTER_SIZE);
        -
        626 memcpy(&radioData[dataStart - CCM_IV_SIZE - CCM_COUNTER_SIZE],&tmpIV[0],CCM_IV_SIZE);
        -
        627 memcpy(&radioData[dataStart], &tmpBuffer[0], len - (CCM_IV_SIZE + CCM_COUNTER_SIZE));
        -
        628 }
        -
        629 else {
        -
        630#endif
        -
        631 memcpy(&radioData[dataStart], buf, len);
        -
        632#if defined CCM_ENCRYPTION_ENABLED
        -
        633 }
        -
        634#endif
        -
        635
        -
        636 if (NRF_RADIO->STATE < 9) {
        -
        637 NRF_RADIO->EVENTS_TXREADY = 0;
        -
        638 NRF_RADIO->TASKS_TXEN = 1;
        -
        639 while (NRF_RADIO->EVENTS_TXREADY == 0) {
        -
        640 }
        -
        641 NRF_RADIO->EVENTS_TXREADY = 0;
        -
        642 }
        -
        643
        -
        644 NRF_RADIO->EVENTS_END = 0;
        -
        645 NRF_RADIO->TASKS_START = 1;
        -
        646 lastTxResult = true;
        -
        647
        -
        648 return true;
        -
        649}
        +
        613
        +
        614 if (enableEncryption && doEncryption) {
        +
        615 dataStart = (!DPL && acksEnabled(0) == false) ? CCM_IV_SIZE + CCM_COUNTER_SIZE : CCM_IV_SIZE + CCM_COUNTER_SIZE + 2;
        +
        616 }
        +
        617 else {
        +
        618#endif
        +
        619 dataStart = (!DPL && acksEnabled(0) == false) ? 0 : 2;
        +
        620#if defined CCM_ENCRYPTION_ENABLED
        +
        621 }
        +
        622#endif
        +
        623
        +
        624#if defined CCM_ENCRYPTION_ENABLED
        +
        625 if (enableEncryption && doEncryption) {
        +
        626 memcpy(&radioData[dataStart - CCM_COUNTER_SIZE], &tmpCounter, CCM_COUNTER_SIZE);
        +
        627 memcpy(&radioData[dataStart - CCM_IV_SIZE - CCM_COUNTER_SIZE],&tmpIV[0],CCM_IV_SIZE);
        +
        628 memcpy(&radioData[dataStart], &tmpBuffer[0], len - (CCM_IV_SIZE + CCM_COUNTER_SIZE));
        +
        629 }
        +
        630 else {
        +
        631#endif
        +
        632 memcpy(&radioData[dataStart], buf, len);
        +
        633#if defined CCM_ENCRYPTION_ENABLED
        +
        634 }
        +
        635#endif
        +
        636
        +
        637 if (NRF_RADIO->STATE < 9) {
        +
        638 NRF_RADIO->EVENTS_TXREADY = 0;
        +
        639 NRF_RADIO->TASKS_TXEN = 1;
        +
        640 while (NRF_RADIO->EVENTS_TXREADY == 0) {
        +
        641 }
        +
        642 NRF_RADIO->EVENTS_TXREADY = 0;
        +
        643 }
        +
        644
        +
        645 NRF_RADIO->EVENTS_END = 0;
        +
        646 NRF_RADIO->TASKS_START = 1;
        +
        647 lastTxResult = true;
        +
        648
        +
        649 return true;
        +
        650}
        -
        650
        -
        651/**********************************************************************************************************/
        -
        652
        -
        -
        653bool nrf_to_nrf::writeAckPayload(uint8_t pipe, void* buf, uint8_t len)
        -
        654{
        -
        655
        -
        656#if defined CCM_ENCRYPTION_ENABLED
        - -
        658 if (len) {
        -
        659
        -
        660 for (int i = 0; i < CCM_IV_SIZE; i++) {
        -
        661 while (!NRF_RNG->EVENTS_VALRDY) {
        -
        662 }
        -
        663 NRF_RNG->EVENTS_VALRDY = 0;
        -
        664 ccmData.iv[i] = NRF_RNG->VALUE;
        -
        665 ackBuffer[i + 1] = ccmData.iv[i];
        -
        666 }
        -
        667
        -
        668 ccmData.counter = packetCounter;
        -
        669 memcpy(&ackBuffer[1 + CCM_IV_SIZE], &ccmData.counter, CCM_COUNTER_SIZE);
        -
        670
        -
        671 if (!encrypt(buf, len)) {
        -
        672 return 0;
        -
        673 }
        -
        674
        - - -
        677 packetCounter++;
        -
        678 if (packetCounter > 200000) {
        -
        679 packetCounter = 0;
        -
        680 }
        -
        681 }
        -
        682 }else{
        -
        683#endif
        -
        684 memcpy(&ackBuffer[1], buf, len);
        -
        685#if defined CCM_ENCRYPTION_ENABLED
        -
        686 }
        -
        687#endif
        -
        688 ackBuffer[0] = len;
        -
        689 ackPipe = pipe;
        -
        690 return true;
        -
        691}
        +
        651
        +
        652/**********************************************************************************************************/
        +
        653
        +
        +
        654bool nrf_to_nrf::writeAckPayload(uint8_t pipe, void* buf, uint8_t len)
        +
        655{
        +
        656
        +
        657#if defined CCM_ENCRYPTION_ENABLED
        + +
        659 if (len) {
        +
        660
        +
        661 for (int i = 0; i < CCM_IV_SIZE; i++) {
        +
        662 while (!NRF_RNG->EVENTS_VALRDY) {
        +
        663 }
        +
        664 NRF_RNG->EVENTS_VALRDY = 0;
        +
        665 ccmData.iv[i] = NRF_RNG->VALUE;
        +
        666 ackBuffer[i + 1] = ccmData.iv[i];
        +
        667 }
        +
        668
        +
        669 ccmData.counter = packetCounter;
        +
        670 memcpy(&ackBuffer[1 + CCM_IV_SIZE], &ccmData.counter, CCM_COUNTER_SIZE);
        +
        671
        +
        672 if (!encrypt(buf, len)) {
        +
        673 return 0;
        +
        674 }
        +
        675
        + + +
        678 packetCounter++;
        +
        679 if (packetCounter > 200000) {
        +
        680 packetCounter = 0;
        +
        681 }
        +
        682 }
        +
        683 }else{
        +
        684#endif
        +
        685 memcpy(&ackBuffer[1], buf, len);
        +
        686#if defined CCM_ENCRYPTION_ENABLED
        +
        687 }
        +
        688#endif
        +
        689 ackBuffer[0] = len;
        +
        690 ackPipe = pipe;
        +
        691 return true;
        +
        692}
        -
        692
        -
        693/**********************************************************************************************************/
        -
        694
        -
        695void nrf_to_nrf::enableAckPayload() { ackPayloadsEnabled = true; }
        -
        696
        -
        697/**********************************************************************************************************/
        -
        698
        -
        699void nrf_to_nrf::disableAckPayload() { ackPayloadsEnabled = false; }
        -
        700
        -
        701/**********************************************************************************************************/
        -
        702
        -
        -
        703void nrf_to_nrf::startListening(bool resetAddresses)
        -
        704{
        -
        705
        -
        706 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        707 NRF_RADIO->TASKS_DISABLE = 1;
        -
        708 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        -
        709 }
        -
        710 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        711 if (resetAddresses == true) {
        -
        712 // Serial.println("rst ad");
        -
        713 NRF_RADIO->BASE0 = rxBase;
        -
        714 NRF_RADIO->PREFIX0 = rxPrefix;
        -
        715 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        -
        716 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        -
        717 }
        -
        718 NRF_RADIO->EVENTS_RXREADY = 0;
        -
        719 NRF_RADIO->EVENTS_CRCOK = 0;
        -
        720 NRF_RADIO->TASKS_RXEN = 1;
        -
        721 inRxMode = true;
        -
        722}
        +
        693
        +
        694/**********************************************************************************************************/
        +
        695
        +
        696void nrf_to_nrf::enableAckPayload() { ackPayloadsEnabled = true; }
        +
        697
        +
        698/**********************************************************************************************************/
        +
        699
        +
        700void nrf_to_nrf::disableAckPayload() { ackPayloadsEnabled = false; }
        +
        701
        +
        702/**********************************************************************************************************/
        +
        703
        +
        +
        704void nrf_to_nrf::startListening(bool resetAddresses)
        +
        705{
        +
        706
        +
        707 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        708 NRF_RADIO->TASKS_DISABLE = 1;
        +
        709 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        +
        710 }
        +
        711 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        712 if (resetAddresses == true) {
        +
        713 // Serial.println("rst ad");
        +
        714 NRF_RADIO->BASE0 = rxBase;
        +
        715 NRF_RADIO->PREFIX0 = rxPrefix;
        +
        716 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        +
        717 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        +
        718 }
        +
        719 NRF_RADIO->EVENTS_RXREADY = 0;
        +
        720 NRF_RADIO->EVENTS_CRCOK = 0;
        +
        721 NRF_RADIO->TASKS_RXEN = 1;
        +
        722 inRxMode = true;
        +
        723}
        -
        723
        -
        724/**********************************************************************************************************/
        -
        725
        -
        -
        726void nrf_to_nrf::stopListening(bool setWritingPipe, bool resetAddresses)
        -
        727{
        -
        728
        -
        729 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        730 NRF_RADIO->TASKS_DISABLE = 1;
        -
        731 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        -
        732 }
        -
        733 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        734 if (resetAddresses) {
        -
        735 NRF_RADIO->BASE0 = txBase;
        -
        736 NRF_RADIO->PREFIX0 = txPrefix;
        -
        737 }
        -
        738 if (setWritingPipe) {
        -
        739 NRF_RADIO->TXADDRESS = 0x00;
        -
        740 }
        -
        741 // NRF_RADIO->EVENTS_TXREADY = 0;
        -
        742 // NRF_RADIO->TASKS_TXEN = 1;
        -
        743 // while (NRF_RADIO->EVENTS_TXREADY == 0);
        -
        744 // NRF_RADIO->EVENTS_TXREADY = 0;
        -
        745 inRxMode = false;
        -
        746}
        +
        724
        +
        725/**********************************************************************************************************/
        +
        726
        +
        +
        727void nrf_to_nrf::stopListening(bool setWritingPipe, bool resetAddresses)
        +
        728{
        +
        729
        +
        730 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        731 NRF_RADIO->TASKS_DISABLE = 1;
        +
        732 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        +
        733 }
        +
        734 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        735 if (resetAddresses) {
        +
        736 NRF_RADIO->BASE0 = txBase;
        +
        737 NRF_RADIO->PREFIX0 = txPrefix;
        +
        738 }
        +
        739 if (setWritingPipe) {
        +
        740 NRF_RADIO->TXADDRESS = 0x00;
        +
        741 }
        +
        742 // NRF_RADIO->EVENTS_TXREADY = 0;
        +
        743 // NRF_RADIO->TASKS_TXEN = 1;
        +
        744 // while (NRF_RADIO->EVENTS_TXREADY == 0);
        +
        745 // NRF_RADIO->EVENTS_TXREADY = 0;
        +
        746 inRxMode = false;
        +
        747}
        -
        747
        -
        748/**********************************************************************************************************/
        -
        749
        -
        - -
        751{
        -
        752 uint8_t size = min(staticPayloadSize, rxBuffer[0]);
        -
        753 return size;
        -
        754}
        +
        748
        +
        749/**********************************************************************************************************/
        +
        750
        +
        + +
        752{
        +
        753 uint8_t size = min(staticPayloadSize, rxBuffer[0]);
        +
        754 return size;
        +
        755}
        -
        755
        -
        756/**********************************************************************************************************/
        -
        757
        -
        - -
        759{
        -
        760
        -
        761 uint32_t freq = NRF_RADIO->FREQUENCY;
        -
        762 NRF_RADIO->FREQUENCY = 0x4C;
        -
        763 if (NRF_RADIO->FREQUENCY == 0x4C) {
        -
        764 NRF_RADIO->FREQUENCY = freq;
        -
        765 return 1;
        -
        766 }
        -
        767 return 0;
        -
        768}
        +
        756
        +
        757/**********************************************************************************************************/
        +
        758
        +
        + +
        760{
        +
        761
        +
        762 uint32_t freq = NRF_RADIO->FREQUENCY;
        +
        763 NRF_RADIO->FREQUENCY = 0x4C;
        +
        764 if (NRF_RADIO->FREQUENCY == 0x4C) {
        +
        765 NRF_RADIO->FREQUENCY = freq;
        +
        766 return 1;
        +
        767 }
        +
        768 return 0;
        +
        769}
        -
        769
        -
        770/**********************************************************************************************************/
        -
        771
        -
        772void nrf_to_nrf::setChannel(uint8_t channel) { NRF_RADIO->FREQUENCY = channel; }
        -
        773
        -
        774/**********************************************************************************************************/
        -
        775
        -
        776uint8_t nrf_to_nrf::getChannel() { return (uint8_t)NRF_RADIO->FREQUENCY; }
        -
        777
        -
        778/**********************************************************************************************************/
        -
        779
        -
        -
        780void nrf_to_nrf::setAutoAck(bool enable)
        -
        781{
        -
        782
        -
        783 for (int i = 0; i < 8; i++) {
        -
        784 acksPerPipe[i] = enable;
        -
        785 }
        -
        786 if (!DPL) {
        -
        787 disableDynamicPayloads(); // Called to re-configure the PCNF0 register
        -
        788 }
        -
        789}
        +
        770
        +
        771/**********************************************************************************************************/
        +
        772
        +
        773void nrf_to_nrf::setChannel(uint8_t channel) { NRF_RADIO->FREQUENCY = channel; }
        +
        774
        +
        775/**********************************************************************************************************/
        +
        776
        +
        777uint8_t nrf_to_nrf::getChannel() { return (uint8_t)NRF_RADIO->FREQUENCY; }
        +
        778
        +
        779/**********************************************************************************************************/
        +
        780
        +
        +
        781void nrf_to_nrf::setAutoAck(bool enable)
        +
        782{
        +
        783
        +
        784 for (int i = 0; i < 8; i++) {
        +
        785 acksPerPipe[i] = enable;
        +
        786 }
        +
        787 if (!DPL) {
        +
        788 disableDynamicPayloads(); // Called to re-configure the PCNF0 register
        +
        789 }
        +
        790}
        -
        790
        -
        791/**********************************************************************************************************/
        -
        792
        -
        -
        793void nrf_to_nrf::setAutoAck(uint8_t pipe, bool enable)
        -
        794{
        -
        795
        -
        796 acksPerPipe[pipe] = enable;
        -
        797 if (!DPL) {
        -
        798 disableDynamicPayloads(); // Called to re-configure the PCNF0 register
        -
        799 }
        -
        800}
        +
        791
        +
        792/**********************************************************************************************************/
        +
        793
        +
        +
        794void nrf_to_nrf::setAutoAck(uint8_t pipe, bool enable)
        +
        795{
        +
        796
        +
        797 acksPerPipe[pipe] = enable;
        +
        798 if (!DPL) {
        +
        799 disableDynamicPayloads(); // Called to re-configure the PCNF0 register
        +
        800 }
        +
        801}
        -
        801
        -
        802/**********************************************************************************************************/
        -
        803
        -
        -
        804void nrf_to_nrf::enableDynamicPayloads(uint8_t payloadSize)
        -
        805{
        -
        806
        -
        807 if (!DPL) {
        -
        808 DPL = true;
        -
        809 staticPayloadSize = payloadSize;
        -
        810
        -
        811 if (payloadSize <= 32) {
        -
        812 NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_S0LEN_Pos) | (6 << RADIO_PCNF0_LFLEN_Pos) | (3 << RADIO_PCNF0_S1LEN_Pos);
        -
        813 }
        -
        814 else {
        -
        815 // Using 8 bits for length
        -
        816 NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_S0LEN_Pos) | (8 << RADIO_PCNF0_LFLEN_Pos) | (3 << RADIO_PCNF0_S1LEN_Pos);
        -
        817 }
        -
        818 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (0 << RADIO_PCNF1_STATLEN_Pos) | (payloadSize << RADIO_PCNF1_MAXLEN_Pos);
        -
        819 }
        -
        820}
        +
        802
        +
        803/**********************************************************************************************************/
        +
        804
        +
        +
        805void nrf_to_nrf::enableDynamicPayloads(uint8_t payloadSize)
        +
        806{
        +
        807
        +
        808 if (!DPL) {
        +
        809 DPL = true;
        +
        810 staticPayloadSize = payloadSize;
        +
        811
        +
        812 if (payloadSize <= 32) {
        +
        813 NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_S0LEN_Pos) | (6 << RADIO_PCNF0_LFLEN_Pos) | (3 << RADIO_PCNF0_S1LEN_Pos);
        +
        814 }
        +
        815 else {
        +
        816 // Using 8 bits for length
        +
        817 NRF_RADIO->PCNF0 = (0 << RADIO_PCNF0_S0LEN_Pos) | (8 << RADIO_PCNF0_LFLEN_Pos) | (3 << RADIO_PCNF0_S1LEN_Pos);
        +
        818 }
        +
        819 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (0 << RADIO_PCNF1_STATLEN_Pos) | (payloadSize << RADIO_PCNF1_MAXLEN_Pos);
        +
        820 }
        +
        821}
        -
        821
        -
        822/**********************************************************************************************************/
        -
        823
        -
        - -
        825{
        -
        826 DPL = false;
        -
        827
        -
        828 uint8_t lenConfig = 0;
        -
        829 if (acksEnabled(0)) {
        -
        830 lenConfig = 1;
        -
        831 }
        -
        832 NRF_RADIO->PCNF0 = (lenConfig << RADIO_PCNF0_S0LEN_Pos) | (0 << RADIO_PCNF0_LFLEN_Pos) | (lenConfig << RADIO_PCNF0_S1LEN_Pos);
        -
        833
        -
        834 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (staticPayloadSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        -
        835}
        +
        822
        +
        823/**********************************************************************************************************/
        +
        824
        +
        + +
        826{
        +
        827 DPL = false;
        +
        828
        +
        829 uint8_t lenConfig = 0;
        +
        830 if (acksEnabled(0)) {
        +
        831 lenConfig = 1;
        +
        832 }
        +
        833 NRF_RADIO->PCNF0 = (lenConfig << RADIO_PCNF0_S0LEN_Pos) | (0 << RADIO_PCNF0_LFLEN_Pos) | (lenConfig << RADIO_PCNF0_S1LEN_Pos);
        +
        834
        +
        835 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (staticPayloadSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        +
        836}
        -
        836
        -
        837/**********************************************************************************************************/
        -
        838
        -
        - -
        840{
        -
        841 staticPayloadSize = size;
        -
        842 DPL = false;
        -
        843
        -
        844 uint8_t lenConfig = 0;
        -
        845 if (acksEnabled(0)) {
        -
        846 lenConfig = 1;
        -
        847 }
        -
        848 NRF_RADIO->PCNF0 = (lenConfig << RADIO_PCNF0_S0LEN_Pos) | (0 << RADIO_PCNF0_LFLEN_Pos) | (lenConfig << RADIO_PCNF0_S1LEN_Pos);
        -
        849
        -
        850 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (staticPayloadSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        -
        851}
        +
        837
        +
        838/**********************************************************************************************************/
        +
        839
        +
        + +
        841{
        +
        842 staticPayloadSize = size;
        +
        843 DPL = false;
        +
        844
        +
        845 uint8_t lenConfig = 0;
        +
        846 if (acksEnabled(0)) {
        +
        847 lenConfig = 1;
        +
        848 }
        +
        849 NRF_RADIO->PCNF0 = (lenConfig << RADIO_PCNF0_S0LEN_Pos) | (0 << RADIO_PCNF0_LFLEN_Pos) | (lenConfig << RADIO_PCNF0_S1LEN_Pos);
        +
        850
        +
        851 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((addressWidth - 1) << RADIO_PCNF1_BALEN_Pos) | (staticPayloadSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        +
        852}
        -
        852
        -
        853/**********************************************************************************************************/
        -
        854
        -
        - -
        856{
        -
        857 return staticPayloadSize;
        -
        858}
        +
        853
        +
        854/**********************************************************************************************************/
        +
        855
        +
        + +
        857{
        +
        858 return staticPayloadSize;
        +
        859}
        -
        859
        -
        860/**********************************************************************************************************/
        -
        861
        -
        -
        862void nrf_to_nrf::setRetries(uint8_t retryVar, uint8_t attempts)
        -
        863{
        -
        864
        -
        865 retries = attempts;
        -
        866 retryDuration = retryVar;
        -
        867}
        +
        860
        +
        861/**********************************************************************************************************/
        +
        862
        +
        +
        863void nrf_to_nrf::setRetries(uint8_t retryVar, uint8_t attempts)
        +
        864{
        +
        865
        +
        866 retries = attempts;
        +
        867 retryDuration = retryVar;
        +
        868}
        -
        868
        -
        869/**********************************************************************************************************/
        -
        870
        -
        -
        871void nrf_to_nrf::openReadingPipe(uint8_t child, uint64_t address)
        -
        872{
        -
        873
        -
        874 // child += 1;
        -
        875 uint32_t base = address >> 8;
        -
        876 uint32_t prefix = address & 0xFF;
        -
        877
        -
        878 base = addrConv32(base);
        -
        879
        -
        880 prefix = addrConv32(address);
        -
        881 prefix = prefix >> 24;
        -
        882
        -
        883 if (!child) {
        -
        884 NRF_RADIO->PREFIX0 = rxPrefix;
        -
        885 NRF_RADIO->BASE0 = base;
        -
        886 NRF_RADIO->PREFIX0 &= ~(0xFF);
        -
        887 NRF_RADIO->PREFIX0 |= prefix;
        -
        888 rxBase = NRF_RADIO->BASE0;
        -
        889 rxPrefix = NRF_RADIO->PREFIX0;
        -
        890 }
        -
        891 else if (child < 4) { // prefixes AP1-3 are in prefix0
        -
        892 NRF_RADIO->PREFIX0 = rxPrefix;
        -
        893 NRF_RADIO->BASE1 = base;
        -
        894 NRF_RADIO->PREFIX0 &= ~(0xFF << (8 * child));
        -
        895 NRF_RADIO->PREFIX0 |= prefix << (8 * child);
        -
        896 rxPrefix = NRF_RADIO->PREFIX0;
        -
        897 }
        -
        898 else {
        -
        899 NRF_RADIO->BASE1 = base;
        -
        900 NRF_RADIO->PREFIX1 &= ~(0xFF << (8 * (child - 4)));
        -
        901 NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4));
        -
        902 }
        -
        903 NRF_RADIO->RXADDRESSES |= 1 << child;
        -
        904
        -
        905 // Serial.println(addrConv32(NRF_RADIO->BASE1),HEX);
        -
        906 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        -
        907 // Serial.println(NRF_RADIO->RXADDRESSES);
        -
        908}
        +
        869
        +
        870/**********************************************************************************************************/
        +
        871
        +
        +
        872void nrf_to_nrf::openReadingPipe(uint8_t child, uint64_t address)
        +
        873{
        +
        874
        +
        875 // child += 1;
        +
        876 uint32_t base = address >> 8;
        +
        877 uint32_t prefix = address & 0xFF;
        +
        878
        +
        879 base = addrConv32(base);
        +
        880
        +
        881 prefix = addrConv32(address);
        +
        882 prefix = prefix >> 24;
        +
        883
        +
        884 if (!child) {
        +
        885 NRF_RADIO->PREFIX0 = rxPrefix;
        +
        886 NRF_RADIO->BASE0 = base;
        +
        887 NRF_RADIO->PREFIX0 &= ~(0xFF);
        +
        888 NRF_RADIO->PREFIX0 |= prefix;
        +
        889 rxBase = NRF_RADIO->BASE0;
        +
        890 rxPrefix = NRF_RADIO->PREFIX0;
        +
        891 }
        +
        892 else if (child < 4) { // prefixes AP1-3 are in prefix0
        +
        893 NRF_RADIO->PREFIX0 = rxPrefix;
        +
        894 NRF_RADIO->BASE1 = base;
        +
        895 NRF_RADIO->PREFIX0 &= ~(0xFF << (8 * child));
        +
        896 NRF_RADIO->PREFIX0 |= prefix << (8 * child);
        +
        897 rxPrefix = NRF_RADIO->PREFIX0;
        +
        898 }
        +
        899 else {
        +
        900 NRF_RADIO->BASE1 = base;
        +
        901 NRF_RADIO->PREFIX1 &= ~(0xFF << (8 * (child - 4)));
        +
        902 NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4));
        +
        903 }
        +
        904 NRF_RADIO->RXADDRESSES |= 1 << child;
        +
        905
        +
        906 // Serial.println(addrConv32(NRF_RADIO->BASE1),HEX);
        +
        907 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        +
        908 // Serial.println(NRF_RADIO->RXADDRESSES);
        +
        909}
        -
        909
        -
        910/**********************************************************************************************************/
        -
        911
        -
        -
        912void nrf_to_nrf::openWritingPipe(uint64_t address)
        -
        913{
        -
        914 uint32_t base = address >> 8;
        -
        915 uint32_t prefix = address & 0xFF;
        -
        916 base = addrConv32(base);
        -
        917
        -
        918 prefix = addrConv32(address);
        -
        919 prefix = prefix >> 24;
        -
        920
        -
        921 NRF_RADIO->BASE0 = base;
        -
        922 NRF_RADIO->PREFIX0 &= 0xFFFFFF00;
        -
        923 NRF_RADIO->PREFIX0 |= prefix;
        -
        924 NRF_RADIO->TXADDRESS = 0x00;
        -
        925 txBase = NRF_RADIO->BASE0;
        -
        926 txPrefix = NRF_RADIO->PREFIX0;
        -
        927 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        -
        928 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        -
        929}
        +
        910
        +
        911/**********************************************************************************************************/
        +
        912
        +
        +
        913void nrf_to_nrf::openWritingPipe(uint64_t address)
        +
        914{
        +
        915 uint32_t base = address >> 8;
        +
        916 uint32_t prefix = address & 0xFF;
        +
        917 base = addrConv32(base);
        +
        918
        +
        919 prefix = addrConv32(address);
        +
        920 prefix = prefix >> 24;
        +
        921
        +
        922 NRF_RADIO->BASE0 = base;
        +
        923 NRF_RADIO->PREFIX0 &= 0xFFFFFF00;
        +
        924 NRF_RADIO->PREFIX0 |= prefix;
        +
        925 NRF_RADIO->TXADDRESS = 0x00;
        +
        926 txBase = NRF_RADIO->BASE0;
        +
        927 txPrefix = NRF_RADIO->PREFIX0;
        +
        928 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        +
        929 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        +
        930}
        -
        930
        -
        931/**********************************************************************************************************/
        -
        932
        -
        -
        933void nrf_to_nrf::openReadingPipe(uint8_t child, const uint8_t* address)
        -
        934{
        -
        935
        -
        936 // child +=1;
        -
        937
        -
        938 uint32_t base = addr_conv(&address[1]);
        -
        939 uint32_t prefix = 0;
        -
        940 uint8_t prefixArray[5];
        -
        941 prefixArray[0] = address[0];
        -
        942 prefix = addr_conv(prefixArray);
        -
        943 prefix = prefix >> 24;
        -
        944
        -
        945 // Using pipes 1-7 for reading pipes, leaving pipe0 for a tx pipe
        -
        946 if (!child) {
        -
        947 NRF_RADIO->PREFIX0 = rxPrefix;
        -
        948 NRF_RADIO->BASE0 = base;
        -
        949 NRF_RADIO->PREFIX0 &= ~(0xFF);
        -
        950 NRF_RADIO->PREFIX0 |= prefix;
        -
        951 rxBase = NRF_RADIO->BASE0;
        -
        952 rxPrefix = NRF_RADIO->PREFIX0;
        -
        953 }
        -
        954 else if (child < 4) { // prefixes AP1-3 are in prefix0
        -
        955 NRF_RADIO->PREFIX0 = rxPrefix;
        -
        956 NRF_RADIO->BASE1 = base;
        -
        957 NRF_RADIO->PREFIX0 &= ~(0xFF << (8 * child));
        -
        958 NRF_RADIO->PREFIX0 |= prefix << (8 * child);
        -
        959 rxPrefix = NRF_RADIO->PREFIX0;
        -
        960 }
        -
        961 else {
        -
        962 NRF_RADIO->BASE1 = base;
        -
        963 NRF_RADIO->PREFIX1 &= ~(0xFF << (8 * (child - 4)));
        -
        964 NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4));
        -
        965 }
        -
        966 NRF_RADIO->RXADDRESSES |= 1 << child;
        -
        967
        -
        968 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        -
        969 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        -
        970 // Serial.println(NRF_RADIO->RXADDRESSES);
        -
        971}
        +
        931
        +
        932/**********************************************************************************************************/
        +
        933
        +
        +
        934void nrf_to_nrf::openReadingPipe(uint8_t child, const uint8_t* address)
        +
        935{
        +
        936
        +
        937 // child +=1;
        +
        938
        +
        939 uint32_t base = addr_conv(&address[1]);
        +
        940 uint32_t prefix = 0;
        +
        941 uint8_t prefixArray[5];
        +
        942 prefixArray[0] = address[0];
        +
        943 prefix = addr_conv(prefixArray);
        +
        944 prefix = prefix >> 24;
        +
        945
        +
        946 // Using pipes 1-7 for reading pipes, leaving pipe0 for a tx pipe
        +
        947 if (!child) {
        +
        948 NRF_RADIO->PREFIX0 = rxPrefix;
        +
        949 NRF_RADIO->BASE0 = base;
        +
        950 NRF_RADIO->PREFIX0 &= ~(0xFF);
        +
        951 NRF_RADIO->PREFIX0 |= prefix;
        +
        952 rxBase = NRF_RADIO->BASE0;
        +
        953 rxPrefix = NRF_RADIO->PREFIX0;
        +
        954 }
        +
        955 else if (child < 4) { // prefixes AP1-3 are in prefix0
        +
        956 NRF_RADIO->PREFIX0 = rxPrefix;
        +
        957 NRF_RADIO->BASE1 = base;
        +
        958 NRF_RADIO->PREFIX0 &= ~(0xFF << (8 * child));
        +
        959 NRF_RADIO->PREFIX0 |= prefix << (8 * child);
        +
        960 rxPrefix = NRF_RADIO->PREFIX0;
        +
        961 }
        +
        962 else {
        +
        963 NRF_RADIO->BASE1 = base;
        +
        964 NRF_RADIO->PREFIX1 &= ~(0xFF << (8 * (child - 4)));
        +
        965 NRF_RADIO->PREFIX1 |= prefix << (8 * (child - 4));
        +
        966 }
        +
        967 NRF_RADIO->RXADDRESSES |= 1 << child;
        +
        968
        +
        969 // Serial.println(addrConv32(NRF_RADIO->BASE0),HEX);
        +
        970 // Serial.println(addrConv32(NRF_RADIO->PREFIX0),HEX);
        +
        971 // Serial.println(NRF_RADIO->RXADDRESSES);
        +
        972}
        -
        972
        -
        973/**********************************************************************************************************/
        -
        974
        -
        -
        975void nrf_to_nrf::openWritingPipe(const uint8_t* address)
        -
        976{
        -
        977
        -
        978 uint32_t base = 0;
        -
        979 uint32_t prefix = 0;
        -
        980
        -
        981 base = addr_conv(&address[1]);
        -
        982 prefix = addr_conv(&address[0]);
        -
        983 prefix = prefix >> 24;
        -
        984
        -
        985 NRF_RADIO->BASE0 = base;
        -
        986 NRF_RADIO->PREFIX0 &= 0xFFFFFF00;
        -
        987 NRF_RADIO->PREFIX0 |= prefix;
        -
        988 NRF_RADIO->TXADDRESS = 0x00;
        -
        989 txBase = NRF_RADIO->BASE0;
        -
        990 txPrefix = NRF_RADIO->PREFIX0;
        -
        991}
        +
        973
        +
        974/**********************************************************************************************************/
        +
        975
        +
        +
        976void nrf_to_nrf::openWritingPipe(const uint8_t* address)
        +
        977{
        +
        978
        +
        979 uint32_t base = 0;
        +
        980 uint32_t prefix = 0;
        +
        981
        +
        982 base = addr_conv(&address[1]);
        +
        983 prefix = addr_conv(&address[0]);
        +
        984 prefix = prefix >> 24;
        +
        985
        +
        986 NRF_RADIO->BASE0 = base;
        +
        987 NRF_RADIO->PREFIX0 &= 0xFFFFFF00;
        +
        988 NRF_RADIO->PREFIX0 |= prefix;
        +
        989 NRF_RADIO->TXADDRESS = 0x00;
        +
        990 txBase = NRF_RADIO->BASE0;
        +
        991 txPrefix = NRF_RADIO->PREFIX0;
        +
        992}
        -
        992
        -
        993/**********************************************************************************************************/
        -
        994
        -
        - -
        996
        -
        997 if(NRF_RADIO->STATE == 11){
        -
        998 while (NRF_RADIO->EVENTS_END == 0) {}
        -
        999 NRF_RADIO->EVENTS_END = 0;
        -
        1000 }
        -
        1001
        -
        1002 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        1003 NRF_RADIO->TASKS_DISABLE = 1;
        -
        1004 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        -
        1005 }
        -
        1006 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        1007
        -
        1008 return lastTxResult;
        -
        1009}
        +
        993
        +
        994/**********************************************************************************************************/
        +
        995
        +
        + +
        997
        +
        998 if(NRF_RADIO->STATE == 11){
        +
        999 while (NRF_RADIO->EVENTS_END == 0) {}
        +
        1000 NRF_RADIO->EVENTS_END = 0;
        +
        1001 }
        +
        1002
        +
        1003 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        1004 NRF_RADIO->TASKS_DISABLE = 1;
        +
        1005 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        +
        1006 }
        +
        1007 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        1008
        +
        1009 return lastTxResult;
        +
        1010}
        -
        1010
        -
        1011/**********************************************************************************************************/
        -
        1012
        -
        -
        1013bool nrf_to_nrf::txStandBy(uint32_t timeout, bool startTx)
        -
        1014{
        -
        1015
        -
        1016 if(NRF_RADIO->STATE == 11){
        -
        1017 while (NRF_RADIO->EVENTS_END == 0) {}
        -
        1018 NRF_RADIO->EVENTS_END = 0;
        -
        1019 }
        -
        1020
        -
        1021 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        1022 NRF_RADIO->TASKS_DISABLE = 1;
        -
        1023 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        -
        1024 }
        -
        1025 NRF_RADIO->EVENTS_DISABLED = 0;
        -
        1026
        -
        1027 return lastTxResult;
        -
        1028}
        +
        1011
        +
        1012/**********************************************************************************************************/
        +
        1013
        +
        +
        1014bool nrf_to_nrf::txStandBy(uint32_t timeout, bool startTx)
        +
        1015{
        +
        1016
        +
        1017 if(NRF_RADIO->STATE == 11){
        +
        1018 while (NRF_RADIO->EVENTS_END == 0) {}
        +
        1019 NRF_RADIO->EVENTS_END = 0;
        +
        1020 }
        +
        1021
        +
        1022 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        1023 NRF_RADIO->TASKS_DISABLE = 1;
        +
        1024 while (NRF_RADIO->EVENTS_DISABLED == 0) {
        +
        1025 }
        +
        1026 NRF_RADIO->EVENTS_DISABLED = 0;
        +
        1027
        +
        1028 return lastTxResult;
        +
        1029}
        -
        1029
        -
        1030/**********************************************************************************************************/
        -
        1031
        -
        -
        1032bool nrf_to_nrf::writeFast(void* buf, uint8_t len, bool multicast)
        -
        1033{
        -
        1034 lastTxResult = write((void*)buf, len, multicast);
        -
        1035 return lastTxResult;
        -
        1036}
        +
        1030
        +
        1031/**********************************************************************************************************/
        +
        1032
        +
        +
        1033bool nrf_to_nrf::writeFast(void* buf, uint8_t len, bool multicast)
        +
        1034{
        +
        1035 lastTxResult = write((void*)buf, len, multicast);
        +
        1036 return lastTxResult;
        +
        1037}
        -
        1037
        -
        1038/**********************************************************************************************************/
        -
        1039
        -
        1040bool nrf_to_nrf::acksEnabled(uint8_t pipe)
        -
        1041{
        -
        1042
        -
        1043 if (acksPerPipe[pipe]) {
        -
        1044 return 1;
        -
        1045 }
        -
        1046 return 0;
        -
        1047}
        -
        1048
        -
        1049/**********************************************************************************************************/
        -
        1050
        - -
        1052
        -
        1053/**********************************************************************************************************/
        -
        1054
        -
        -
        1055bool nrf_to_nrf::setDataRate(uint8_t speed)
        -
        1056{
        -
        1057
        -
        1058 if (speed == NRF_1MBPS) {
        -
        1059 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos);
        -
        1060 ackTimeout = ACK_TIMEOUT_1MBPS;
        -
        1061 }
        -
        1062 else if (speed == NRF_250KBPS) {
        -
        1063 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_250Kbit << RADIO_MODE_MODE_Pos);
        -
        1064 ackTimeout = ACK_TIMEOUT_250KBPS;
        -
        1065 }
        -
        1066 else { // NRF_2MBPS
        -
        1067 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_2Mbit << RADIO_MODE_MODE_Pos);
        -
        1068 ackTimeout = ACK_TIMEOUT_2MBPS;
        -
        1069 }
        -
        1070
        -
        1071 return 1;
        -
        1072}
        +
        1038
        +
        1039/**********************************************************************************************************/
        +
        1040
        +
        1041bool nrf_to_nrf::acksEnabled(uint8_t pipe)
        +
        1042{
        +
        1043
        +
        1044 if (acksPerPipe[pipe]) {
        +
        1045 return 1;
        +
        1046 }
        +
        1047 return 0;
        +
        1048}
        +
        1049
        +
        1050/**********************************************************************************************************/
        +
        1051
        + +
        1053
        +
        1054/**********************************************************************************************************/
        +
        1055
        +
        +
        1056bool nrf_to_nrf::setDataRate(uint8_t speed)
        +
        1057{
        +
        1058
        +
        1059 if (speed == NRF_1MBPS) {
        +
        1060 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos);
        +
        1061 ackTimeout = ACK_TIMEOUT_1MBPS;
        +
        1062 }
        +
        1063 else if (speed == NRF_250KBPS) {
        +
        1064 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_250Kbit << RADIO_MODE_MODE_Pos);
        +
        1065 ackTimeout = ACK_TIMEOUT_250KBPS;
        +
        1066 }
        +
        1067 else { // NRF_2MBPS
        +
        1068 NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_2Mbit << RADIO_MODE_MODE_Pos);
        +
        1069 ackTimeout = ACK_TIMEOUT_2MBPS;
        +
        1070 }
        +
        1071
        +
        1072 return 1;
        +
        1073}
        -
        1073
        -
        1074/**********************************************************************************************************/
        -
        1075
        -
        -
        1076void nrf_to_nrf::setPALevel(uint8_t level, bool lnaEnable)
        -
        1077{
        -
        1078
        -
        1079 uint8_t paLevel = 0x00;
        -
        1080
        -
        1081 if (level == NRF_PA_MIN) {
        -
        1082 paLevel = TXPOWER_PA_MIN;
        -
        1083 }
        -
        1084 else if (level == NRF_PA_LOW) {
        -
        1085 paLevel = TXPOWER_PA_LOW;
        -
        1086 }
        -
        1087 else if (level == NRF_PA_HIGH) {
        -
        1088 paLevel = TXPOWER_PA_HIGH;
        -
        1089 }
        -
        1090 else if (level == NRF_PA_MAX) {
        -
        1091 paLevel = TXPOWER_PA_MAX;
        -
        1092 }
        -
        1093 NRF_RADIO->TXPOWER = paLevel;
        -
        1094}
        +
        1074
        +
        1075/**********************************************************************************************************/
        +
        1076
        +
        +
        1077void nrf_to_nrf::setPALevel(uint8_t level, bool lnaEnable)
        +
        1078{
        +
        1079
        +
        1080 uint8_t paLevel = 0x00;
        +
        1081
        +
        1082 if (level == NRF_PA_MIN) {
        +
        1083 paLevel = TXPOWER_PA_MIN;
        +
        1084 }
        +
        1085 else if (level == NRF_PA_LOW) {
        +
        1086 paLevel = TXPOWER_PA_LOW;
        +
        1087 }
        +
        1088 else if (level == NRF_PA_HIGH) {
        +
        1089 paLevel = TXPOWER_PA_HIGH;
        +
        1090 }
        +
        1091 else if (level == NRF_PA_MAX) {
        +
        1092 paLevel = TXPOWER_PA_MAX;
        +
        1093 }
        +
        1094 NRF_RADIO->TXPOWER = paLevel;
        +
        1095}
        -
        1095
        -
        1096/**********************************************************************************************************/
        -
        1097
        -
        - -
        1099{
        -
        1100
        -
        1101 uint8_t paLevel = NRF_RADIO->TXPOWER;
        -
        1102
        -
        1103 if (paLevel == TXPOWER_PA_MIN) {
        -
        1104 return NRF_PA_MIN;
        -
        1105 }
        -
        1106 else if (paLevel == TXPOWER_PA_LOW) {
        -
        1107 return NRF_PA_LOW;
        -
        1108 }
        -
        1109 else if (paLevel == TXPOWER_PA_HIGH) {
        -
        1110 return NRF_PA_HIGH;
        -
        1111 }
        -
        1112 else if (paLevel == TXPOWER_PA_MAX) {
        -
        1113 return NRF_PA_MAX;
        -
        1114 }
        -
        1115 else {
        -
        1116 return NRF_PA_ERROR;
        -
        1117 }
        -
        1118}
        +
        1096
        +
        1097/**********************************************************************************************************/
        +
        1098
        +
        + +
        1100{
        +
        1101
        +
        1102 uint8_t paLevel = NRF_RADIO->TXPOWER;
        +
        1103
        +
        1104 if (paLevel == TXPOWER_PA_MIN) {
        +
        1105 return NRF_PA_MIN;
        +
        1106 }
        +
        1107 else if (paLevel == TXPOWER_PA_LOW) {
        +
        1108 return NRF_PA_LOW;
        +
        1109 }
        +
        1110 else if (paLevel == TXPOWER_PA_HIGH) {
        +
        1111 return NRF_PA_HIGH;
        +
        1112 }
        +
        1113 else if (paLevel == TXPOWER_PA_MAX) {
        +
        1114 return NRF_PA_MAX;
        +
        1115 }
        +
        1116 else {
        +
        1117 return NRF_PA_ERROR;
        +
        1118 }
        +
        1119}
        -
        1119
        -
        1120/**********************************************************************************************************/
        -
        1121
        -
        - -
        1123{
        -
        1124 return ARC;
        -
        1125}
        +
        1120
        +
        1121/**********************************************************************************************************/
        +
        1122
        +
        + +
        1124{
        +
        1125 return ARC;
        +
        1126}
        -
        1126
        -
        1127/**********************************************************************************************************/
        -
        1128
        -
        - -
        1130{
        -
        1131
        -
        1132 if (length == NRF_CRC_16) {
        -
        1133 NRF_RADIO->CRCCNF = RADIO_CRCCNF_LEN_Two; /* CRC configuration: 16bit */
        -
        1134 NRF_RADIO->CRCINIT = 0xFFFFUL; // Initial value
        -
        1135 NRF_RADIO->CRCPOLY = 0x11021UL; // CRC poly: x^16+x^12^x^5+1
        -
        1136 }
        -
        1137 else if (length == NRF_CRC_8) {
        -
        1138 NRF_RADIO->CRCCNF = RADIO_CRCCNF_LEN_One; /* CRC configuration: 8bit */
        -
        1139 NRF_RADIO->CRCINIT = 0xFFUL;
        -
        1140 NRF_RADIO->CRCPOLY = 0x107UL;
        -
        1141 }
        -
        1142 else {
        -
        1143 NRF_RADIO->CRCCNF = 0; /* CRC configuration: Disabled */
        -
        1144 NRF_RADIO->CRCINIT = 0x00L;
        -
        1145 NRF_RADIO->CRCPOLY = 0x00UL;
        -
        1146 }
        -
        1147}
        +
        1127
        +
        1128/**********************************************************************************************************/
        +
        1129
        +
        + +
        1131{
        +
        1132
        +
        1133 if (length == NRF_CRC_16) {
        +
        1134 NRF_RADIO->CRCCNF = RADIO_CRCCNF_LEN_Two; /* CRC configuration: 16bit */
        +
        1135 NRF_RADIO->CRCINIT = 0xFFFFUL; // Initial value
        +
        1136 NRF_RADIO->CRCPOLY = 0x11021UL; // CRC poly: x^16+x^12^x^5+1
        +
        1137 }
        +
        1138 else if (length == NRF_CRC_8) {
        +
        1139 NRF_RADIO->CRCCNF = RADIO_CRCCNF_LEN_One; /* CRC configuration: 8bit */
        +
        1140 NRF_RADIO->CRCINIT = 0xFFUL;
        +
        1141 NRF_RADIO->CRCPOLY = 0x107UL;
        +
        1142 }
        +
        1143 else {
        +
        1144 NRF_RADIO->CRCCNF = 0; /* CRC configuration: Disabled */
        +
        1145 NRF_RADIO->CRCINIT = 0x00L;
        +
        1146 NRF_RADIO->CRCPOLY = 0x00UL;
        +
        1147 }
        +
        1148}
        -
        1148
        -
        1149/**********************************************************************************************************/
        -
        1150
        -
        - -
        1152{
        -
        1153 if (NRF_RADIO->CRCCNF == 0) {
        -
        1154 return NRF_CRC_DISABLED;
        -
        1155 }
        -
        1156 else if (NRF_RADIO->CRCCNF == RADIO_CRCCNF_LEN_One) {
        -
        1157 return NRF_CRC_8;
        -
        1158 }
        -
        1159 else {
        -
        1160 return NRF_CRC_16;
        -
        1161 }
        -
        1162}
        +
        1149
        +
        1150/**********************************************************************************************************/
        +
        1151
        +
        + +
        1153{
        +
        1154 if (NRF_RADIO->CRCCNF == 0) {
        +
        1155 return NRF_CRC_DISABLED;
        +
        1156 }
        +
        1157 else if (NRF_RADIO->CRCCNF == RADIO_CRCCNF_LEN_One) {
        +
        1158 return NRF_CRC_8;
        +
        1159 }
        +
        1160 else {
        +
        1161 return NRF_CRC_16;
        +
        1162 }
        +
        1163}
        -
        1163
        -
        1164/**********************************************************************************************************/
        -
        1165
        -
        -
        1166bool nrf_to_nrf::testCarrier(uint8_t RSSI)
        -
        1167{
        -
        1168
        -
        1169 NRF_RADIO->EVENTS_RSSIEND = 0;
        -
        1170 NRF_RADIO->TASKS_RSSISTART = 1;
        -
        1171 while (!NRF_RADIO->EVENTS_RSSIEND) {
        -
        1172 }
        -
        1173 if (NRF_RADIO->RSSISAMPLE < RSSI) {
        -
        1174 return 1;
        -
        1175 }
        -
        1176 return 0;
        -
        1177}
        +
        1164
        +
        1165/**********************************************************************************************************/
        +
        1166
        +
        +
        1167bool nrf_to_nrf::testCarrier(uint8_t RSSI)
        +
        1168{
        +
        1169
        +
        1170 NRF_RADIO->EVENTS_RSSIEND = 0;
        +
        1171 NRF_RADIO->TASKS_RSSISTART = 1;
        +
        1172 while (!NRF_RADIO->EVENTS_RSSIEND) {
        +
        1173 }
        +
        1174 if (NRF_RADIO->RSSISAMPLE < RSSI) {
        +
        1175 return 1;
        +
        1176 }
        +
        1177 return 0;
        +
        1178}
        -
        1178
        -
        1179/**********************************************************************************************************/
        -
        1180
        -
        -
        1181bool nrf_to_nrf::testRPD(uint8_t RSSI)
        -
        1182{
        -
        1183 return testCarrier(RSSI);
        -
        1184}
        +
        1179
        +
        1180/**********************************************************************************************************/
        +
        1181
        +
        +
        1182bool nrf_to_nrf::testRPD(uint8_t RSSI)
        +
        1183{
        +
        1184 return testCarrier(RSSI);
        +
        1185}
        -
        1185
        -
        1186/**********************************************************************************************************/
        -
        1187
        -
        - -
        1189{
        -
        1190 radioConfigured = false;
        -
        1191 begin();
        -
        1192}
        +
        1186
        +
        1187/**********************************************************************************************************/
        +
        1188
        +
        + +
        1190{
        +
        1191 radioConfigured = false;
        +
        1192 begin();
        +
        1193}
        -
        1193
        -
        1194/**********************************************************************************************************/
        -
        1195
        -
        - -
        1197{
        -
        1198 DPL = false;
        -
        1199 NRF_RADIO->POWER = 0;
        -
        1200}
        +
        1194
        +
        1195/**********************************************************************************************************/
        +
        1196
        +
        + +
        1198{
        +
        1199 DPL = false;
        +
        1200 NRF_RADIO->POWER = 0;
        +
        1201}
        -
        1201
        -
        1202/**********************************************************************************************************/
        -
        -
        1203void nrf_to_nrf::setAddressWidth(uint8_t a_width)
        -
        1204{
        -
        1205
        -
        1206 addressWidth = a_width;
        -
        1207
        -
        1208 uint8_t pSize = 0;
        -
        1209 if (!DPL) {
        -
        1210 pSize = staticPayloadSize;
        -
        1211 }
        -
        1212
        -
        1213 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((a_width - 1) << RADIO_PCNF1_BALEN_Pos) | (pSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        -
        1214}
        +
        1202
        +
        1203/**********************************************************************************************************/
        +
        +
        1204void nrf_to_nrf::setAddressWidth(uint8_t a_width)
        +
        1205{
        +
        1206
        +
        1207 addressWidth = a_width;
        +
        1208
        +
        1209 uint8_t pSize = 0;
        +
        1210 if (!DPL) {
        +
        1211 pSize = staticPayloadSize;
        +
        1212 }
        +
        1213
        +
        1214 NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | ((a_width - 1) << RADIO_PCNF1_BALEN_Pos) | (pSize << RADIO_PCNF1_STATLEN_Pos) | (staticPayloadSize << RADIO_PCNF1_MAXLEN_Pos);
        +
        1215}
        -
        1215
        -
        1216/**********************************************************************************************************/
        -
        1217
        -
        - -
        1219{
        -
        1220
        -
        1221 Serial.println("================ Radio Configuration ================");
        -
        1222 Serial.print("STATUS\t\t= ");
        -
        1223 Serial.println(NRF_RADIO->STATE);
        -
        1224
        -
        1225 // Serial.println(addrConv32(NRF_RADIO->PREFIX0);
        -
        1226 Serial.print("RX_ADDR_P0-1\t= 0x");
        -
        1227 uint32_t base = addrConv32(NRF_RADIO->BASE0);
        -
        1228 for (int i = addressWidth - 2; i > -1; i--) {
        -
        1229 Serial.print((base >> (i * 8)) & 0xFF, HEX);
        -
        1230 }
        -
        1231 uint32_t prefixes = addrConv32(NRF_RADIO->PREFIX0);
        -
        1232 uint8_t prefix = (prefixes >> 24) & 0xFF;
        -
        1233 Serial.print(prefix, HEX);
        -
        1234 Serial.print(" 0x");
        -
        1235 base = addrConv32(NRF_RADIO->BASE1);
        -
        1236 for (int i = addressWidth - 2; i > -1; i--) {
        -
        1237 Serial.print((base >> (i * 8)) & 0xFF, HEX);
        -
        1238 }
        -
        1239 prefix = (prefixes >> 16) & 0xFF;
        -
        1240 Serial.println(prefix, HEX);
        -
        1241
        -
        1242 Serial.print("RX_ADDR_P2-7\t= 0x");
        -
        1243 prefix = (prefixes >> 8) & 0xFF;
        -
        1244 Serial.print(prefix, HEX);
        -
        1245 Serial.print(" 0x");
        -
        1246 prefix = (prefixes)&0xFF;
        -
        1247 Serial.print(prefix, HEX);
        -
        1248 Serial.print(" 0x");
        -
        1249 prefixes = addrConv32(NRF_RADIO->PREFIX1);
        -
        1250 prefix = (prefixes >> 24) & 0xFF;
        -
        1251 Serial.print(prefix, HEX);
        -
        1252 Serial.print(" 0x");
        -
        1253 prefix = (prefixes >> 16) & 0xFF;
        -
        1254 Serial.print(prefix, HEX);
        -
        1255 Serial.print(" 0x");
        -
        1256 prefix = (prefixes >> 8) & 0xFF;
        -
        1257 Serial.print(prefix, HEX);
        -
        1258 Serial.print(" 0x");
        -
        1259 prefix = (prefixes)&0xFF;
        -
        1260 Serial.println(prefix, HEX);
        -
        1261
        -
        1262 uint8_t enAA = 0;
        -
        1263 for (int i = 0; i < 6; i++) {
        -
        1264 enAA |= acksPerPipe[i] << i;
        -
        1265 }
        -
        1266 Serial.print("EN_AA\t\t= 0x");
        -
        1267 Serial.println(enAA, HEX);
        -
        1268 Serial.print("EN_RXADDR\t= 0x");
        -
        1269 Serial.println(NRF_RADIO->RXADDRESSES, HEX);
        -
        1270 Serial.print("RF_CH\t\t= 0x");
        -
        1271 Serial.println(NRF_RADIO->FREQUENCY, HEX);
        -
        1272 Serial.println("DYNPD/FEATURE\t= 0x");
        -
        1273 Serial.print("Data Rate\t= ");
        -
        1274 Serial.println(NRF_RADIO->MODE ? "2 MBPS" : "1MBPS");
        -
        1275 Serial.println("Model\t\t= NRF52");
        -
        1276 Serial.print("CRC Length\t= ");
        -
        1277 uint8_t crcLen = getCRCLength();
        -
        1278 if (crcLen == NRF_CRC_16) {
        -
        1279 Serial.println("16 bits");
        -
        1280 }
        -
        1281 else if (crcLen == NRF_CRC_8) {
        -
        1282 Serial.println("8 bits");
        -
        1283 }
        -
        1284 else {
        -
        1285 Serial.println("Disabled");
        -
        1286 }
        -
        1287 Serial.print("PA Power\t= ");
        -
        1288 uint8_t paLevel = getPALevel();
        -
        1289 if (paLevel == NRF_PA_MAX) {
        -
        1290 Serial.println("PA_MAX");
        -
        1291 }
        -
        1292 else if (paLevel == NRF_PA_HIGH) {
        -
        1293 Serial.println("PA_HIGH");
        -
        1294 }
        -
        1295 else if (paLevel == NRF_PA_LOW) {
        -
        1296 Serial.println("PA_LOW");
        -
        1297 }
        -
        1298 else if (paLevel == NRF_PA_MIN) {
        -
        1299 Serial.println("PA_MIN");
        -
        1300 }
        -
        1301 else {
        -
        1302 Serial.println("?");
        -
        1303 }
        -
        1304 Serial.print("ARC\t\t= ");
        -
        1305 Serial.println(ARC);
        -
        1306}
        +
        1216
        +
        1217/**********************************************************************************************************/
        +
        1218
        +
        + +
        1220{
        +
        1221
        +
        1222 Serial.println("================ Radio Configuration ================");
        +
        1223 Serial.print("STATUS\t\t= ");
        +
        1224 Serial.println(NRF_RADIO->STATE);
        +
        1225
        +
        1226 // Serial.println(addrConv32(NRF_RADIO->PREFIX0);
        +
        1227 Serial.print("RX_ADDR_P0-1\t= 0x");
        +
        1228 uint32_t base = addrConv32(NRF_RADIO->BASE0);
        +
        1229 for (int i = addressWidth - 2; i > -1; i--) {
        +
        1230 Serial.print((base >> (i * 8)) & 0xFF, HEX);
        +
        1231 }
        +
        1232 uint32_t prefixes = addrConv32(NRF_RADIO->PREFIX0);
        +
        1233 uint8_t prefix = (prefixes >> 24) & 0xFF;
        +
        1234 Serial.print(prefix, HEX);
        +
        1235 Serial.print(" 0x");
        +
        1236 base = addrConv32(NRF_RADIO->BASE1);
        +
        1237 for (int i = addressWidth - 2; i > -1; i--) {
        +
        1238 Serial.print((base >> (i * 8)) & 0xFF, HEX);
        +
        1239 }
        +
        1240 prefix = (prefixes >> 16) & 0xFF;
        +
        1241 Serial.println(prefix, HEX);
        +
        1242
        +
        1243 Serial.print("RX_ADDR_P2-7\t= 0x");
        +
        1244 prefix = (prefixes >> 8) & 0xFF;
        +
        1245 Serial.print(prefix, HEX);
        +
        1246 Serial.print(" 0x");
        +
        1247 prefix = (prefixes)&0xFF;
        +
        1248 Serial.print(prefix, HEX);
        +
        1249 Serial.print(" 0x");
        +
        1250 prefixes = addrConv32(NRF_RADIO->PREFIX1);
        +
        1251 prefix = (prefixes >> 24) & 0xFF;
        +
        1252 Serial.print(prefix, HEX);
        +
        1253 Serial.print(" 0x");
        +
        1254 prefix = (prefixes >> 16) & 0xFF;
        +
        1255 Serial.print(prefix, HEX);
        +
        1256 Serial.print(" 0x");
        +
        1257 prefix = (prefixes >> 8) & 0xFF;
        +
        1258 Serial.print(prefix, HEX);
        +
        1259 Serial.print(" 0x");
        +
        1260 prefix = (prefixes)&0xFF;
        +
        1261 Serial.println(prefix, HEX);
        +
        1262
        +
        1263 uint8_t enAA = 0;
        +
        1264 for (int i = 0; i < 6; i++) {
        +
        1265 enAA |= acksPerPipe[i] << i;
        +
        1266 }
        +
        1267 Serial.print("EN_AA\t\t= 0x");
        +
        1268 Serial.println(enAA, HEX);
        +
        1269 Serial.print("EN_RXADDR\t= 0x");
        +
        1270 Serial.println(NRF_RADIO->RXADDRESSES, HEX);
        +
        1271 Serial.print("RF_CH\t\t= 0x");
        +
        1272 Serial.println(NRF_RADIO->FREQUENCY, HEX);
        +
        1273 Serial.println("DYNPD/FEATURE\t= 0x");
        +
        1274 Serial.print("Data Rate\t= ");
        +
        1275 Serial.println(NRF_RADIO->MODE ? "2 MBPS" : "1MBPS");
        +
        1276 Serial.println("Model\t\t= NRF52");
        +
        1277 Serial.print("CRC Length\t= ");
        +
        1278 uint8_t crcLen = getCRCLength();
        +
        1279 if (crcLen == NRF_CRC_16) {
        +
        1280 Serial.println("16 bits");
        +
        1281 }
        +
        1282 else if (crcLen == NRF_CRC_8) {
        +
        1283 Serial.println("8 bits");
        +
        1284 }
        +
        1285 else {
        +
        1286 Serial.println("Disabled");
        +
        1287 }
        +
        1288 Serial.print("PA Power\t= ");
        +
        1289 uint8_t paLevel = getPALevel();
        +
        1290 if (paLevel == NRF_PA_MAX) {
        +
        1291 Serial.println("PA_MAX");
        +
        1292 }
        +
        1293 else if (paLevel == NRF_PA_HIGH) {
        +
        1294 Serial.println("PA_HIGH");
        +
        1295 }
        +
        1296 else if (paLevel == NRF_PA_LOW) {
        +
        1297 Serial.println("PA_LOW");
        +
        1298 }
        +
        1299 else if (paLevel == NRF_PA_MIN) {
        +
        1300 Serial.println("PA_MIN");
        +
        1301 }
        +
        1302 else {
        +
        1303 Serial.println("?");
        +
        1304 }
        +
        1305 Serial.print("ARC\t\t= ");
        +
        1306 Serial.println(ARC);
        +
        1307}
        -
        1307
        -
        1308/**********************************************************************************************************/
        -
        1309
        -
        1310#if defined CCM_ENCRYPTION_ENABLED
        -
        1311
        -
        -
        1312uint8_t nrf_to_nrf::encrypt(void* bufferIn, uint8_t size)
        -
        1313{
        -
        1314
        -
        1315 if (!size) {
        -
        1316 return 0;
        -
        1317 }
        -
        1318 if (size > MAX_PACKET_SIZE) {
        -
        1319 return 0;
        -
        1320 }
        -
        1321
        -
        1322 inBuffer[0] = 0;
        -
        1323 inBuffer[1] = size;
        -
        1324 inBuffer[2] = 0;
        -
        1325
        -
        1326 memcpy(&inBuffer[CCM_START_SIZE], bufferIn, size);
        -
        1327 memset(outBuffer, 0, sizeof(outBuffer));
        -
        1328
        -
        1329 NRF_CCM->OUTPTR = (uint32_t)outBuffer;
        -
        1330 NRF_CCM->EVENTS_ENDKSGEN = 0;
        -
        1331 NRF_CCM->EVENTS_ENDCRYPT = 0;
        -
        1332 NRF_CCM->TASKS_KSGEN = 1;
        -
        1333 while (!NRF_CCM->EVENTS_ENDCRYPT) {
        -
        1334 };
        -
        1335
        -
        1336 if (NRF_CCM->EVENTS_ERROR) {
        -
        1337 return 0;
        -
        1338 }
        -
        1339 return outBuffer[1];
        -
        1340}
        +
        1308
        +
        1309/**********************************************************************************************************/
        +
        1310
        +
        1311#if defined CCM_ENCRYPTION_ENABLED
        +
        1312
        +
        +
        1313uint8_t nrf_to_nrf::encrypt(void* bufferIn, uint8_t size)
        +
        1314{
        +
        1315
        +
        1316 if (!size) {
        +
        1317 return 0;
        +
        1318 }
        +
        1319 if (size > MAX_PACKET_SIZE) {
        +
        1320 return 0;
        +
        1321 }
        +
        1322
        +
        1323 inBuffer[0] = 0;
        +
        1324 inBuffer[1] = size;
        +
        1325 inBuffer[2] = 0;
        +
        1326
        +
        1327 memcpy(&inBuffer[CCM_START_SIZE], bufferIn, size);
        +
        1328 memset(outBuffer, 0, sizeof(outBuffer));
        +
        1329
        +
        1330 NRF_CCM->OUTPTR = (uint32_t)outBuffer;
        +
        1331 NRF_CCM->EVENTS_ENDKSGEN = 0;
        +
        1332 NRF_CCM->EVENTS_ENDCRYPT = 0;
        +
        1333 NRF_CCM->TASKS_KSGEN = 1;
        +
        1334 while (!NRF_CCM->EVENTS_ENDCRYPT) {
        +
        1335 };
        +
        1336
        +
        1337 if (NRF_CCM->EVENTS_ERROR) {
        +
        1338 return 0;
        +
        1339 }
        +
        1340 return outBuffer[1];
        +
        1341}
        -
        1341
        -
        1342/**********************************************************************************************************/
        -
        1343
        -
        -
        1344uint8_t nrf_to_nrf::decrypt(void* bufferIn, uint8_t size)
        -
        1345{
        -
        1346
        -
        1347 if (!size) {
        -
        1348 return 0;
        -
        1349 }
        -
        1350 if (size > MAX_PACKET_SIZE) {
        -
        1351 return 0;
        -
        1352 }
        -
        1353
        -
        1354 memcpy(&inBuffer[3], bufferIn, size);
        -
        1355
        -
        1356 inBuffer[0] = 0;
        -
        1357 inBuffer[1] = size;
        -
        1358 inBuffer[2] = 0;
        -
        1359
        -
        1360 memset(outBuffer, 0, sizeof(outBuffer));
        -
        1361
        -
        1362 NRF_CCM->EVENTS_ENDKSGEN = 0;
        -
        1363 NRF_CCM->EVENTS_ENDCRYPT = 0;
        -
        1364 NRF_CCM->TASKS_KSGEN = 1;
        -
        1365
        -
        1366 while (!NRF_CCM->EVENTS_ENDCRYPT) {
        -
        1367 };
        -
        1368
        -
        1369 if (NRF_CCM->EVENTS_ERROR) {
        -
        1370 return 0;
        -
        1371 }
        -
        1372 return outBuffer[1];
        -
        1373}
        +
        1342
        +
        1343/**********************************************************************************************************/
        +
        1344
        +
        +
        1345uint8_t nrf_to_nrf::decrypt(void* bufferIn, uint8_t size)
        +
        1346{
        +
        1347
        +
        1348 if (!size) {
        +
        1349 return 0;
        +
        1350 }
        +
        1351 if (size > MAX_PACKET_SIZE) {
        +
        1352 return 0;
        +
        1353 }
        +
        1354
        +
        1355 memcpy(&inBuffer[3], bufferIn, size);
        +
        1356
        +
        1357 inBuffer[0] = 0;
        +
        1358 inBuffer[1] = size;
        +
        1359 inBuffer[2] = 0;
        +
        1360
        +
        1361 memset(outBuffer, 0, sizeof(outBuffer));
        +
        1362
        +
        1363 NRF_CCM->EVENTS_ENDKSGEN = 0;
        +
        1364 NRF_CCM->EVENTS_ENDCRYPT = 0;
        +
        1365 NRF_CCM->TASKS_KSGEN = 1;
        +
        1366
        +
        1367 while (!NRF_CCM->EVENTS_ENDCRYPT) {
        +
        1368 };
        +
        1369
        +
        1370 if (NRF_CCM->EVENTS_ERROR) {
        +
        1371 return 0;
        +
        1372 }
        +
        1373 return outBuffer[1];
        +
        1374}
        -
        1374
        -
        1375/**********************************************************************************************************/
        -
        1376
        -
        - -
        1378{
        -
        1379
        -
        1380 memcpy(ccmData.key, key, CCM_KEY_SIZE);
        -
        1381}
        +
        1375
        +
        1376/**********************************************************************************************************/
        +
        1377
        +
        + +
        1379{
        +
        1380
        +
        1381 memcpy(ccmData.key, key, CCM_KEY_SIZE);
        +
        1382}
        -
        1382
        -
        1383/**********************************************************************************************************/
        -
        1384
        -
        -
        1385void nrf_to_nrf::setCounter(uint64_t counter)
        -
        1386{
        -
        1387
        -
        1388 ccmData.counter = counter;
        -
        1389 packetCounter = counter;
        -
        1390}
        +
        1383
        +
        1384/**********************************************************************************************************/
        +
        1385
        +
        +
        1386void nrf_to_nrf::setCounter(uint64_t counter)
        +
        1387{
        +
        1388
        +
        1389 ccmData.counter = counter;
        +
        1390 packetCounter = counter;
        +
        1391}
        -
        1391/**********************************************************************************************************/
        -
        1392
        -
        - -
        1394
        -
        1395 for(int i=0; i<CCM_IV_SIZE; i++){
        -
        1396 ccmData.iv[i] = IV[i];
        -
        1397 }
        -
        1398}
        +
        1392/**********************************************************************************************************/
        +
        1393
        +
        + +
        1395
        +
        1396 for(int i=0; i<CCM_IV_SIZE; i++){
        +
        1397 ccmData.iv[i] = IV[i];
        +
        1398 }
        +
        1399}
        -
        1399
        1400
        -
        1401#endif // defined CCM_ENCRYPTION_ENABLED
        -
        void startListening(bool resetAddresses=true)
        -
        void openReadingPipe(uint8_t child, const uint8_t *address)
        - +
        1401
        +
        1402#endif // defined CCM_ENCRYPTION_ENABLED
        +
        void startListening(bool resetAddresses=true)
        +
        void openReadingPipe(uint8_t child, const uint8_t *address)
        +
        bool available()
        -
        void setPALevel(uint8_t level, bool lnaEnable=true)
        -
        bool testCarrier(uint8_t RSSI=65)
        -
        bool txStandBy()
        -
        uint8_t decrypt(void *bufferIn, uint8_t size)
        +
        void setPALevel(uint8_t level, bool lnaEnable=true)
        +
        bool testCarrier(uint8_t RSSI=65)
        +
        bool txStandBy()
        +
        uint8_t decrypt(void *bufferIn, uint8_t size)
        uint8_t radioData[ACTUAL_MAX_PAYLOAD_SIZE+2]
        Definition nrf_to_nrf.h:207
        -
        void setChannel(uint8_t channel)
        +
        void setChannel(uint8_t channel)
        uint32_t addrConv32(uint32_t addr)
        -
        void disableDynamicPayloads()
        -
        bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
        -
        bool testRPD(uint8_t RSSI=65)
        -
        void setCounter(uint64_t counter)
        -
        bool isChipConnected()
        -
        void setAddressWidth(uint8_t a_width)
        -
        uint8_t getDynamicPayloadSize()
        -
        bool setDataRate(uint8_t speed)
        -
        bool isValid()
        +
        void disableDynamicPayloads()
        +
        bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
        +
        bool testRPD(uint8_t RSSI=65)
        +
        void setCounter(uint64_t counter)
        +
        bool isChipConnected()
        +
        void setAddressWidth(uint8_t a_width)
        +
        uint8_t getDynamicPayloadSize()
        +
        bool setDataRate(uint8_t speed)
        +
        bool isValid()
        -
        void setKey(uint8_t key[CCM_KEY_SIZE])
        +
        void setKey(uint8_t key[CCM_KEY_SIZE])
        bool begin()
        -
        bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
        +
        bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
        bool enableEncryption
        Definition nrf_to_nrf.h:467
        -
        void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
        -
        void disableAckPayload()
        -
        void powerDown()
        -
        uint8_t getARC()
        -
        uint8_t encrypt(void *bufferIn, uint8_t size)
        -
        void printDetails()
        -
        uint8_t getChannel()
        -
        bool startWrite(void *buf, uint8_t len, bool multicast, bool doEncryption=true)
        +
        void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
        +
        void disableAckPayload()
        +
        void powerDown()
        +
        uint8_t getARC()
        +
        uint8_t encrypt(void *bufferIn, uint8_t size)
        +
        void printDetails()
        +
        uint8_t getChannel()
        +
        bool startWrite(void *buf, uint8_t len, bool multicast, bool doEncryption=true)
        uint8_t outBuffer[MAX_PACKET_SIZE+CCM_MIC_SIZE+CCM_START_SIZE]
        Definition nrf_to_nrf.h:434
        -
        void setRetries(uint8_t retryVar, uint8_t attempts)
        -
        void enableAckPayload()
        -
        void openWritingPipe(const uint8_t *address)
        -
        void setCRCLength(nrf_crclength_e length)
        -
        bool writeFast(void *buf, uint8_t len, bool multicast=0)
        -
        uint8_t getPALevel()
        -
        void setAutoAck(bool enable)
        -
        void read(void *buf, uint8_t len)
        -
        void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
        -
        void setIV(uint8_t IV[CCM_IV_SIZE])
        -
        void setPayloadSize(uint8_t size)
        -
        nrf_crclength_e getCRCLength()
        -
        uint8_t getPayloadSize()
        +
        void setRetries(uint8_t retryVar, uint8_t attempts)
        +
        void enableAckPayload()
        +
        void openWritingPipe(const uint8_t *address)
        +
        void setCRCLength(nrf_crclength_e length)
        +
        bool writeFast(void *buf, uint8_t len, bool multicast=0)
        +
        uint8_t getPALevel()
        +
        void setAutoAck(bool enable)
        +
        void read(void *buf, uint8_t len)
        +
        void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
        +
        void setIV(uint8_t IV[CCM_IV_SIZE])
        +
        void setPayloadSize(uint8_t size)
        +
        nrf_crclength_e getCRCLength()
        +
        uint8_t getPayloadSize()
        #define RADIO_MODE_MODE_Nrf_250Kbit
        #define TXPOWER_PA_MIN
        #define TXPOWER_PA_MAX
        @@ -1684,7 +1685,7 @@
        diff --git a/html/nrf__to__nrf_8h.html b/html/nrf__to__nrf_8h.html index 35dc3d6..3d62c1e 100644 --- a/html/nrf__to__nrf_8h.html +++ b/html/nrf__to__nrf_8h.html @@ -581,7 +581,7 @@

        diff --git a/html/nrf__to__nrf_8h_source.html b/html/nrf__to__nrf_8h_source.html index 91d07fb..3816933 100644 --- a/html/nrf__to__nrf_8h_source.html +++ b/html/nrf__to__nrf_8h_source.html @@ -348,56 +348,56 @@
        515
        575#endif //__nrf52840_nrf24l01_H__
        Driver class for nRF52840 2.4GHz Wireless Transceiver.
        Definition nrf_to_nrf.h:115
        -
        void startListening(bool resetAddresses=true)
        -
        void openReadingPipe(uint8_t child, const uint8_t *address)
        - +
        void startListening(bool resetAddresses=true)
        +
        void openReadingPipe(uint8_t child, const uint8_t *address)
        +
        bool available()
        -
        void setPALevel(uint8_t level, bool lnaEnable=true)
        -
        bool testCarrier(uint8_t RSSI=65)
        -
        bool txStandBy()
        -
        uint8_t decrypt(void *bufferIn, uint8_t size)
        +
        void setPALevel(uint8_t level, bool lnaEnable=true)
        +
        bool testCarrier(uint8_t RSSI=65)
        +
        bool txStandBy()
        +
        uint8_t decrypt(void *bufferIn, uint8_t size)
        uint8_t radioData[ACTUAL_MAX_PAYLOAD_SIZE+2]
        Definition nrf_to_nrf.h:207
        -
        void setChannel(uint8_t channel)
        +
        void setChannel(uint8_t channel)
        uint32_t addrConv32(uint32_t addr)
        -
        void disableDynamicPayloads()
        -
        bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
        -
        bool testRPD(uint8_t RSSI=65)
        -
        void setCounter(uint64_t counter)
        -
        bool isChipConnected()
        -
        void setAddressWidth(uint8_t a_width)
        -
        uint8_t getDynamicPayloadSize()
        -
        bool setDataRate(uint8_t speed)
        -
        bool isValid()
        +
        void disableDynamicPayloads()
        +
        bool write(void *buf, uint8_t len, bool multicast=false, bool doEncryption=true)
        +
        bool testRPD(uint8_t RSSI=65)
        +
        void setCounter(uint64_t counter)
        +
        bool isChipConnected()
        +
        void setAddressWidth(uint8_t a_width)
        +
        uint8_t getDynamicPayloadSize()
        +
        bool setDataRate(uint8_t speed)
        +
        bool isValid()
        void enableDynamicAck()
        -
        void setKey(uint8_t key[CCM_KEY_SIZE])
        +
        void setKey(uint8_t key[CCM_KEY_SIZE])
        bool begin()
        -
        bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
        +
        bool writeAckPayload(uint8_t pipe, void *buf, uint8_t len)
        bool enableEncryption
        Definition nrf_to_nrf.h:467
        -
        void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
        -
        void disableAckPayload()
        +
        void enableDynamicPayloads(uint8_t payloadSize=DEFAULT_MAX_PAYLOAD_SIZE)
        +
        void disableAckPayload()
        void disableCRC()
        -
        void powerDown()
        -
        uint8_t getARC()
        -
        uint8_t encrypt(void *bufferIn, uint8_t size)
        -
        void printDetails()
        -
        uint8_t getChannel()
        -
        bool startWrite(void *buf, uint8_t len, bool multicast, bool doEncryption=true)
        +
        void powerDown()
        +
        uint8_t getARC()
        +
        uint8_t encrypt(void *bufferIn, uint8_t size)
        +
        void printDetails()
        +
        uint8_t getChannel()
        +
        bool startWrite(void *buf, uint8_t len, bool multicast, bool doEncryption=true)
        uint8_t outBuffer[MAX_PACKET_SIZE+CCM_MIC_SIZE+CCM_START_SIZE]
        Definition nrf_to_nrf.h:434
        -
        void setRetries(uint8_t retryVar, uint8_t attempts)
        -
        void enableAckPayload()
        -
        void openWritingPipe(const uint8_t *address)
        -
        void setCRCLength(nrf_crclength_e length)
        +
        void setRetries(uint8_t retryVar, uint8_t attempts)
        +
        void enableAckPayload()
        +
        void openWritingPipe(const uint8_t *address)
        +
        void setCRCLength(nrf_crclength_e length)
        bool failureDetected
        Definition nrf_to_nrf.h:370
        -
        bool writeFast(void *buf, uint8_t len, bool multicast=0)
        -
        uint8_t getPALevel()
        -
        void setAutoAck(bool enable)
        -
        void read(void *buf, uint8_t len)
        -
        void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
        -
        void setIV(uint8_t IV[CCM_IV_SIZE])
        -
        void setPayloadSize(uint8_t size)
        -
        nrf_crclength_e getCRCLength()
        -
        uint8_t getPayloadSize()
        +
        bool writeFast(void *buf, uint8_t len, bool multicast=0)
        +
        uint8_t getPALevel()
        +
        void setAutoAck(bool enable)
        +
        void read(void *buf, uint8_t len)
        +
        void stopListening(bool setWritingPipe=true, bool resetAddresses=true)
        +
        void setIV(uint8_t IV[CCM_IV_SIZE])
        +
        void setPayloadSize(uint8_t size)
        +
        nrf_crclength_e getCRCLength()
        +
        uint8_t getPayloadSize()
        #define CCM_MODE_LENGTH_EXTENDED
        Definition nrf_to_nrf.h:42
        #define DEFAULT_MAX_PAYLOAD_SIZE
        Definition nrf_to_nrf.h:20
        nrf_pa_dbm_e
        Definition nrf_to_nrf.h:46
        @@ -424,7 +424,7 @@

        diff --git a/src/nrf_to_nrf.cpp b/src/nrf_to_nrf.cpp index 174e8ac..6a602f2 100644 --- a/src/nrf_to_nrf.cpp +++ b/src/nrf_to_nrf.cpp @@ -294,16 +294,17 @@ bool nrf_to_nrf::available(uint8_t* pipe_num) } NRF_RADIO->TXADDRESS = txAddress; startListening(false); - } - // If the packet has the same ID number and data, it is most likely a - // duplicate - if(NRF_RADIO->CRCCNF != 0){ //If CRC enabled, check this data - if (packetCtr == lastPacketCounter && packetData == lastData) { - NRF_RADIO->TASKS_START = 1; - return 0; - } + // If the packet has the same ID number and data, it is most likely a + // duplicate + if(NRF_RADIO->CRCCNF != 0) { //If CRC enabled, check this data + if (packetCtr == lastPacketCounter && packetData == lastData) { + NRF_RADIO->TASKS_START = 1; + return 0; + } + } } + #if defined CCM_ENCRYPTION_ENABLED if (enableEncryption) { ccmData.counter = counter;