2021-01-01 22:23:27 +00:00
|
|
|
|
|
|
|
#include "power_management.h"
|
|
|
|
|
|
|
|
// cppcheck-suppress uninitMemberVar
|
2021-03-12 22:21:45 +00:00
|
|
|
PowerManagement::PowerManagement() {
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
bool PowerManagement::begin(TwoWire &port) {
|
|
|
|
bool result = axp.begin(port, AXP192_SLAVE_ADDRESS);
|
|
|
|
if (!result) {
|
|
|
|
axp.setDCDC1Voltage(3300);
|
|
|
|
}
|
|
|
|
return result;
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::activateLoRa() {
|
|
|
|
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::deactivateLoRa() {
|
|
|
|
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::activateGPS() {
|
|
|
|
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::deactivateGPS() {
|
|
|
|
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::activateOLED() {
|
|
|
|
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// cppcheck-suppress unusedFunction
|
2021-03-12 22:21:45 +00:00
|
|
|
void PowerManagement::decativateOLED() {
|
|
|
|
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
|
2021-01-01 22:23:27 +00:00
|
|
|
}
|