CustomLR1110Wrapper.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "CustomLR1110.h"
  3. #include "RadioLibWrappers.h"
  4. #include "LR11x0Reset.h"
  5. class CustomLR1110Wrapper : public RadioLibWrapper {
  6. public:
  7. CustomLR1110Wrapper(CustomLR1110& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
  8. void doResetAGC() override { lr11x0ResetAGC((LR11x0 *)_radio, ((CustomLR1110 *)_radio)->getFreqMHz()); }
  9. bool isReceivingPacket() override {
  10. return ((CustomLR1110 *)_radio)->isReceiving();
  11. }
  12. float getCurrentRSSI() override {
  13. float rssi = -110;
  14. ((CustomLR1110 *)_radio)->getRssiInst(&rssi);
  15. return rssi;
  16. }
  17. void onSendFinished() override {
  18. RadioLibWrapper::onSendFinished();
  19. _radio->setPreambleLength(preambleLengthForSF(getSpreadingFactor())); // overcomes weird issues with small and big pkts
  20. }
  21. float getLastRSSI() const override { return ((CustomLR1110 *)_radio)->getRSSI(); }
  22. float getLastSNR() const override { return ((CustomLR1110 *)_radio)->getSNR(); }
  23. uint8_t getSpreadingFactor() const override { return ((CustomLR1110 *)_radio)->getSpreadingFactor(); }
  24. void setRxBoostedGainMode(bool en) override {
  25. ((CustomLR1110 *)_radio)->setRxBoostedGainMode(en);
  26. }
  27. bool getRxBoostedGainMode() const override {
  28. return ((CustomLR1110 *)_radio)->getRxBoostedGainMode();
  29. }
  30. };