Files
MeshCore-Evo/src/helpers/radiolib/CustomLR1110Wrapper.h

37 lines
1.3 KiB
C
Raw Normal View History

2025-02-14 09:54:06 +01:00
#pragma once
#include "CustomLR1110.h"
#include "RadioLibWrappers.h"
#include "LR11x0Reset.h"
2025-02-14 09:54:06 +01:00
class CustomLR1110Wrapper : public RadioLibWrapper {
public:
CustomLR1110Wrapper(CustomLR1110& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
void doResetAGC() override { lr11x0ResetAGC((LR11x0 *)_radio, ((CustomLR1110 *)_radio)->getFreqMHz()); }
bool isReceivingPacket() override {
return ((CustomLR1110 *)_radio)->isReceiving();
2025-02-14 09:54:06 +01:00
}
float getCurrentRSSI() override {
float rssi = -110;
((CustomLR1110 *)_radio)->getRssiInst(&rssi);
return rssi;
}
2025-02-14 09:54:06 +01:00
void onSendFinished() override {
RadioLibWrapper::onSendFinished();
2026-03-08 05:37:49 +11:00
_radio->setPreambleLength(preambleLengthForSF(getSpreadingFactor())); // overcomes weird issues with small and big pkts
2025-02-14 09:54:06 +01:00
}
float getLastRSSI() const override { return ((CustomLR1110 *)_radio)->getRSSI(); }
float getLastSNR() const override { return ((CustomLR1110 *)_radio)->getSNR(); }
uint8_t getSpreadingFactor() const override { return ((CustomLR1110 *)_radio)->getSpreadingFactor(); }
void setRxBoostedGainMode(bool en) override {
((CustomLR1110 *)_radio)->setRxBoostedGainMode(en);
}
bool getRxBoostedGainMode() const override {
return ((CustomLR1110 *)_radio)->getRxBoostedGainMode();
}
2025-02-14 09:54:06 +01:00
};