mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-01 02:09:57 +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
|
||||
# Busy: 20
|
||||
# Reset: 18
|
||||
# SX126X_ANT_SW: 6
|
||||
|
||||
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
||||
# CS: 7
|
||||
@ -153,4 +154,4 @@ Webserver:
|
||||
|
||||
General:
|
||||
MaxNodes: 200
|
||||
MaxMessageQueue: 100
|
||||
MaxMessageQueue: 100
|
@ -52,6 +52,10 @@ template <typename T> bool SX126xInterface<T>::init()
|
||||
float tcxoVoltage = 0;
|
||||
if (settingsMap[dio3_tcxo_voltage])
|
||||
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
|
||||
#elif !defined(SX126X_DIO3_TCXO_VOLTAGE)
|
||||
float tcxoVoltage =
|
||||
|
@ -80,6 +80,7 @@ void portduinoSetup()
|
||||
irq,
|
||||
busy,
|
||||
reset,
|
||||
sx126x_ant_sw,
|
||||
txen,
|
||||
rxen,
|
||||
displayDC,
|
||||
@ -180,6 +181,7 @@ void portduinoSetup()
|
||||
settingsMap[reset] = yamlConfig["Lora"]["Reset"].as<int>(RADIOLIB_NC);
|
||||
settingsMap[txen] = yamlConfig["Lora"]["TXen"].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[ch341Quirk] = yamlConfig["Lora"]["ch341_quirk"].as<bool>(false);
|
||||
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.
|
||||
|
||||
// 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 (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {
|
||||
settingsMap[cs] = RADIOLIB_NC;
|
||||
@ -325,6 +329,11 @@ void portduinoSetup()
|
||||
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 (initGPIOPin(settingsMap[user], gpioChipName) != ERRNO_OK) {
|
||||
settingsMap[user] = RADIOLIB_NC;
|
||||
@ -391,4 +400,4 @@ int initGPIOPin(int pinNum, const std::string gpioChipName)
|
||||
#else
|
||||
return ERRNO_OK;
|
||||
#endif
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ enum configNames {
|
||||
irq,
|
||||
busy,
|
||||
reset,
|
||||
sx126x_ant_sw,
|
||||
txen,
|
||||
rxen,
|
||||
dio2_as_rf_switch,
|
||||
@ -63,4 +64,4 @@ enum { level_error, level_warn, level_info, level_debug, level_trace };
|
||||
extern std::map<configNames, int> settingsMap;
|
||||
extern std::map<configNames, std::string> settingsStrings;
|
||||
extern std::ofstream traceFile;
|
||||
int initGPIOPin(int pinNum, std::string gpioChipname);
|
||||
int initGPIOPin(int pinNum, std::string gpioChipname);
|
Loading…
Reference in New Issue
Block a user