Cope with missing portuino hardware

This commit is contained in:
Kevin Hester 2021-05-23 11:46:57 +08:00
parent 844189671f
commit 5a3ff137f9

View File

@ -48,7 +48,9 @@ class PolledIrqPin : public GPIOPin
} }
}; };
GPIOPin *loraIrq; static GPIOPin *loraIrq;
static bool usePineLora;
/** apps run under portduino can optionally define a portduinoSetup() to /** apps run under portduino can optionally define a portduinoSetup() to
* use portduino specific init code (such as gpioBind) to setup portduino on their host machine, * use portduino specific init code (such as gpioBind) to setup portduino on their host machine,
@ -58,26 +60,39 @@ void portduinoSetup()
{ {
printf("Setting up Meshtastic on Porduino...\n"); printf("Setting up Meshtastic on Porduino...\n");
// FIXME: remove this hack once interrupts are confirmed to work on new pine64 board if(usePineLora) {
// loraIrq = new PolledIrqPin(); printf("Connecting to PineLora board...\n");
loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"?
loraIrq->setSilent();
gpioBind(loraIrq);
// BUSY hw was busted on current board - just use the simulated pin (which will read low) // FIXME: remove this hack once interrupts are confirmed to work on new pine64 board
auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"); // loraIrq = new PolledIrqPin();
busy->setSilent(); loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"?
gpioBind(busy); loraIrq->setSilent();
//auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy"); gpioBind(loraIrq);
//fakeBusy->writePin(LOW);
//fakeBusy->setSilent(true);
//gpioBind(fakeBusy);
gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset")); // BUSY hw was busted on current board - just use the simulated pin (which will read low)
auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy");
busy->setSilent();
gpioBind(busy);
auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs"); gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset"));
loraCs->setSilent();
gpioBind(loraCs); auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs");
loraCs->setSilent();
gpioBind(loraCs);
}
else {
auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy");
fakeBusy->writePin(LOW);
fakeBusy->setSilent(true);
gpioBind(fakeBusy);
auto cs = new SimGPIOPin(SX1262_CS, "fakeLoraCS");
cs->setSilent(true);
gpioBind(cs);
gpioBind(new SimGPIOPin(SX1262_RESET, "fakeLoraReset"));
gpioBind(new SimGPIOPin(LORA_DIO1, "fakeLoraIrq"));
}
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET"))); // gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent()); // gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());