Use buffered radio SPI and acknowledged RX reuse on direct-I/O boards
This commit is contained in:
1 parent
b8b7880a48
commit
3892599300
80 files changed
+846
-173
No files matched your search
@@ -28,14 +28,15 @@
|
||||
#endif
|
||||
|
||||
#ifndef MC_SX1262_FAST_IQ_CACHE
|
||||
// An additional optimization, enabled per board only after hardware testing.
|
||||
#define MC_SX1262_FAST_IQ_CACHE 0
|
||||
// Reuse only acknowledged IQ state inside the owned warm RX path. Follow
|
||||
// the direct-I/O FS policy; explicit board opt-outs and overrides still win.
|
||||
#define MC_SX1262_FAST_IQ_CACHE MC_SX1262_FAST_FS
|
||||
#endif
|
||||
|
||||
#ifndef MC_SX1262_FAST_MODEM_CACHE
|
||||
// Reuse the LoRa modem confirmation only inside an acknowledged owned RX hop.
|
||||
// Keep this board-qualified optimization off until its hardware comparison.
|
||||
#define MC_SX1262_FAST_MODEM_CACHE 0
|
||||
// Expander targets that opt out of FS retain their previous live-query path.
|
||||
#define MC_SX1262_FAST_MODEM_CACHE MC_SX1262_FAST_FS
|
||||
#endif
|
||||
|
||||
#if (MC_SX1262_FAST_FS || MC_SX1262_FAST_PACKET_CACHE || MC_SX1262_FAST_IQ_CACHE || MC_SX1262_FAST_MODEM_CACHE) && !MC_SX1262_FAST_PROFILE_SWITCH
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef MC_SX1262_SPI_HZ
|
||||
#define MC_SX1262_SPI_HZ 8000000
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#include "Nrf52BufferedRadioHal.h"
|
||||
using SX126xBufferedRadioHalBase = Nrf52BufferedRadioHal;
|
||||
#elif defined(ESP32_PLATFORM)
|
||||
#include "ESP32BufferedRadioHal.h"
|
||||
using SX126xBufferedRadioHalBase = ESP32BufferedRadioHal;
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <hal/Arduino/ArduinoHal.h>
|
||||
// Earle Philhower's HardwareSPI bulk API retains full-duplex blocking
|
||||
// completion while filling/draining the controller FIFO in one call.
|
||||
class SX126xBufferedRadioHalBase : public ArduinoHal {
|
||||
public:
|
||||
explicit SX126xBufferedRadioHalBase(SPIClass& bus, uint32_t hz)
|
||||
: ArduinoHal(bus, SPISettings(hz, MSBFIRST, SPI_MODE0)) {}
|
||||
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) override {
|
||||
if (len) spi->transfer(out, in, len);
|
||||
}
|
||||
};
|
||||
#else
|
||||
#error "SX126x buffered radio SPI requires nRF52, ESP32 or RP2040"
|
||||
#endif
|
||||
|
||||
// Keep the board's existing SPI controller and pin setup. Only the default
|
||||
// SPI fallback owns begin/end; explicitly supplied buses remain board-owned.
|
||||
// RadioLib still controls CS, BUSY, command status and IRQ acknowledgement.
|
||||
class SX126xBufferedRadioHal : public SX126xBufferedRadioHalBase {
|
||||
public:
|
||||
explicit SX126xBufferedRadioHal(SPIClass& bus,
|
||||
uint32_t hz = MC_SX1262_SPI_HZ, bool initializeBus = false)
|
||||
: SX126xBufferedRadioHalBase(bus, hz) {
|
||||
initInterface = initializeBus;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user