You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

63 lines
1.6 KiB

#pragma once
#include "RadioLibWrappers.h"
#include "CustomLR1121.h"
#include "LR11x0Reset.h"
#ifndef USE_LR1121
#define USE_LR1121
#endif
class CustomLR1121Wrapper : public RadioLibWrapper {
public:
CustomLR1121Wrapper(CustomLR1121& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) {}
void setParams(float freq, float bw, uint8_t sf, uint8_t cr) override {
((CustomLR1121*)_radio)->setFrequency(freq);
((CustomLR1121*)_radio)->setSpreadingFactor(sf);
((CustomLR1121*)_radio)->setBandwidth(bw);
((CustomLR1121*)_radio)->setCodingRate(cr);
updatePreamble(sf);
}
void doResetAGC() override {
lr11x0ResetAGC((LR11x0*)_radio, ((CustomLR1121*)_radio)->getFreqMHz());
}
bool isReceivingPacket() override {
return ((CustomLR1121*)_radio)->isReceiving();
}
float getCurrentRSSI() override {
float rssi = -110;
((CustomLR1121*)_radio)->getRssiInst(&rssi);
return rssi;
}
void onSendFinished() override {
RadioLibWrapper::onSendFinished();
((CustomLR1121*)_radio)->explicitHeader();
_radio->setPreambleLength(preambleLengthForSF(getSpreadingFactor()));
}
float getLastRSSI() const override {
return ((CustomLR1121*)_radio)->getRSSI();
}
float getLastSNR() const override {
return ((CustomLR1121*)_radio)->getSNR();
}
uint8_t getSpreadingFactor() const override {
return ((CustomLR1121*)_radio)->getSpreadingFactor();
}
void setRxBoostedGainMode(bool en) override {
((CustomLR1121*)_radio)->setRxBoostedGainMode(en);
}
bool getRxBoostedGainMode() const override {
return ((CustomLR1121*)_radio)->getRxBoostedGainMode();
}
};