mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
make it more dry
This commit is contained in:
parent
9106ab46e1
commit
b2032e11b6
5 changed files with 41 additions and 104 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "CustomLLCC68.h"
|
||||
#include "RadioLibWrappers.h"
|
||||
#include "SX126xReset.h"
|
||||
|
||||
class CustomLLCC68Wrapper : public RadioLibWrapper {
|
||||
public:
|
||||
|
|
@ -20,29 +21,5 @@ public:
|
|||
return packetScoreInt(snr, sf, packet_len);
|
||||
}
|
||||
|
||||
void doResetAGC() override {
|
||||
auto* radio = (CustomLLCC68 *)_radio;
|
||||
radio->sleep(true);
|
||||
radio->standby(RADIOLIB_SX126X_STANDBY_RC, true);
|
||||
uint8_t calData = RADIOLIB_SX126X_CALIBRATE_ALL;
|
||||
radio->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE, &calData, 1, true, false);
|
||||
radio->mod->hal->delay(5);
|
||||
uint32_t start = millis();
|
||||
while (radio->mod->hal->digitalRead(radio->mod->getGpio())) {
|
||||
if (millis() - start > 50) break;
|
||||
radio->mod->hal->yield();
|
||||
}
|
||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||
radio->setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
||||
#endif
|
||||
#ifdef SX126X_RX_BOOSTED_GAIN
|
||||
radio->setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
|
||||
#endif
|
||||
#ifdef SX126X_REGISTER_PATCH
|
||||
uint8_t r_data = 0;
|
||||
radio->readRegister(0x8B5, &r_data, 1);
|
||||
r_data |= 0x01;
|
||||
radio->writeRegister(0x8B5, &r_data, 1);
|
||||
#endif
|
||||
}
|
||||
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue