Pick up support for more than 64 GPIO lines under Portduino

pull/3761/head
Jonathan Bennett 2024-05-01 13:06:42 -05:00
rodzic ec92f7a5a3
commit 5095efc55f
2 zmienionych plików z 23 dodań i 2 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
[portduino_base]
platform = https://github.com/meshtastic/platform-native.git#659e49346aa33008b150dfb206b1817ddabc7132
platform = https://github.com/meshtastic/platform-native.git#784007630ca43b4811c6637606440588bb5acf39
framework = arduino
build_src_filter =

Wyświetl plik

@ -76,7 +76,21 @@ void portduinoCustomInit()
void portduinoSetup()
{
printf("Setting up Meshtastic on Portduino...\n");
gpioInit();
int max_GPIO = 0;
int GPIO_lines[] = {cs,
irq,
busy,
reset,
txen,
rxen,
displayDC,
displayCS,
displayBacklight,
displayBacklightPWMChannel,
displayReset,
touchscreenCS,
touchscreenIRQ,
user};
std::string gpioChipName = "gpiochip";
settingsStrings[i2cdev] = "";
@ -245,6 +259,13 @@ void portduinoSetup()
exit(EXIT_FAILURE);
}
for (int i : GPIO_lines) {
if (i > max_GPIO)
max_GPIO = i;
}
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
if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) {
if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {