Added main.h for common includes and extern variables

This commit is contained in:
Martin Jaeger
2019-10-16 12:03:49 +02:00
parent 0545131a99
commit cce6e2a9b3
4 changed files with 42 additions and 48 deletions
+1 -13
View File
@@ -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 <math.h> // log for thermistor calculation
#include <stdio.h>
#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)
+2 -18
View File
@@ -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 <stdio.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_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;
+36
View File
@@ -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 <stdio.h>
#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;
+3 -17
View File
@@ -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 [] = {