From d7efbb8627efed8f2435622c4558c6aa1f1c1fc1 Mon Sep 17 00:00:00 2001 From: TMRh20 Date: Wed, 3 Jan 2024 11:42:46 +0000 Subject: [PATCH] deploy: bd7a6109850c5c937c863f77d626fc89aa2bfe81 --- 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 | 2402 +++++++++-------- html/nrf__to__nrf_8h.html | 2 +- html/nrf__to__nrf_8h_source.html | 82 +- src/nrf_to_nrf.cpp | 6 +- 33 files changed, 1375 insertions(+), 1367 deletions(-) diff --git a/html/annotated.html b/html/annotated.html index b78ad72..346a95a 100644 --- a/html/annotated.html +++ b/html/annotated.html @@ -107,7 +107,7 @@ diff --git a/html/classes.html b/html/classes.html index c3e5abd..aaeba6f 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 5524a57..b62c3d5 100644 --- a/html/classnrf__to__nrf-members.html +++ b/html/classnrf__to__nrf-members.html @@ -161,7 +161,7 @@ diff --git a/html/classnrf__to__nrf.html b/html/classnrf__to__nrf.html index 7ef15ae..987dac8 100644 --- a/html/classnrf__to__nrf.html +++ b/html/classnrf__to__nrf.html @@ -349,7 +349,7 @@

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

Definition at line 324 of file nrf_to_nrf.cpp.

+

Definition at line 328 of file nrf_to_nrf.cpp.

@@ -385,7 +385,7 @@

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

Definition at line 336 of file nrf_to_nrf.cpp.

+

Definition at line 340 of file nrf_to_nrf.cpp.

@@ -412,7 +412,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 674 of file nrf_to_nrf.cpp.

+

Definition at line 678 of file nrf_to_nrf.cpp.

@@ -444,7 +444,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 697 of file nrf_to_nrf.cpp.

+

Definition at line 701 of file nrf_to_nrf.cpp.

@@ -470,7 +470,7 @@

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

Definition at line 904 of file nrf_to_nrf.cpp.

+

Definition at line 908 of file nrf_to_nrf.cpp.

@@ -492,7 +492,7 @@

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

Definition at line 946 of file nrf_to_nrf.cpp.

+

Definition at line 950 of file nrf_to_nrf.cpp.

@@ -514,7 +514,7 @@

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

Definition at line 1022 of file nrf_to_nrf.cpp.

+

Definition at line 1026 of file nrf_to_nrf.cpp.

@@ -543,7 +543,7 @@

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

-

Definition at line 1003 of file nrf_to_nrf.cpp.

+

Definition at line 1007 of file nrf_to_nrf.cpp.

@@ -579,7 +579,7 @@

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

-

Definition at line 524 of file nrf_to_nrf.cpp.

+

Definition at line 528 of file nrf_to_nrf.cpp.

@@ -610,7 +610,7 @@

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

Definition at line 624 of file nrf_to_nrf.cpp.

+

Definition at line 628 of file nrf_to_nrf.cpp.

@@ -632,7 +632,7 @@

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

Definition at line 666 of file nrf_to_nrf.cpp.

+

Definition at line 670 of file nrf_to_nrf.cpp.

@@ -652,7 +652,7 @@

Same as NRF24

-

Definition at line 670 of file nrf_to_nrf.cpp.

+

Definition at line 674 of file nrf_to_nrf.cpp.

@@ -692,7 +692,7 @@

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

Definition at line 721 of file nrf_to_nrf.cpp.

+

Definition at line 725 of file nrf_to_nrf.cpp.

@@ -712,7 +712,7 @@

Same as NRF24

-

Definition at line 729 of file nrf_to_nrf.cpp.

+

Definition at line 733 of file nrf_to_nrf.cpp.

@@ -734,7 +734,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 743 of file nrf_to_nrf.cpp.

+

Definition at line 747 of file nrf_to_nrf.cpp.

@@ -754,7 +754,7 @@

Same as NRF24

-

Definition at line 747 of file nrf_to_nrf.cpp.

+

Definition at line 751 of file nrf_to_nrf.cpp.

@@ -774,7 +774,7 @@

Supported speeds: NRF_1MBPS NRF_2MBPS

-

Definition at line 1026 of file nrf_to_nrf.cpp.

+

Definition at line 1030 of file nrf_to_nrf.cpp.

@@ -801,7 +801,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 1042 of file nrf_to_nrf.cpp.

+

Definition at line 1046 of file nrf_to_nrf.cpp.

@@ -821,7 +821,7 @@

Same as NRF24

-

Definition at line 1064 of file nrf_to_nrf.cpp.

+

Definition at line 1068 of file nrf_to_nrf.cpp.

@@ -843,7 +843,7 @@

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

Definition at line 751 of file nrf_to_nrf.cpp.

+

Definition at line 755 of file nrf_to_nrf.cpp.

@@ -867,7 +867,7 @@

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

Definition at line 764 of file nrf_to_nrf.cpp.

+

Definition at line 768 of file nrf_to_nrf.cpp.

@@ -895,7 +895,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 775 of file nrf_to_nrf.cpp.

+

Definition at line 779 of file nrf_to_nrf.cpp.

@@ -915,7 +915,7 @@

Same as NRF24

-

Definition at line 795 of file nrf_to_nrf.cpp.

+

Definition at line 799 of file nrf_to_nrf.cpp.

@@ -937,7 +937,7 @@

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

Definition at line 810 of file nrf_to_nrf.cpp.

+

Definition at line 814 of file nrf_to_nrf.cpp.

@@ -959,7 +959,7 @@

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

Definition at line 826 of file nrf_to_nrf.cpp.

+

Definition at line 830 of file nrf_to_nrf.cpp.

@@ -979,7 +979,7 @@

Same as NRF24

-

Definition at line 1095 of file nrf_to_nrf.cpp.

+

Definition at line 1099 of file nrf_to_nrf.cpp.

@@ -999,7 +999,7 @@

Same as NRF24

-

Definition at line 1117 of file nrf_to_nrf.cpp.

+

Definition at line 1121 of file nrf_to_nrf.cpp.

@@ -1041,7 +1041,7 @@

Same as NRF24

-

Definition at line 833 of file nrf_to_nrf.cpp.

+

Definition at line 837 of file nrf_to_nrf.cpp.

@@ -1065,7 +1065,7 @@

Same as NRF24

-

Definition at line 842 of file nrf_to_nrf.cpp.

+

Definition at line 846 of file nrf_to_nrf.cpp.

@@ -1085,7 +1085,7 @@

Same as NRF24

-

Definition at line 883 of file nrf_to_nrf.cpp.

+

Definition at line 887 of file nrf_to_nrf.cpp.

@@ -1105,7 +1105,7 @@

Same as NRF24

-

Definition at line 1169 of file nrf_to_nrf.cpp.

+

Definition at line 1173 of file nrf_to_nrf.cpp.

@@ -1127,7 +1127,7 @@

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

Definition at line 1184 of file nrf_to_nrf.cpp.

+

Definition at line 1188 of file nrf_to_nrf.cpp.

@@ -1147,7 +1147,7 @@

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

-

Definition at line 1154 of file nrf_to_nrf.cpp.

+

Definition at line 1158 of file nrf_to_nrf.cpp.

@@ -1167,7 +1167,7 @@

When called ALL radio settings will be reverted to default

-

Definition at line 1162 of file nrf_to_nrf.cpp.

+

Definition at line 1166 of file nrf_to_nrf.cpp.

@@ -1188,7 +1188,7 @@

Definition at line 966 of file nrf_to_nrf.cpp.

+

Definition at line 970 of file nrf_to_nrf.cpp.

@@ -1213,7 +1213,7 @@

Definition at line 984 of file nrf_to_nrf.cpp.

+

Definition at line 988 of file nrf_to_nrf.cpp.

@@ -1240,7 +1240,7 @@

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

Definition at line 1132 of file nrf_to_nrf.cpp.

+

Definition at line 1136 of file nrf_to_nrf.cpp.

@@ -1265,7 +1265,7 @@

Definition at line 1147 of file nrf_to_nrf.cpp.

+

Definition at line 1151 of file nrf_to_nrf.cpp.

@@ -1285,7 +1285,7 @@

Same as NRF24

-

Definition at line 1088 of file nrf_to_nrf.cpp.

+

Definition at line 1092 of file nrf_to_nrf.cpp.

@@ -1348,7 +1348,7 @@

Function to encrypt data

-

Definition at line 1278 of file nrf_to_nrf.cpp.

+

Definition at line 1282 of file nrf_to_nrf.cpp.

@@ -1372,7 +1372,7 @@

Function to decrypt data

-

Definition at line 1310 of file nrf_to_nrf.cpp.

+

Definition at line 1314 of file nrf_to_nrf.cpp.

@@ -1394,7 +1394,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 1343 of file nrf_to_nrf.cpp.

+

Definition at line 1347 of file nrf_to_nrf.cpp.

@@ -1416,7 +1416,7 @@

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

Definition at line 1351 of file nrf_to_nrf.cpp.

+

Definition at line 1355 of file nrf_to_nrf.cpp.

@@ -1436,7 +1436,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 1359 of file nrf_to_nrf.cpp.

+

Definition at line 1363 of file nrf_to_nrf.cpp.

@@ -1521,7 +1521,7 @@

diff --git a/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index ad46677..f0e926b 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 a0c01f9..c6144b4 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 ee1b09b..0d4d0fb 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:105
-
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 e7900b8..a588dc6 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:105
-
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:455
-
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:40
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 5f8a698..4d19d27 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:105
-
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:40
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 2d94cc3..21d0399 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:105
-
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:455
-
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 27b85c5..99114cb 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:105
-
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:455
-
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 7c6a2ef..10670d5 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:105
-
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 25ea3b4..3bd6ae2 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:105
-
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:455
-
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 265b528..6ad00d5 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:105
-
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 07369ee..ca75da8 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:105
-
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:52
diff --git a/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html b/html/examples_2RF24_2GettingStartedEncryption_2GettingStartedEncryption_8ino-example.html index bd4fe98..3a544e3 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:105
-
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:455
-
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:44
diff --git a/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html b/html/examples_2RF24_2GettingStarted_2GettingStarted_8ino-example.html index 65aabf7..e70f6ae 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:105
-
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:44
diff --git a/html/examples_2RF24_2scanner_2scanner_8ino-example.html b/html/examples_2RF24_2scanner_2scanner_8ino-example.html index 0f5fdb6..17f63aa 100644 --- a/html/examples_2RF24_2scanner_2scanner_8ino-example.html +++ b/html/examples_2RF24_2scanner_2scanner_8ino-example.html @@ -228,17 +228,17 @@
} //If constCarrierMode == 0
}
Driver class for nRF52840 2.4GHz Wireless Transceiver.
Definition nrf_to_nrf.h:105
-
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 f4b9b17..f5ee0de 100644 --- a/html/files.html +++ b/html/files.html @@ -108,7 +108,7 @@ diff --git a/html/functions.html b/html/functions.html index 9862507..4522161 100644 --- a/html/functions.html +++ b/html/functions.html @@ -231,7 +231,7 @@

- w -

    diff --git a/html/functions_func.html b/html/functions_func.html index e3f1388..7bc1a08 100644 --- a/html/functions_func.html +++ b/html/functions_func.html @@ -222,7 +222,7 @@

    - w -

      diff --git a/html/functions_vars.html b/html/functions_vars.html index b474ff2..3244b11 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 9c300d1..162639b 100644 --- a/html/globals.html +++ b/html/globals.html @@ -180,7 +180,7 @@

      - n -

        diff --git a/html/globals_defs.html b/html/globals_defs.html index 7915d80..5ae1c70 100644 --- a/html/globals_defs.html +++ b/html/globals_defs.html @@ -127,7 +127,7 @@ diff --git a/html/globals_enum.html b/html/globals_enum.html index 9a855a5..9ec0b20 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 1b71bb6..943f866 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 b013ff2..7398962 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 db8e1e7..0582477 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 7f01d87..aac11af 100644 --- a/html/nrf__to__nrf_8cpp.html +++ b/html/nrf__to__nrf_8cpp.html @@ -196,7 +196,7 @@

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

        diff --git a/html/nrf__to__nrf_8h_source.html b/html/nrf__to__nrf_8h_source.html index a46ec5c..3bdf82e 100644 --- a/html/nrf__to__nrf_8h_source.html +++ b/html/nrf__to__nrf_8h_source.html @@ -336,57 +336,57 @@
        503
        563#endif //__nrf52840_nrf24l01_H__
        Driver class for nRF52840 2.4GHz Wireless Transceiver.
        Definition nrf_to_nrf.h:105
        -
        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)
        +
        void setPALevel(uint8_t level, bool lnaEnable=true)
        uint8_t sample_ed(void)
        -
        bool testCarrier(uint8_t RSSI=65)
        -
        bool txStandBy()
        -
        uint8_t decrypt(void *bufferIn, uint8_t size)
        +
        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:197
        -
        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:455
        -
        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:422
        -
        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:360
        -
        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:32
        #define DEFAULT_MAX_PAYLOAD_SIZE
        Definition nrf_to_nrf.h:12
        nrf_pa_dbm_e
        Definition nrf_to_nrf.h:36
        @@ -413,7 +413,7 @@

        diff --git a/src/nrf_to_nrf.cpp b/src/nrf_to_nrf.cpp index 2e6845c..ffd3a72 100644 --- a/src/nrf_to_nrf.cpp +++ b/src/nrf_to_nrf.cpp @@ -180,7 +180,11 @@ bool nrf_to_nrf::available(uint8_t* pipe_num) uint32_t counter = 0; uint8_t tmpIV[CCM_IV_SIZE]; NRF_RADIO->EVENTS_CRCOK = 0; - if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 4 && NRF_RADIO->CRCCNF != 0) { + if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 4 && NRF_RADIO->CRCCNF == RADIO_CRCCNF_LEN_Two) { + NRF_RADIO->TASKS_START = 1; + return 0; + }else + if (DPL && radioData[0] > ACTUAL_MAX_PAYLOAD_SIZE - 3 && NRF_RADIO->CRCCNF == RADIO_CRCCNF_LEN_One) { NRF_RADIO->TASKS_START = 1; return 0; }else