diff --git a/src/adc_dma.cpp b/src/adc_dma.cpp index 581c85a..c4206b1 100644 --- a/src/adc_dma.cpp +++ b/src/adc_dma.cpp @@ -18,23 +18,11 @@ #include "mbed.h" #endif -#include "config.h" +#include "main.h" #include "adc_dma.h" #include "pcb.h" // contains defines for pins #include // log for thermistor calculation -#include -#include "log.h" -#include "pwm_switch.h" - -extern Charger charger; -extern Dcdc dcdc; -extern LoadOutput load; -extern DcBus hv_terminal; -extern DcBus lv_bus_int; -extern DcBus lv_terminal; -extern DcBus load_terminal; - // factory calibration values for internal voltage reference and temperature sensor // (see MCU datasheet, not RM) diff --git a/src/data_objects.cpp b/src/data_objects.cpp index e32b519..e7121b0 100644 --- a/src/data_objects.cpp +++ b/src/data_objects.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "main.h" + #include "pcb.h" #include "config.h" #include "version.h" @@ -22,28 +24,10 @@ #ifndef CUSTOM_DATA_OBJECTS_FILE #include "thingset.h" -#include "bat_charger.h" -#include "log.h" -#include "dcdc.h" -#include "load.h" #include "hardware.h" #include "eeprom.h" -#include "pwm_switch.h" #include -extern LogData log_data; -extern Charger charger; -extern BatConf bat_conf; -extern BatConf bat_conf_user; -extern Dcdc dcdc; -extern LoadOutput load; -extern DcBus hv_terminal; -extern DcBus lv_terminal; -extern DcBus load_terminal; -//extern DcBus *bat_terminal; // TODO: pointers cannot be used here, as they are not -//extern DcBus *solar_terminal; // yet initialized... -extern PwmSwitch pwm_switch; - const char* const manufacturer = "Libre Solar"; const char* const device_type = DEVICE_TYPE; const char* const hardware_version = HARDWARE_VERSION; diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..cfa8300 --- /dev/null +++ b/src/main.h @@ -0,0 +1,36 @@ +/* LibreSolar charge controller firmware + * Copyright (c) 2016-2019 Martin Jäger (www.libre.solar) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "config.h" + +#include + +#include "bat_charger.h" +#include "dc_bus.h" +#include "log.h" +#include "pwm_switch.h" + +extern LogData log_data; +extern Charger charger; +extern BatConf bat_conf; +extern BatConf bat_conf_user; +extern Dcdc dcdc; +extern LoadOutput load; +extern DcBus hv_terminal; +extern DcBus lv_bus_int; +extern DcBus lv_terminal; +extern DcBus load_terminal; +extern PwmSwitch pwm_switch; diff --git a/src/uext/uext_oled.cpp b/src/uext/uext_oled.cpp index ef0cb1e..439ec27 100644 --- a/src/uext/uext_oled.cpp +++ b/src/uext/uext_oled.cpp @@ -16,29 +16,15 @@ #ifndef UNIT_TEST -#include "config.h" +#include "main.h" +extern DcBus *bat_terminal; +extern DcBus *solar_terminal; #ifdef OLED_ENABLED // otherwise don't compile code to reduce firmware size #include "uext.h" #include "pcb.h" -#include "half_bridge.h" -#include "dcdc.h" -#include "pwm_switch.h" -#include "dc_bus.h" -#include "bat_charger.h" -#include "load.h" -#include "log.h" - -extern LogData log_data; -extern Dcdc dcdc; -extern DcBus *solar_terminal; -extern DcBus *bat_terminal; -extern DcBus load_terminal; -extern Charger charger; -extern LoadOutput load; - #include "Adafruit_SSD1306.h" const unsigned char bmp_load [] = {