mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #594 from wel97459/dev
Changed waveshare_rp2040_lora radio_init function to use radio.std_init
This commit is contained in:
commit
72d13ca867
1 changed files with 2 additions and 34 deletions
|
|
@ -12,19 +12,9 @@ VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
SensorManager sensors;
|
SensorManager sensors;
|
||||||
|
|
||||||
#ifndef LORA_CR
|
|
||||||
#define LORA_CR 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool radio_init() {
|
bool radio_init() {
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SPI1.setSCK(P_LORA_SCLK);
|
SPI1.setSCK(P_LORA_SCLK);
|
||||||
SPI1.setTX(P_LORA_MOSI);
|
SPI1.setTX(P_LORA_MOSI);
|
||||||
SPI1.setRX(P_LORA_MISO);
|
SPI1.setRX(P_LORA_MISO);
|
||||||
|
|
@ -34,30 +24,8 @@ bool radio_init() {
|
||||||
|
|
||||||
SPI1.begin(false);
|
SPI1.begin(false);
|
||||||
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE,
|
//passing NULL skips init of SPI
|
||||||
LORA_TX_POWER, 8, tcxo);
|
return radio.std_init(NULL);
|
||||||
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.print("ERROR: radio init failed: ");
|
|
||||||
Serial.println(status);
|
|
||||||
return false; // fail
|
|
||||||
}
|
|
||||||
|
|
||||||
radio.setCRC(1);
|
|
||||||
|
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
return true; // success
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t radio_get_rng_seed() {
|
uint32_t radio_get_rng_seed() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue