diff --git a/platform/targets/ttwrplus/platform.c b/platform/targets/ttwrplus/platform.c index df155b08..5b0ba545 100644 --- a/platform/targets/ttwrplus/platform.c +++ b/platform/targets/ttwrplus/platform.c @@ -82,7 +82,7 @@ void platform_terminate() uint16_t platform_getVbat() { - return 0; + return pmu_getVbat(); } uint8_t platform_getMicLevel() diff --git a/platform/targets/ttwrplus/pmu.cpp b/platform/targets/ttwrplus/pmu.cpp index a6eb94f3..cc7801ff 100644 --- a/platform/targets/ttwrplus/pmu.cpp +++ b/platform/targets/ttwrplus/pmu.cpp @@ -292,3 +292,8 @@ void pmu_init() val = PMU.getChargeTargetVoltage(); printk("Setting Charge Target Voltage : %d\n", tableVoltage[val]); } + +uint16_t pmu_getVbat() +{ + return PMU.isBatteryConnect() ? PMU.getBattVoltage() : 0; +} diff --git a/platform/targets/ttwrplus/pmu.h b/platform/targets/ttwrplus/pmu.h index 1b70c080..71755b57 100644 --- a/platform/targets/ttwrplus/pmu.h +++ b/platform/targets/ttwrplus/pmu.h @@ -25,7 +25,7 @@ extern "C" { #endif void pmu_init(); - +uint16_t pmu_getVbat(); #ifdef __cplusplus }