diff --git a/main/battery.cpp b/main/battery.cpp index ef23bfc0..179a6439 100644 --- a/main/battery.cpp +++ b/main/battery.cpp @@ -1,4 +1,4 @@ -#include "battery.c" +#include "battery.h" #include "driver/adc.h" #include "esp_adc_cal.h" @@ -8,7 +8,7 @@ namespace gay_ipod { static esp_adc_cal_characteristics_t calibration; -esp_error_t init_adc(void) { +esp_err_t init_adc(void) { // Calibration should already be fused into the chip from the factory, so // we should only need to read it back out again. esp_adc_cal_characterize( diff --git a/main/battery.h b/main/battery.h index c5140212..0ee36aa5 100644 --- a/main/battery.h +++ b/main/battery.h @@ -1,9 +1,13 @@ #ifndef BATTERY_H #define BATTERY_H +#include + +#include "esp_err.h" + namespace gay_ipod { -esp_error_t init_adc(void); +esp_err_t init_adc(void); /** * Returns the current battery level in millivolts. diff --git a/main/gay-ipod-fw.cpp b/main/gay-ipod-fw.cpp index 55ff451f..5f16ddc7 100644 --- a/main/gay-ipod-fw.cpp +++ b/main/gay-ipod-fw.cpp @@ -97,11 +97,11 @@ extern "C" void app_main(void) ESP_ERROR_CHECK(expander.Write()); ESP_LOGI(TAG, "Init ADC"); - ESP_ERROR_CHECK(init_adc()); + ESP_ERROR_CHECK(gay_ipod::init_adc()); while (1) { - uint32_t battery = read_battery_voltage(); + uint32_t battery = gay_ipod::read_battery_voltage(); expander.Read(); ESP_LOGI(TAG, "millivolts: %d, wall power? %d", battery, expander.charge_power_ok());