From 9e7c0129e6ebe6e026214f2d768abbfbef42ddf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Grome=C5=A1?= Date: Sun, 20 Oct 2024 19:14:33 +0200 Subject: [PATCH] [HAL] HALs in src (#1281) * [HAL] Move HALs to src * [CI] Temporarily drop unofficial STM32 (package down) * [LR11x0] Fix ambiguous call * [CI] Return Maple mini back to build matrix --- examples/NonArduino/ESP-IDF/main/main.cpp | 2 +- examples/NonArduino/Pico/main.cpp | 2 +- examples/NonArduino/Raspberry/main.cpp | 2 +- examples/NonArduino/Tock/main.cpp | 2 +- src/Module.cpp | 2 +- src/RadioLib.h | 2 +- src/{ => hal/Arduino}/ArduinoHal.cpp | 0 src/{ => hal/Arduino}/ArduinoHal.h | 0 .../NonArduino/ESP-IDF/main => src/hal/ESP-IDF}/EspHal.h | 0 {examples/NonArduino/Raspberry => src/hal/RPi}/PiHal.h | 0 {examples/NonArduino/Pico => src/hal/RPiPico}/PicoHal.h | 0 {examples/NonArduino => src/hal}/Tock/libtockHal.h | 0 src/modules/LR11x0/LR11x0.cpp | 4 +++- src/modules/SX126x/STM32WLx_Module.cpp | 2 +- src/protocols/BellModem/BellModem.h | 3 --- src/protocols/ExternalRadio/ExternalRadio.h | 3 --- src/utils/CRC.h | 3 --- src/utils/FEC.h | 3 --- 18 files changed, 10 insertions(+), 20 deletions(-) rename src/{ => hal/Arduino}/ArduinoHal.cpp (100%) rename src/{ => hal/Arduino}/ArduinoHal.h (100%) rename {examples/NonArduino/ESP-IDF/main => src/hal/ESP-IDF}/EspHal.h (100%) rename {examples/NonArduino/Raspberry => src/hal/RPi}/PiHal.h (100%) rename {examples/NonArduino/Pico => src/hal/RPiPico}/PicoHal.h (100%) rename {examples/NonArduino => src/hal}/Tock/libtockHal.h (100%) diff --git a/examples/NonArduino/ESP-IDF/main/main.cpp b/examples/NonArduino/ESP-IDF/main/main.cpp index 9a2272b6e..45e6f75d7 100644 --- a/examples/NonArduino/ESP-IDF/main/main.cpp +++ b/examples/NonArduino/ESP-IDF/main/main.cpp @@ -17,7 +17,7 @@ #include // include the hardware abstraction layer -#include "EspHal.h" +#include "hal/ESP-IDF/EspHal.h" // create a new instance of the HAL class EspHal* hal = new EspHal(5, 19, 27); diff --git a/examples/NonArduino/Pico/main.cpp b/examples/NonArduino/Pico/main.cpp index 28b32251c..c0b007fa4 100644 --- a/examples/NonArduino/Pico/main.cpp +++ b/examples/NonArduino/Pico/main.cpp @@ -41,7 +41,7 @@ #include // include the hardware abstraction layer -#include "PicoHal.h" +#include "hal/RPiPico/PicoHal.h" // create a new instance of the HAL class PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK); diff --git a/examples/NonArduino/Raspberry/main.cpp b/examples/NonArduino/Raspberry/main.cpp index 1dfa60bfc..702b19711 100644 --- a/examples/NonArduino/Raspberry/main.cpp +++ b/examples/NonArduino/Raspberry/main.cpp @@ -18,7 +18,7 @@ #include // include the hardware abstraction layer -#include "PiHal.h" +#include "hal/RPi/PiHal.h" // create a new instance of the HAL class // use SPI channel 1, because on Waveshare LoRaWAN Hat, diff --git a/examples/NonArduino/Tock/main.cpp b/examples/NonArduino/Tock/main.cpp index c8a5628d4..e716d5097 100644 --- a/examples/NonArduino/Tock/main.cpp +++ b/examples/NonArduino/Tock/main.cpp @@ -28,7 +28,7 @@ #include // include the hardware abstraction layer -#include "libtockHal.h" +#include "hal/Tock/libtockHal.h" // the entry point for the program int main(void) { diff --git a/src/Module.cpp b/src/Module.cpp index 33d9c09b4..8cc308d23 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -5,7 +5,7 @@ #include #if defined(RADIOLIB_BUILD_ARDUINO) -#include "ArduinoHal.h" +#include "hal/Arduino/ArduinoHal.h" Module::Module(uint32_t cs, uint32_t irq, uint32_t rst, uint32_t gpio) : csPin(cs), irqPin(irq), rstPin(rst), gpioPin(gpio) { this->hal = new ArduinoHal(); diff --git a/src/RadioLib.h b/src/RadioLib.h index c416180bc..bd6c9598d 100644 --- a/src/RadioLib.h +++ b/src/RadioLib.h @@ -40,7 +40,7 @@ #include "Hal.h" #if defined(RADIOLIB_BUILD_ARDUINO) -#include "ArduinoHal.h" +#include "hal/Arduino/ArduinoHal.h" #endif diff --git a/src/ArduinoHal.cpp b/src/hal/Arduino/ArduinoHal.cpp similarity index 100% rename from src/ArduinoHal.cpp rename to src/hal/Arduino/ArduinoHal.cpp diff --git a/src/ArduinoHal.h b/src/hal/Arduino/ArduinoHal.h similarity index 100% rename from src/ArduinoHal.h rename to src/hal/Arduino/ArduinoHal.h diff --git a/examples/NonArduino/ESP-IDF/main/EspHal.h b/src/hal/ESP-IDF/EspHal.h similarity index 100% rename from examples/NonArduino/ESP-IDF/main/EspHal.h rename to src/hal/ESP-IDF/EspHal.h diff --git a/examples/NonArduino/Raspberry/PiHal.h b/src/hal/RPi/PiHal.h similarity index 100% rename from examples/NonArduino/Raspberry/PiHal.h rename to src/hal/RPi/PiHal.h diff --git a/examples/NonArduino/Pico/PicoHal.h b/src/hal/RPiPico/PicoHal.h similarity index 100% rename from examples/NonArduino/Pico/PicoHal.h rename to src/hal/RPiPico/PicoHal.h diff --git a/examples/NonArduino/Tock/libtockHal.h b/src/hal/Tock/libtockHal.h similarity index 100% rename from examples/NonArduino/Tock/libtockHal.h rename to src/hal/Tock/libtockHal.h diff --git a/src/modules/LR11x0/LR11x0.cpp b/src/modules/LR11x0/LR11x0.cpp index 1736f8c95..cfa96bb64 100644 --- a/src/modules/LR11x0/LR11x0.cpp +++ b/src/modules/LR11x0/LR11x0.cpp @@ -3601,7 +3601,9 @@ int16_t LR11x0::gnssWriteBitMaskSatActivated(uint8_t bitMask, uint32_t* bitMaskA void LR11x0::gnssAbort() { // send the abort signal (single NOP) this->mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_8; - this->mod->SPIwriteStream(RADIOLIB_LR11X0_CMD_NOP, NULL, 0, false, false); + // we need to call the most basic overload of the SPI write method otherwise the call will be ambiguous + uint8_t cmd[2] = { 0, 0 }; + this->mod->SPIwriteStream(cmd, 2, NULL, 0, false, false); this->mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_16; // wait for at least 2.9 seconds as specified by the user manual diff --git a/src/modules/SX126x/STM32WLx_Module.cpp b/src/modules/SX126x/STM32WLx_Module.cpp index 0f48d9aa6..d2dd47d09 100644 --- a/src/modules/SX126x/STM32WLx_Module.cpp +++ b/src/modules/SX126x/STM32WLx_Module.cpp @@ -9,7 +9,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT #if !RADIOLIB_EXCLUDE_STM32WLX -#include "../../ArduinoHal.h" +#include "hal/Arduino/ArduinoHal.h" // This defines some dummy pin numbers (starting at NUM_DIGITAL_PINS to // guarantee these are not valid regular pin numbers) that can be passed diff --git a/src/protocols/BellModem/BellModem.h b/src/protocols/BellModem/BellModem.h index 886e206ea..e65f41179 100644 --- a/src/protocols/BellModem/BellModem.h +++ b/src/protocols/BellModem/BellModem.h @@ -3,9 +3,6 @@ #include "../../TypeDef.h" #include "../../Module.h" -#if defined(RADIOLIB_BUILD_ARDUINO) -#include "../../ArduinoHal.h" -#endif #if !RADIOLIB_EXCLUDE_BELL diff --git a/src/protocols/ExternalRadio/ExternalRadio.h b/src/protocols/ExternalRadio/ExternalRadio.h index 823674bc4..86befabcb 100644 --- a/src/protocols/ExternalRadio/ExternalRadio.h +++ b/src/protocols/ExternalRadio/ExternalRadio.h @@ -3,9 +3,6 @@ #include "../../TypeDef.h" #include "../../Module.h" -#if defined(RADIOLIB_BUILD_ARDUINO) -#include "../../ArduinoHal.h" -#endif #include "../PhysicalLayer/PhysicalLayer.h" diff --git a/src/utils/CRC.h b/src/utils/CRC.h index bec3d7103..a93a0259c 100644 --- a/src/utils/CRC.h +++ b/src/utils/CRC.h @@ -3,9 +3,6 @@ #include "../TypeDef.h" #include "../Module.h" -#if defined(RADIOLIB_BUILD_ARDUINO) -#include "../ArduinoHal.h" -#endif // CCITT CRC properties (used by AX.25) #define RADIOLIB_CRC_CCITT_POLY (0x1021) diff --git a/src/utils/FEC.h b/src/utils/FEC.h index 9b9e99c37..7e1341248 100644 --- a/src/utils/FEC.h +++ b/src/utils/FEC.h @@ -3,9 +3,6 @@ #include "../TypeDef.h" #include "../Module.h" -#if defined(RADIOLIB_BUILD_ARDUINO) -#include "../ArduinoHal.h" -#endif // BCH(31, 21) code constants #define RADIOLIB_PAGER_BCH_N (31)