mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 05:31:25 +00:00
Add sx126x_ant_sw for Native (#4887)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
482361b252
commit
fd1b68513a
@ -9,6 +9,7 @@ Lora:
|
|||||||
# IRQ: 16
|
# IRQ: 16
|
||||||
# Busy: 20
|
# Busy: 20
|
||||||
# Reset: 18
|
# Reset: 18
|
||||||
|
# SX126X_ANT_SW: 6
|
||||||
|
|
||||||
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
||||||
# CS: 7
|
# CS: 7
|
||||||
|
@ -52,6 +52,10 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||||||
float tcxoVoltage = 0;
|
float tcxoVoltage = 0;
|
||||||
if (settingsMap[dio3_tcxo_voltage])
|
if (settingsMap[dio3_tcxo_voltage])
|
||||||
tcxoVoltage = 1.8;
|
tcxoVoltage = 1.8;
|
||||||
|
if (settingsMap[sx126x_ant_sw] != RADIOLIB_NC) {
|
||||||
|
digitalWrite(settingsMap[sx126x_ant_sw], HIGH);
|
||||||
|
pinMode(settingsMap[sx126x_ant_sw], OUTPUT);
|
||||||
|
}
|
||||||
// FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE
|
// FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE
|
||||||
#elif !defined(SX126X_DIO3_TCXO_VOLTAGE)
|
#elif !defined(SX126X_DIO3_TCXO_VOLTAGE)
|
||||||
float tcxoVoltage =
|
float tcxoVoltage =
|
||||||
|
@ -80,6 +80,7 @@ void portduinoSetup()
|
|||||||
irq,
|
irq,
|
||||||
busy,
|
busy,
|
||||||
reset,
|
reset,
|
||||||
|
sx126x_ant_sw,
|
||||||
txen,
|
txen,
|
||||||
rxen,
|
rxen,
|
||||||
displayDC,
|
displayDC,
|
||||||
@ -180,6 +181,7 @@ void portduinoSetup()
|
|||||||
settingsMap[reset] = yamlConfig["Lora"]["Reset"].as<int>(RADIOLIB_NC);
|
settingsMap[reset] = yamlConfig["Lora"]["Reset"].as<int>(RADIOLIB_NC);
|
||||||
settingsMap[txen] = yamlConfig["Lora"]["TXen"].as<int>(RADIOLIB_NC);
|
settingsMap[txen] = yamlConfig["Lora"]["TXen"].as<int>(RADIOLIB_NC);
|
||||||
settingsMap[rxen] = yamlConfig["Lora"]["RXen"].as<int>(RADIOLIB_NC);
|
settingsMap[rxen] = yamlConfig["Lora"]["RXen"].as<int>(RADIOLIB_NC);
|
||||||
|
settingsMap[sx126x_ant_sw] = yamlConfig["Lora"]["SX126X_ANT_SW"].as<int>(RADIOLIB_NC);
|
||||||
settingsMap[gpiochip] = yamlConfig["Lora"]["gpiochip"].as<int>(0);
|
settingsMap[gpiochip] = yamlConfig["Lora"]["gpiochip"].as<int>(0);
|
||||||
settingsMap[ch341Quirk] = yamlConfig["Lora"]["ch341_quirk"].as<bool>(false);
|
settingsMap[ch341Quirk] = yamlConfig["Lora"]["ch341_quirk"].as<bool>(false);
|
||||||
settingsMap[spiSpeed] = yamlConfig["Lora"]["spiSpeed"].as<int>(2000000);
|
settingsMap[spiSpeed] = yamlConfig["Lora"]["spiSpeed"].as<int>(2000000);
|
||||||
@ -305,6 +307,8 @@ void portduinoSetup()
|
|||||||
gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need.
|
gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need.
|
||||||
|
|
||||||
// Need to bind all the configured GPIO pins so they're not simulated
|
// Need to bind all the configured GPIO pins so they're not simulated
|
||||||
|
// TODO: Can we do this in the for loop above?
|
||||||
|
// TODO: If one of these fails, we should log and terminate
|
||||||
if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) {
|
if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) {
|
||||||
if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {
|
if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {
|
||||||
settingsMap[cs] = RADIOLIB_NC;
|
settingsMap[cs] = RADIOLIB_NC;
|
||||||
@ -325,6 +329,11 @@ void portduinoSetup()
|
|||||||
settingsMap[reset] = RADIOLIB_NC;
|
settingsMap[reset] = RADIOLIB_NC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (settingsMap.count(sx126x_ant_sw) > 0 && settingsMap[sx126x_ant_sw] != RADIOLIB_NC) {
|
||||||
|
if (initGPIOPin(settingsMap[sx126x_ant_sw], gpioChipName) != ERRNO_OK) {
|
||||||
|
settingsMap[sx126x_ant_sw] = RADIOLIB_NC;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (settingsMap.count(user) > 0 && settingsMap[user] != RADIOLIB_NC) {
|
if (settingsMap.count(user) > 0 && settingsMap[user] != RADIOLIB_NC) {
|
||||||
if (initGPIOPin(settingsMap[user], gpioChipName) != ERRNO_OK) {
|
if (initGPIOPin(settingsMap[user], gpioChipName) != ERRNO_OK) {
|
||||||
settingsMap[user] = RADIOLIB_NC;
|
settingsMap[user] = RADIOLIB_NC;
|
||||||
|
@ -8,6 +8,7 @@ enum configNames {
|
|||||||
irq,
|
irq,
|
||||||
busy,
|
busy,
|
||||||
reset,
|
reset,
|
||||||
|
sx126x_ant_sw,
|
||||||
txen,
|
txen,
|
||||||
rxen,
|
rxen,
|
||||||
dio2_as_rf_switch,
|
dio2_as_rf_switch,
|
||||||
|
Loading…
Reference in New Issue
Block a user