-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpassthrough.ino
36 lines (31 loc) · 1.06 KB
/
passthrough.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Library for AXP20x Power Management
#include <axp20x.h>
AXP20X_Class axp;
HardwareSerial GPSSerial1(1);
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS))
{
Serial.println("[I] AXP192 Begin PASS");
}
else
{
Serial.println("[I] AXP192 Begin FAIL");
}
axp.setDCDC1Voltage(3300); //ESP32 3v3
axp.setLDO3Voltage(3300); //GPS 3v3
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); //ESP32 ON
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); //GPS ON
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); //LORA
axp.setPowerOutPut(AXP192_EXTEN, AXP202_OFF);
GPSSerial1.begin(9600, SERIAL_8N1, 34, 12);
}
void loop() {
if (Serial.available()) { // If anything comes in Serial (USB),
GPSSerial1.write(Serial.read()); // read it and send it out Serial1 (pins 0 & 1)
}
if (GPSSerial1.available()) { // If anything comes in Serial1 (pins 0 & 1)
Serial.write(GPSSerial1.read()); // read it and send it out Serial (USB)
}
}