Skip to content

Commit c4e99a8

Browse files
authored
Merge pull request #1023 from WattleFoxxo/dev
Update xiao rp2040 to use new radio standard init
2 parents 80f0405 + d4eb04d commit c4e99a8

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

variants/xiao_rp2040/target.cpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,12 @@ SensorManager sensors;
2020
bool radio_init() {
2121
rtc_clock.begin(Wire);
2222

23-
#ifdef SX126X_DIO3_TCXO_VOLTAGE
24-
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
23+
#if defined(P_LORA_SCLK)
24+
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
25+
return radio.std_init(&spi);
2526
#else
26-
float tcxo = 1.6f;
27+
return radio.std_init();
2728
#endif
28-
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
29-
30-
if (status != RADIOLIB_ERR_NONE) {
31-
Serial.print("ERROR: radio init failed: ");
32-
Serial.println(status);
33-
return false; // fail
34-
}
35-
36-
radio.setCRC(1);
37-
38-
#ifdef SX126X_CURRENT_LIMIT
39-
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
40-
#endif
41-
42-
#ifdef SX126X_DIO2_AS_RF_SWITCH
43-
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
44-
#endif
45-
46-
#ifdef SX126X_RX_BOOSTED_GAIN
47-
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
48-
#endif
49-
50-
return true; // success
5129
}
5230

5331
uint32_t radio_get_rng_seed() {

0 commit comments

Comments
 (0)