2020-09-06 09:24:08 -07:00
|
|
|
#include "CryptoEngine.h"
|
2021-01-02 11:06:38 +08:00
|
|
|
#include "PortduinoGPIO.h"
|
2021-01-02 14:14:59 +08:00
|
|
|
#include "mesh/RF95Interface.h"
|
2020-10-31 15:50:39 +08:00
|
|
|
#include "sleep.h"
|
2021-04-02 09:14:12 +08:00
|
|
|
#include "target_specific.h"
|
2020-09-06 09:24:08 -07:00
|
|
|
|
2021-01-02 14:14:59 +08:00
|
|
|
#include <Utility.h>
|
|
|
|
|
#include <assert.h>
|
2021-04-22 14:28:56 +08:00
|
|
|
#include <linux/gpio/LinuxGPIOPin.h>
|
2021-01-02 14:14:59 +08:00
|
|
|
|
2021-04-02 09:14:12 +08:00
|
|
|
// FIXME - move setBluetoothEnable into a HALPlatform class
|
2020-09-06 09:24:08 -07:00
|
|
|
|
|
|
|
|
void setBluetoothEnable(bool on)
|
|
|
|
|
{
|
2021-03-17 20:29:27 +08:00
|
|
|
// not needed
|
2020-09-06 09:24:08 -07:00
|
|
|
}
|
|
|
|
|
|
2021-04-02 09:14:12 +08:00
|
|
|
void cpuDeepSleep(uint64_t msecs)
|
|
|
|
|
{
|
2020-10-31 15:50:39 +08:00
|
|
|
notImplemented("cpuDeepSleep");
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-02 11:06:38 +08:00
|
|
|
void updateBatteryLevel(uint8_t level) NOT_IMPLEMENTED("updateBatteryLevel");
|
|
|
|
|
|
2021-01-02 12:38:18 +08:00
|
|
|
|
2021-01-02 11:06:38 +08:00
|
|
|
|
2021-04-02 09:14:12 +08:00
|
|
|
/** apps run under portduino can optionally define a portduinoSetup() to
|
2021-01-02 11:06:38 +08:00
|
|
|
* use portduino specific init code (such as gpioBind) to setup portduino on their host machine,
|
|
|
|
|
* before running 'arduino' code.
|
|
|
|
|
*/
|
2021-04-02 09:14:12 +08:00
|
|
|
void portduinoSetup()
|
|
|
|
|
{
|
|
|
|
|
printf("Setting up Meshtastic on Porduino...\n");
|
2021-03-15 19:59:09 +08:00
|
|
|
|
2021-04-22 08:49:05 +08:00
|
|
|
// FIXME: remove this hack once interrupts are confirmed to work on new pine64 board
|
2021-04-22 17:48:20 +08:00
|
|
|
auto loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"?
|
|
|
|
|
gpioBind(loraIrq);
|
2021-03-15 19:59:09 +08:00
|
|
|
|
2021-04-22 14:28:56 +08:00
|
|
|
// BUSY hw is busted on current board - just use the simulated pin (which will read low)
|
2021-04-22 17:48:20 +08:00
|
|
|
//gpioBind(new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"));
|
2021-04-22 14:28:56 +08:00
|
|
|
auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy");
|
|
|
|
|
fakeBusy->writePin(LOW);
|
2021-04-22 17:48:20 +08:00
|
|
|
fakeBusy->setSilent(true);
|
2021-04-22 14:28:56 +08:00
|
|
|
gpioBind(fakeBusy);
|
|
|
|
|
|
2021-04-22 17:48:20 +08:00
|
|
|
auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs");
|
|
|
|
|
loraCs->setSilent(true);
|
|
|
|
|
gpioBind(loraCs);
|
2021-04-22 14:28:56 +08:00
|
|
|
|
2021-04-02 09:14:12 +08:00
|
|
|
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
|
|
|
|
|
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());
|
2021-01-02 11:06:38 +08:00
|
|
|
}
|