From 8383d57ccf84b115817792b7e2e91dbc387692f8 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 31 Mar 2024 22:30:58 -0500 Subject: [PATCH 1/2] Add spiTransfer function to Native to support Linux-managed CS --- arch/portduino/portduino.ini | 2 +- src/mesh/RadioLibInterface.cpp | 6 ++++++ src/mesh/RadioLibInterface.h | 3 +++ variants/portduino/variant.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index ef8711f8a7..077a49b3fb 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#1b8a32c60ab7495026033858d53c737f7d1cb34a +platform = https://github.com/meshtastic/platform-native.git#117acc5e7fcc2047e9ba1dc11789daea26fc36d2 framework = arduino build_src_filter = diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 9f42afa6d2..a10bc42a3a 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -22,6 +22,12 @@ void LockingArduinoHal::spiEndTransaction() ArduinoHal::spiEndTransaction(); } +#if ARCH_PORTDUINO +void LockingArduinoHal::spiTransfer(uint8_t* out, size_t len, uint8_t* in) +{ + spi->transfer(out, in, len); +} +#endif RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, PhysicalLayer *_iface) diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 4634ca7eec..1db48411bd 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -25,6 +25,9 @@ class LockingArduinoHal : public ArduinoHal void spiBeginTransaction() override; void spiEndTransaction() override; + #if ARCH_PORTDUINO + void spiTransfer(uint8_t* out, size_t len, uint8_t* in) override; + #endif }; #if defined(USE_STM32WLx) diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 5aad8dbfcc..414a3fa566 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -2,3 +2,4 @@ #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 #define MAX_NUM_NODES settingsMap[maxnodes] +#define RADIOLIB_GODMODE 1 From 71de1f246c1ced4070c1f7756467d173df97ed50 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 31 Mar 2024 22:35:42 -0500 Subject: [PATCH 2/2] Trunk --- src/mesh/RadioLibInterface.cpp | 2 +- src/mesh/RadioLibInterface.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index a10bc42a3a..3ad2abe23a 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -23,7 +23,7 @@ void LockingArduinoHal::spiEndTransaction() ArduinoHal::spiEndTransaction(); } #if ARCH_PORTDUINO -void LockingArduinoHal::spiTransfer(uint8_t* out, size_t len, uint8_t* in) +void LockingArduinoHal::spiTransfer(uint8_t *out, size_t len, uint8_t *in) { spi->transfer(out, in, len); } diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 1db48411bd..62720cfc9e 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -25,9 +25,9 @@ class LockingArduinoHal : public ArduinoHal void spiBeginTransaction() override; void spiEndTransaction() override; - #if ARCH_PORTDUINO - void spiTransfer(uint8_t* out, size_t len, uint8_t* in) override; - #endif +#if ARCH_PORTDUINO + void spiTransfer(uint8_t *out, size_t len, uint8_t *in) override; +#endif }; #if defined(USE_STM32WLx)