diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html
index 059d0b84..1900ee8b 100644
--- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html
+++ b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
|
@@ -65,11 +65,11 @@
_ZN13EmulatedRadio10HandleGPIOEv |
- 2932 |
+ 2934 |
_ZN13EmulatedRadio9HandleSPIEh |
- 4192 |
+ 4197 |
diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html
index 17eef934..068b2556 100644
--- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html
+++ b/coverage/extras/test/unit/include/HardwareEmulation.hpp.func.html
@@ -37,7 +37,7 @@
-
+
|
@@ -61,7 +61,7 @@
_ZN13EmulatedRadio10HandleGPIOEv |
- 2932 |
+ 2934 |
_ZN13EmulatedRadio7connectEP13EmulatedPin_tS1_S1_S1_ |
@@ -69,7 +69,7 @@
_ZN13EmulatedRadio9HandleSPIEh |
- 4192 |
+ 4197 |
diff --git a/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html b/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html
index 6ab880d7..e30b5ef8 100644
--- a/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html
+++ b/coverage/extras/test/unit/include/HardwareEmulation.hpp.gcov.html
@@ -37,7 +37,7 @@
-
+
|
@@ -111,15 +111,15 @@
49 4 : this->gpio->func = PIN_GPIO;
50 4 : }
51 :
- 52 4192 : virtual uint8_t HandleSPI(uint8_t b) {
+ 52 4197 : virtual uint8_t HandleSPI(uint8_t b) {
53 : (void)b;
54 : // handle the SPI input and generate output here
- 55 4192 : return(EMULATED_RADIO_SPI_RETURN);
+ 55 4197 : return(EMULATED_RADIO_SPI_RETURN);
56 : }
57 :
- 58 2932 : virtual void HandleGPIO() {
+ 58 2934 : virtual void HandleGPIO() {
59 : // handle discrete GPIO signals here (e.g. reset state machine on NSS falling edge)
- 60 2932 : }
+ 60 2934 : }
61 :
62 : protected:
63 : // pointers to emulated GPIO pins
diff --git a/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html b/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html
index f41297bb..a4bca1b0 100644
--- a/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html
+++ b/coverage/extras/test/unit/include/TestHal.hpp.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
|
@@ -125,35 +125,35 @@
_ZN7TestHal11digitalReadEj |
- 846 |
+ 848 |
_ZN7TestHal6millisEv |
- 846 |
+ 848 |
_ZN7TestHal6microsEv |
- 1462 |
+ 1463 |
_ZN7TestHal11spiTransferEPhmS0_ |
- 1464 |
+ 1465 |
_ZN7TestHal17spiEndTransactionEv |
- 1464 |
+ 1465 |
_ZN7TestHal19spiBeginTransactionEv |
- 1464 |
+ 1465 |
_ZN7TestHal12digitalWriteEjj |
- 2932 |
+ 2934 |
_ZN7TestHal17delayMicrosecondsEm |
- 4615 |
+ 4621 |
diff --git a/coverage/extras/test/unit/include/TestHal.hpp.func.html b/coverage/extras/test/unit/include/TestHal.hpp.func.html
index 91939f68..e0634351 100644
--- a/coverage/extras/test/unit/include/TestHal.hpp.func.html
+++ b/coverage/extras/test/unit/include/TestHal.hpp.func.html
@@ -37,7 +37,7 @@
-
+
|
@@ -65,11 +65,11 @@
_ZN7TestHal11digitalReadEj |
- 846 |
+ 848 |
_ZN7TestHal11spiTransferEPhmS0_ |
- 1464 |
+ 1465 |
_ZN7TestHal12connectRadioEP13EmulatedRadio |
@@ -77,7 +77,7 @@
_ZN7TestHal12digitalWriteEjj |
- 2932 |
+ 2934 |
_ZN7TestHal12spiLogMemcmpEPKvm |
@@ -93,15 +93,15 @@
_ZN7TestHal17delayMicrosecondsEm |
- 4615 |
+ 4621 |
_ZN7TestHal17spiEndTransactionEv |
- 1464 |
+ 1465 |
_ZN7TestHal19spiBeginTransactionEv |
- 1464 |
+ 1465 |
_ZN7TestHal4initEv |
@@ -125,11 +125,11 @@
_ZN7TestHal6microsEv |
- 1462 |
+ 1463 |
_ZN7TestHal6millisEv |
- 846 |
+ 848 |
_ZN7TestHal6noToneEj |
diff --git a/coverage/extras/test/unit/include/TestHal.hpp.gcov.html b/coverage/extras/test/unit/include/TestHal.hpp.gcov.html
index 6fed433e..70d5174d 100644
--- a/coverage/extras/test/unit/include/TestHal.hpp.gcov.html
+++ b/coverage/extras/test/unit/include/TestHal.hpp.gcov.html
@@ -37,7 +37,7 @@
-
+
|
@@ -131,40 +131,40 @@
69 4 : this->gpio[pin].mode = mode;
70 4 : }
71 :
- 72 2932 : void digitalWrite(uint32_t pin, uint32_t value) override {
+ 72 2934 : void digitalWrite(uint32_t pin, uint32_t value) override {
73 : HAL_LOG("TestHal::digitalWrite(pin=" << pin << ", value=" << value << " [" << ((value == TEST_HAL_LOW) ? "LOW" : "HIGH") << "])");
74 :
75 : // check the range
- 76 2932 : BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
+ 76 2934 : BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
77 :
78 : // check it is output
- 79 2932 : BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_OUTPUT, "GPIO is not output!");
+ 79 2934 : BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_OUTPUT, "GPIO is not output!");
80 :
81 : // check known values
- 82 2932 : BOOST_ASSERT_MSG(((value == TEST_HAL_LOW) || (value == TEST_HAL_HIGH)), "Invalid output value");
+ 82 2934 : BOOST_ASSERT_MSG(((value == TEST_HAL_LOW) || (value == TEST_HAL_HIGH)), "Invalid output value");
83 :
84 : // set value
- 85 2932 : this->gpio[pin].value = value;
- 86 2932 : this->gpio[pin].event = true;
- 87 2932 : if(radio) {
- 88 2932 : this->radio->HandleGPIO();
+ 85 2934 : this->gpio[pin].value = value;
+ 86 2934 : this->gpio[pin].event = true;
+ 87 2934 : if(radio) {
+ 88 2934 : this->radio->HandleGPIO();
89 : }
- 90 2932 : this->gpio[pin].event = false;
- 91 2932 : }
+ 90 2934 : this->gpio[pin].event = false;
+ 91 2934 : }
92 :
- 93 846 : uint32_t digitalRead(uint32_t pin) override {
+ 93 848 : uint32_t digitalRead(uint32_t pin) override {
94 : HAL_LOG("TestHal::digitalRead(pin=" << pin << ")");
95 :
96 : // check the range
- 97 846 : BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
+ 97 848 : BOOST_ASSERT_MSG(pin < TEST_HAL_NUM_GPIO_PINS, "Pin number out of range");
98 :
99 : // check it is input
- 100 846 : BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_INPUT, "GPIO is not input");
+ 100 848 : BOOST_ASSERT_MSG(this->gpio[pin].mode == TEST_HAL_INPUT, "GPIO is not input");
101 :
102 : // read the value
- 103 846 : uint32_t value = this->gpio[pin].value;
+ 103 848 : uint32_t value = this->gpio[pin].value;
104 : HAL_LOG("TestHal::digitalRead(pin=" << pin << ")=" << value << " [" << ((value == TEST_HAL_LOW) ? "LOW" : "HIGH") << "]");
- 105 846 : return(value);
+ 105 848 : return(value);
106 : }
107 :
108 0 : void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override {
@@ -196,38 +196,38 @@
134 : HAL_LOG("TestHal::delay(ms=" << ms << ")=" << elapsed.count() << "ms");
135 0 : }
136 :
- 137 4615 : void delayMicroseconds(unsigned long us) override {
+ 137 4621 : void delayMicroseconds(unsigned long us) override {
138 : HAL_LOG("TestHal::delayMicroseconds(us=" << us << ")");
- 139 4615 : const auto start = std::chrono::high_resolution_clock::now();
+ 139 4621 : const auto start = std::chrono::high_resolution_clock::now();
140 :
141 : // busy wait is needed for microseconds precision
- 142 4615 : const auto len = std::chrono::microseconds(us);
- 143 6682903 : while(std::chrono::high_resolution_clock::now() - start < len);
+ 142 4621 : const auto len = std::chrono::microseconds(us);
+ 143 6694366 : while(std::chrono::high_resolution_clock::now() - start < len);
144 :
145 : // measure and print
- 146 4615 : const auto end = std::chrono::high_resolution_clock::now();
- 147 4615 : const std::chrono::duration<double, std::micro> elapsed = end - start;
+ 146 4621 : const auto end = std::chrono::high_resolution_clock::now();
+ 147 4621 : const std::chrono::duration<double, std::micro> elapsed = end - start;
148 : HAL_LOG("TestHal::delayMicroseconds(us=" << us << ")=" << elapsed.count() << "us");
- 149 4615 : }
+ 149 4621 : }
150 :
151 0 : void yield() override {
152 : HAL_LOG("TestHal::yield()");
153 0 : }
154 :
- 155 846 : unsigned long millis() override {
+ 155 848 : unsigned long millis() override {
156 : HAL_LOG("TestHal::millis()");
- 157 846 : std::chrono::time_point now = std::chrono::high_resolution_clock::now();
- 158 846 : auto res = std::chrono::duration_cast<std::chrono::milliseconds>(now - this->start);
+ 157 848 : std::chrono::time_point now = std::chrono::high_resolution_clock::now();
+ 158 848 : auto res = std::chrono::duration_cast<std::chrono::milliseconds>(now - this->start);
159 : HAL_LOG("TestHal::millis()=" << res.count());
- 160 846 : return(res.count());
+ 160 848 : return(res.count());
161 : }
162 :
- 163 1462 : unsigned long micros() override {
+ 163 1463 : unsigned long micros() override {
164 : HAL_LOG("TestHal::micros()");
- 165 1462 : std::chrono::time_point now = std::chrono::high_resolution_clock::now();
- 166 1462 : auto res = std::chrono::duration_cast<std::chrono::microseconds>(now - this->start);
+ 165 1463 : std::chrono::time_point now = std::chrono::high_resolution_clock::now();
+ 166 1463 : auto res = std::chrono::duration_cast<std::chrono::microseconds>(now - this->start);
167 : HAL_LOG("TestHal::micros()=" << res.count());
- 168 1462 : return(res.count());
+ 168 1463 : return(res.count());
169 : }
170 :
171 0 : long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override {
@@ -244,33 +244,33 @@
182 : HAL_LOG("TestHal::spiBegin()");
183 0 : }
184 :
- 185 1464 : void spiBeginTransaction() {
+ 185 1465 : void spiBeginTransaction() {
186 : HAL_LOG("TestHal::spiBeginTransaction()");
- 187 1464 : }
+ 187 1465 : }
188 :
- 189 1464 : void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
+ 189 1465 : void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
190 : HAL_LOG("TestHal::spiTransfer(len=" << len << ")");
191 :
- 192 5656 : for(size_t i = 0; i < len; i++) {
+ 192 5662 : for(size_t i = 0; i < len; i++) {
193 : // append to log
- 194 4192 : (*this->spiLogPtr++) = out[i];
+ 194 4197 : (*this->spiLogPtr++) = out[i];
195 :
196 : // process the SPI byte
- 197 4192 : in[i] = this->radio->HandleSPI(out[i]);
+ 197 4197 : in[i] = this->radio->HandleSPI(out[i]);
198 :
199 : // artificial delay to emulate SPI running at a finite speed
200 : // this is added because timeouts are based on time duration,
201 : // so we need to make sure some time actually elapses
- 202 4192 : this->delayMicroseconds(100);
+ 202 4197 : this->delayMicroseconds(100);
203 :
204 : // output debug
205 : HAL_LOG(fmt::format("out={:#02x}, in={:#02x}", out[i], in[i]));
206 : }
- 207 1464 : }
+ 207 1465 : }
208 :
- 209 1464 : void spiEndTransaction() {
+ 209 1465 : void spiEndTransaction() {
210 : HAL_LOG("TestHal::spiEndTransaction()");
- 211 1464 : }
+ 211 1465 : }
212 :
213 0 : void spiEnd() {
214 : HAL_LOG("TestHal::spiEnd()");
diff --git a/coverage/extras/test/unit/include/index-sort-f.html b/coverage/extras/test/unit/include/index-sort-f.html
index 004b5f72..73bac911 100644
--- a/coverage/extras/test/unit/include/index-sort-f.html
+++ b/coverage/extras/test/unit/include/index-sort-f.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/include/index-sort-l.html b/coverage/extras/test/unit/include/index-sort-l.html
index df9306d7..25ac8be1 100644
--- a/coverage/extras/test/unit/include/index-sort-l.html
+++ b/coverage/extras/test/unit/include/index-sort-l.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/include/index.html b/coverage/extras/test/unit/include/index.html
index 0fca34ed..5ede08fd 100644
--- a/coverage/extras/test/unit/include/index.html
+++ b/coverage/extras/test/unit/include/index.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html b/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html
index 7aebd265..ce9dba4d 100644
--- a/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html
+++ b/coverage/extras/test/unit/tests/TestModule.cpp.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.func.html b/coverage/extras/test/unit/tests/TestModule.cpp.func.html
index d8238211..7574b49b 100644
--- a/coverage/extras/test/unit/tests/TestModule.cpp.func.html
+++ b/coverage/extras/test/unit/tests/TestModule.cpp.func.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html b/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html
index b8517b02..c6921ee6 100644
--- a/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html
+++ b/coverage/extras/test/unit/tests/TestModule.cpp.gcov.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/index-sort-f.html b/coverage/extras/test/unit/tests/index-sort-f.html
index 190cdc6a..21ed1272 100644
--- a/coverage/extras/test/unit/tests/index-sort-f.html
+++ b/coverage/extras/test/unit/tests/index-sort-f.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/index-sort-l.html b/coverage/extras/test/unit/tests/index-sort-l.html
index 2b4884be..9f5f9c12 100644
--- a/coverage/extras/test/unit/tests/index-sort-l.html
+++ b/coverage/extras/test/unit/tests/index-sort-l.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/extras/test/unit/tests/index.html b/coverage/extras/test/unit/tests/index.html
index d3c67f6d..753ba7b9 100644
--- a/coverage/extras/test/unit/tests/index.html
+++ b/coverage/extras/test/unit/tests/index.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/index-sort-f.html b/coverage/index-sort-f.html
index a9c25fa5..672d36e9 100644
--- a/coverage/index-sort-f.html
+++ b/coverage/index-sort-f.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/index-sort-l.html b/coverage/index-sort-l.html
index 1c6fa11e..d3e6a63a 100644
--- a/coverage/index-sort-l.html
+++ b/coverage/index-sort-l.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/index.html b/coverage/index.html
index cadbf3bd..db998735 100644
--- a/coverage/index.html
+++ b/coverage/index.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/Hal.cpp.func-sort-c.html b/coverage/src/Hal.cpp.func-sort-c.html
index 0fa8ee73..2e8d8833 100644
--- a/coverage/src/Hal.cpp.func-sort-c.html
+++ b/coverage/src/Hal.cpp.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/Hal.cpp.func.html b/coverage/src/Hal.cpp.func.html
index 6309d2ea..522c2b24 100644
--- a/coverage/src/Hal.cpp.func.html
+++ b/coverage/src/Hal.cpp.func.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/Hal.cpp.gcov.html b/coverage/src/Hal.cpp.gcov.html
index d811bdb1..7ed0f3dd 100644
--- a/coverage/src/Hal.cpp.gcov.html
+++ b/coverage/src/Hal.cpp.gcov.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/Module.cpp.func-sort-c.html b/coverage/src/Module.cpp.func-sort-c.html
index e352dcf9..64de3045 100644
--- a/coverage/src/Module.cpp.func-sort-c.html
+++ b/coverage/src/Module.cpp.func-sort-c.html
@@ -37,7 +37,7 @@
-
+
|
@@ -141,7 +141,7 @@
_ZN6Module17SPItransferStreamEPKhhbS1_Phmb |
- 423 |
+ 424 |
_ZN6Module11SPItransferEtjPKhPhm |
@@ -149,7 +149,7 @@
_ZN6Module15SPIreadRegisterEj |
- 1454 |
+ 1455 |
diff --git a/coverage/src/Module.cpp.func.html b/coverage/src/Module.cpp.func.html
index d6173ff6..17459de7 100644
--- a/coverage/src/Module.cpp.func.html
+++ b/coverage/src/Module.cpp.func.html
@@ -37,7 +37,7 @@
-
+
|
@@ -93,7 +93,7 @@
_ZN6Module15SPIreadRegisterEj |
- 1454 |
+ 1455 |
_ZN6Module15setRfSwitchPinsEjj |
@@ -113,7 +113,7 @@
_ZN6Module17SPItransferStreamEPKhhbS1_Phmb |
- 423 |
+ 424 |
_ZN6Module19waitForMicrosecondsEmm |
diff --git a/coverage/src/Module.cpp.gcov.html b/coverage/src/Module.cpp.gcov.html
index 1b2e40bf..3d872383 100644
--- a/coverage/src/Module.cpp.gcov.html
+++ b/coverage/src/Module.cpp.gcov.html
@@ -37,7 +37,7 @@
-
+
|
@@ -143,9 +143,9 @@
81 : #if RADIOLIB_DEBUG_SPI
82 : uint8_t readValue = 0x00;
83 : #endif
- 84 1448 : while(this->hal->micros() - start < (checkInterval * 1000)) {
- 85 1440 : uint8_t val = SPIreadRegister(reg);
- 86 1440 : if((val & checkMask) == (newValue & checkMask)) {
+ 84 1449 : while(this->hal->micros() - start < (checkInterval * 1000)) {
+ 85 1441 : uint8_t val = SPIreadRegister(reg);
+ 86 1441 : if((val & checkMask) == (newValue & checkMask)) {
87 : // check passed, we can stop the loop
88 2 : return(RADIOLIB_ERR_NONE);
89 : }
@@ -186,22 +186,22 @@
124 : }
125 0 : }
126 :
- 127 1454 : uint8_t Module::SPIreadRegister(uint32_t reg) {
- 128 1454 : uint8_t resp = 0;
- 129 1454 : if(!spiConfig.stream) {
+ 127 1455 : uint8_t Module::SPIreadRegister(uint32_t reg) {
+ 128 1455 : uint8_t resp = 0;
+ 129 1455 : if(!spiConfig.stream) {
130 1036 : SPItransfer(this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ], reg, NULL, &resp, 1);
131 : } else {
132 : uint8_t cmd[6];
- 133 418 : uint8_t* cmdPtr = cmd;
- 134 836 : for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
- 135 418 : *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] >> 8*i) & 0xFF;
+ 133 419 : uint8_t* cmdPtr = cmd;
+ 134 838 : for(int8_t i = (int8_t)this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 - 1; i >= 0; i--) {
+ 135 419 : *(cmdPtr++) = (this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_READ] >> 8*i) & 0xFF;
136 : }
- 137 1254 : for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
- 138 836 : *(cmdPtr++) = (reg >> 8*i) & 0xFF;
+ 137 1257 : for(int8_t i = (int8_t)((this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8) - 1); i >= 0; i--) {
+ 138 838 : *(cmdPtr++) = (reg >> 8*i) & 0xFF;
139 : }
- 140 418 : SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, false, NULL, &resp, 1, true);
+ 140 419 : SPItransferStream(cmd, this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD]/8 + this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_ADDR]/8, false, NULL, &resp, 1, true);
141 : }
- 142 1454 : return(resp);
+ 142 1455 : return(resp);
143 : }
144 :
145 0 : void Module::SPIwriteRegisterBurst(uint32_t reg, const uint8_t* data, size_t numBytes) {
@@ -377,38 +377,38 @@
315 0 : return(state);
316 : }
317 :
- 318 423 : int16_t Module::SPItransferStream(const uint8_t* cmd, uint8_t cmdLen, bool write, const uint8_t* dataOut, uint8_t* dataIn, size_t numBytes, bool waitForGpio) {
+ 318 424 : int16_t Module::SPItransferStream(const uint8_t* cmd, uint8_t cmdLen, bool write, const uint8_t* dataOut, uint8_t* dataIn, size_t numBytes, bool waitForGpio) {
319 : // prepare the output buffer
- 320 423 : size_t buffLen = cmdLen + numBytes;
- 321 423 : if(!write) {
- 322 418 : buffLen += (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8);
+ 320 424 : size_t buffLen = cmdLen + numBytes;
+ 321 424 : if(!write) {
+ 322 419 : buffLen += (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8);
323 : }
324 : #if RADIOLIB_STATIC_ONLY
325 : uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
326 : #else
- 327 423 : uint8_t* buffOut = new uint8_t[buffLen];
+ 327 424 : uint8_t* buffOut = new uint8_t[buffLen];
328 : #endif
- 329 423 : uint8_t* buffOutPtr = buffOut;
+ 329 424 : uint8_t* buffOutPtr = buffOut;
330 :
331 : // copy the command
- 332 1692 : for(uint8_t n = 0; n < cmdLen; n++) {
- 333 1269 : *(buffOutPtr++) = cmd[n];
+ 332 1696 : for(uint8_t n = 0; n < cmdLen; n++) {
+ 333 1272 : *(buffOutPtr++) = cmd[n];
334 : }
335 :
336 : // copy the data
- 337 423 : if(write) {
+ 337 424 : if(write) {
338 5 : memcpy(buffOutPtr, dataOut, numBytes);
339 : } else {
- 340 418 : memset(buffOutPtr, this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP], numBytes + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8));
+ 340 419 : memset(buffOutPtr, this->spiConfig.cmds[RADIOLIB_MODULE_SPI_COMMAND_NOP], numBytes + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8));
341 : }
342 :
343 : // ensure GPIO is low
- 344 423 : if(waitForGpio) {
- 345 423 : if(this->gpioPin == RADIOLIB_NC) {
+ 344 424 : if(waitForGpio) {
+ 345 424 : if(this->gpioPin == RADIOLIB_NC) {
346 0 : this->hal->delay(50);
347 : } else {
- 348 423 : RadioLibTime_t start = this->hal->millis();
- 349 423 : while(this->hal->digitalRead(this->gpioPin)) {
+ 348 424 : RadioLibTime_t start = this->hal->millis();
+ 349 424 : while(this->hal->digitalRead(this->gpioPin)) {
350 0 : this->hal->yield();
351 :
352 : // this timeout check triggers a false positive from cppcheck
@@ -429,24 +429,24 @@
367 : #if RADIOLIB_STATIC_ONLY
368 : uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
369 : #else
- 370 423 : uint8_t* buffIn = new uint8_t[buffLen];
+ 370 424 : uint8_t* buffIn = new uint8_t[buffLen];
371 : #endif
372 :
373 : // do the transfer
- 374 423 : this->hal->spiBeginTransaction();
- 375 423 : this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
- 376 423 : this->hal->spiTransfer(buffOut, buffLen, buffIn);
- 377 423 : this->hal->digitalWrite(this->csPin, this->hal->GpioLevelHigh);
- 378 423 : this->hal->spiEndTransaction();
+ 374 424 : this->hal->spiBeginTransaction();
+ 375 424 : this->hal->digitalWrite(this->csPin, this->hal->GpioLevelLow);
+ 376 424 : this->hal->spiTransfer(buffOut, buffLen, buffIn);
+ 377 424 : this->hal->digitalWrite(this->csPin, this->hal->GpioLevelHigh);
+ 378 424 : this->hal->spiEndTransaction();
379 :
380 : // wait for GPIO to go high and then low
- 381 423 : if(waitForGpio) {
- 382 423 : if(this->gpioPin == RADIOLIB_NC) {
+ 381 424 : if(waitForGpio) {
+ 382 424 : if(this->gpioPin == RADIOLIB_NC) {
383 0 : this->hal->delay(1);
384 : } else {
- 385 423 : this->hal->delayMicroseconds(1);
- 386 423 : RadioLibTime_t start = this->hal->millis();
- 387 423 : while(this->hal->digitalRead(this->gpioPin)) {
+ 385 424 : this->hal->delayMicroseconds(1);
+ 386 424 : RadioLibTime_t start = this->hal->millis();
+ 387 424 : while(this->hal->digitalRead(this->gpioPin)) {
388 0 : this->hal->yield();
389 :
390 : // this timeout check triggers a false positive from cppcheck
@@ -465,15 +465,15 @@
403 : }
404 :
405 : // parse status
- 406 423 : int16_t state = RADIOLIB_ERR_NONE;
- 407 423 : if((this->spiConfig.parseStatusCb != nullptr) && (numBytes > 0)) {
+ 406 424 : int16_t state = RADIOLIB_ERR_NONE;
+ 407 424 : if((this->spiConfig.parseStatusCb != nullptr) && (numBytes > 0)) {
408 0 : state = this->spiConfig.parseStatusCb(buffIn[this->spiConfig.statusPos]);
409 : }
410 :
411 : // copy the data
- 412 423 : if(!write) {
+ 412 424 : if(!write) {
413 : // skip the status bytes if present
- 414 418 : memcpy(dataIn, &buffIn[cmdLen + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8)], numBytes);
+ 414 419 : memcpy(dataIn, &buffIn[cmdLen + (this->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_STATUS] / 8)], numBytes);
415 : }
416 :
417 : // print debug information
@@ -508,11 +508,11 @@
446 : #endif
447 :
448 : #if !RADIOLIB_STATIC_ONLY
- 449 423 : delete[] buffOut;
- 450 423 : delete[] buffIn;
+ 449 424 : delete[] buffOut;
+ 450 424 : delete[] buffIn;
451 : #endif
452 :
- 453 423 : return(state);
+ 453 424 : return(state);
454 : }
455 :
456 0 : void Module::waitForMicroseconds(RadioLibTime_t start, RadioLibTime_t len) {
diff --git a/coverage/src/index-sort-f.html b/coverage/src/index-sort-f.html
index dc5be16b..a1843116 100644
--- a/coverage/src/index-sort-f.html
+++ b/coverage/src/index-sort-f.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/index-sort-l.html b/coverage/src/index-sort-l.html
index 98409231..400797bc 100644
--- a/coverage/src/index-sort-l.html
+++ b/coverage/src/index-sort-l.html
@@ -37,7 +37,7 @@
-
+
|
diff --git a/coverage/src/index.html b/coverage/src/index.html
index d34d8b12..b4c8b30a 100644
--- a/coverage/src/index.html
+++ b/coverage/src/index.html
@@ -37,7 +37,7 @@
-
+
|