2025-05-11 09:26:32 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CustomSTM32WLx.h"
|
|
|
|
|
#include "RadioLibWrappers.h"
|
2026-02-19 17:34:48 +01:00
|
|
|
#include "SX126xReset.h"
|
2025-05-11 09:26:32 +02:00
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
class CustomSTM32WLxWrapper : public RadioLibWrapper {
|
|
|
|
|
public:
|
|
|
|
|
CustomSTM32WLxWrapper(CustomSTM32WLx& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
|
2026-05-01 14:47:07 +10:00
|
|
|
|
|
|
|
|
void setParams(float freq, float bw, uint8_t sf, uint8_t cr) override {
|
|
|
|
|
((CustomSTM32WLx *)_radio)->setFrequency(freq);
|
|
|
|
|
((CustomSTM32WLx *)_radio)->setSpreadingFactor(sf);
|
|
|
|
|
((CustomSTM32WLx *)_radio)->setBandwidth(bw);
|
|
|
|
|
((CustomSTM32WLx *)_radio)->setCodingRate(cr);
|
|
|
|
|
updatePreamble(sf);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 20:42:00 +10:00
|
|
|
bool isReceivingPacket() override {
|
|
|
|
|
return ((CustomSTM32WLx *)_radio)->isReceiving();
|
2025-05-11 09:26:32 +02:00
|
|
|
}
|
2025-05-24 21:24:44 +10:00
|
|
|
float getCurrentRSSI() override {
|
|
|
|
|
return ((CustomSTM32WLx *)_radio)->getRSSI(false);
|
|
|
|
|
}
|
2025-05-11 09:26:32 +02:00
|
|
|
float getLastRSSI() const override { return ((CustomSTM32WLx *)_radio)->getRSSI(); }
|
|
|
|
|
float getLastSNR() const override { return ((CustomSTM32WLx *)_radio)->getSNR(); }
|
|
|
|
|
|
|
|
|
|
float packetScore(float snr, int packet_len) override {
|
|
|
|
|
int sf = ((CustomSTM32WLx *)_radio)->spreadingFactor;
|
|
|
|
|
return packetScoreInt(snr, sf, packet_len);
|
|
|
|
|
}
|
2026-03-05 22:14:22 +11:00
|
|
|
uint8_t getSpreadingFactor() const override { return ((CustomSTM32WLx *)_radio)->spreadingFactor; }
|
2026-02-19 16:16:21 +01:00
|
|
|
|
2026-02-19 17:34:48 +01:00
|
|
|
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
2025-05-11 09:26:32 +02:00
|
|
|
};
|