Remove all board.h files
Final updates to devicetree files (adding temperature sensor information) make board.h files obsolete.
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef MPPT_1210_HUS_H
|
||||
#define MPPT_1210_HUS_H
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 10000.0
|
||||
|
||||
|
||||
#endif
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
temp-bat {
|
||||
io-channels = <&adc1 7>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>;
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
temp-mcu {
|
||||
io-channels = <&adc1 18>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>;
|
||||
divider = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef MPPT_2420_HPX_H
|
||||
#define MPPT_2420_HPX_H
|
||||
|
||||
// pin definition only needed in adc_dma.cpp to detect if they are present on the PCB
|
||||
//#define PIN_ADC_TEMP_FETS PA_5
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 10000.0
|
||||
/*
|
||||
// position in the array written by the DMA controller
|
||||
enum {
|
||||
// ADC1
|
||||
ADC_POS_V_LOW,
|
||||
ADC_POS_V_HIGH,
|
||||
ADC_POS_V_SC_SENSE,
|
||||
ADC_POS_V_PWM,
|
||||
ADC_POS_TEMP_FETS,
|
||||
ADC_POS_VREF_MCU,
|
||||
ADC_POS_TEMP_MCU,
|
||||
// ADC2
|
||||
ADC_POS_I_DCDC,
|
||||
ADC_POS_I_LOAD,
|
||||
ADC_POS_I_PWM,
|
||||
NUM_ADC_CH // trick to get the number of elements
|
||||
};
|
||||
|
||||
// selected ADC channels (has to match with below arrays)
|
||||
#define NUM_ADC_1_CH 7
|
||||
#define NUM_ADC_2_CH 3
|
||||
|
||||
static const uint32_t adc_1_sequence[] = {
|
||||
LL_ADC_CHANNEL_12, // V_LOW
|
||||
LL_ADC_CHANNEL_15, // V_HIGH
|
||||
LL_ADC_CHANNEL_11, // V_SC_SENSE
|
||||
LL_ADC_CHANNEL_4, // V_PWM
|
||||
LL_ADC_CHANNEL_6, // TEMP_FETS
|
||||
LL_ADC_CHANNEL_VREFINT, // VREF_MCU
|
||||
LL_ADC_CHANNEL_TEMPSENSOR_ADC1, // TEMP_MCU
|
||||
};
|
||||
|
||||
static const uint32_t adc_2_sequence[] = {
|
||||
LL_ADC_CHANNEL_1, // I_DCDC
|
||||
LL_ADC_CHANNEL_2, // I_LOAD
|
||||
LL_ADC_CHANNEL_5, // I_PWM
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
temp-fets {
|
||||
io-channels = <&adc1 6>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>; // 10k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef MPPT_2420_LC_H
|
||||
#define MPPT_2420_LC_H
|
||||
|
||||
#define CONFIG_CAN 1
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 10000.0
|
||||
|
||||
#endif
|
||||
@@ -85,13 +85,13 @@
|
||||
|
||||
temp-bat {
|
||||
io-channels = <&adc1 0>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>; // 10k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
temp-fets {
|
||||
io-channels = <&adc1 1>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>; // 10k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef MPPT_2420_RC_H
|
||||
#define MPPT_2420_RC_H
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 10000.0
|
||||
|
||||
#endif
|
||||
@@ -82,13 +82,13 @@
|
||||
|
||||
temp-fets {
|
||||
io-channels = <&adc1 2>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>; // 10k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
temp-bat {
|
||||
io-channels = <&adc1 14>;
|
||||
multiplier = <1>;
|
||||
multiplier = <10000>; // 10k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef PWM_2420_LUS_H
|
||||
#define PWM_2420_LUS_H
|
||||
|
||||
#define PIN_I_LOAD_COMP PB_4
|
||||
|
||||
#define PIN_EXT_BTN PB_12
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 8200.0
|
||||
|
||||
#endif
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
temp-bat {
|
||||
io-channels = <&adc1 7>;
|
||||
multiplier = <1>;
|
||||
multiplier = <8200>; // 8.2k NTC series resistor
|
||||
divider = <1>;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "helper.h"
|
||||
#include "device_status.h"
|
||||
|
||||
|
||||
+11
-6
@@ -14,7 +14,9 @@
|
||||
#include "mcu.h"
|
||||
#include "setup.h"
|
||||
#include "debug.h"
|
||||
#include "board.h" // contains defines for pins
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
|
||||
#if DT_NODE_EXISTS(DT_PATH(dcdc))
|
||||
static float dcdc_current_offset;
|
||||
@@ -57,14 +59,17 @@ static inline float adc_scaled(uint32_t channel, int32_t vref, const float gain,
|
||||
return adc_raw_to_voltage(adc_raw_filtered(channel) - offset, vref) * gain;
|
||||
}
|
||||
|
||||
static inline float ntc_temp(uint32_t channel, int32_t vref)
|
||||
static inline float ntc_temp(uint32_t channel, int32_t vref, float ntc_series_resistor)
|
||||
{
|
||||
/** \todo Improved (faster) temperature calculation:
|
||||
https://www.embeddedrelated.com/showarticle/91.php
|
||||
*/
|
||||
|
||||
float v_temp = adc_raw_to_voltage(adc_raw_filtered(channel), vref) * 1000; // voltage read by ADC (mV)
|
||||
float rts = NTC_SERIES_RESISTOR * v_temp / (vref - v_temp); // resistance of NTC (Ohm)
|
||||
// voltage read by ADC (mV)
|
||||
float v_temp = adc_raw_to_voltage(adc_raw_filtered(channel), vref) * 1000;
|
||||
|
||||
// resistance of NTC (Ohm)
|
||||
float rts = ntc_series_resistor * v_temp / (vref - v_temp);
|
||||
|
||||
return 1.0/(1.0/(273.15+25) + 1.0/NTC_BETA_VALUE*log(rts/10000.0)) - 273.15; // °C
|
||||
}
|
||||
@@ -186,7 +191,7 @@ void daq_update()
|
||||
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(adc_inputs), temp_bat))
|
||||
// battery temperature calculation
|
||||
float bat_temp = ntc_temp(ADC_POS(temp_bat), vref);
|
||||
float bat_temp = ntc_temp(ADC_POS(temp_bat), vref, ADC_GAIN(temp_bat));
|
||||
|
||||
if (bat_temp > -50) {
|
||||
// external sensor connected: take measured value
|
||||
@@ -202,7 +207,7 @@ void daq_update()
|
||||
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(adc_inputs), temp_fets))
|
||||
// MOSFET temperature calculation
|
||||
dcdc.temp_mosfets = ntc_temp(ADC_POS(temp_fets), vref);
|
||||
dcdc.temp_mosfets = ntc_temp(ADC_POS(temp_fets), vref, ADC_GAIN(temp_fets));
|
||||
#endif
|
||||
|
||||
// internal MCU temperature
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#endif
|
||||
|
||||
#include "dcdc.h" // for low-level control function called by DMA
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
|
||||
#if defined(CONFIG_SOC_SERIES_STM32F0X) || defined(CONFIG_SOC_SERIES_STM32L0X)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "version.h"
|
||||
|
||||
// can be used to configure custom data objects in separate file instead
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <stdlib.h> // for min/max function
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "device_status.h"
|
||||
#include "debug.h"
|
||||
#include "helper.h"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "setup.h"
|
||||
#include "helper.h"
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#endif
|
||||
|
||||
#include "mcu.h"
|
||||
#include "board.h"
|
||||
#include "thingset.h"
|
||||
#include "data_nodes.h"
|
||||
#include "helper.h"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "setup.h"
|
||||
#include "half_bridge.h"
|
||||
#include "board.h"
|
||||
#include "oled_ssd1306.h"
|
||||
|
||||
// implement specific extension inherited from ExtInterface
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mcu.h"
|
||||
#include "board.h"
|
||||
|
||||
static uint16_t tim_arr; // auto-reload register (defines PWM frequency)
|
||||
static uint16_t tim_ccr_min; // capture/compare register min/max
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "hardware.h"
|
||||
|
||||
#include "mcu.h"
|
||||
#include "board.h"
|
||||
#include "load.h"
|
||||
#include "half_bridge.h"
|
||||
#include "leds.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), load)) || UNIT_TEST
|
||||
|
||||
#include "board.h"
|
||||
#include "leds.h"
|
||||
#include "device_status.h"
|
||||
#include "debug.h"
|
||||
|
||||
+2
-1
@@ -31,11 +31,12 @@ static struct device *dev_load;
|
||||
static struct device *dev_usb;
|
||||
#endif
|
||||
|
||||
#include "board.h"
|
||||
#include "hardware.h"
|
||||
#include "debug.h"
|
||||
#include "leds.h"
|
||||
|
||||
/* TODO: porting and testing of comparator copied from mbed */
|
||||
|
||||
#if defined(PIN_I_LOAD_COMP) && PIN_LOAD_DIS == PB_2
|
||||
static void lptim_init()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <drivers/gpio.h>
|
||||
|
||||
#include "thingset.h" // handles access to internal data via communication interfaces
|
||||
#include "board.h" // hardware-specific settings
|
||||
#include "setup.h"
|
||||
#include "helper.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "mcu.h"
|
||||
#include "daq.h"
|
||||
#include "debug.h"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "daq.h"
|
||||
#include "debug.h"
|
||||
#include "helper.h"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <zephyr.h>
|
||||
|
||||
#include "thingset.h" // handles access to internal data via communication interfaces
|
||||
#include "board.h" // hardware-specific settings
|
||||
|
||||
#include "half_bridge.h" // PWM generation for DC/DC converter
|
||||
#include "hardware.h" // hardware-related functions like load switch, LED control, watchdog, etc.
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "power_port.h"
|
||||
#include "pwm_switch.h"
|
||||
#include "thingset.h"
|
||||
#include "board.h"
|
||||
|
||||
extern DcBus lv_bus;
|
||||
extern PowerPort lv_terminal;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// PWM charge controller
|
||||
#define CONFIG_PWM_TERMINAL_SOLAR 1
|
||||
|
||||
// MPPT buck/boost or nanogrid mode
|
||||
#define CONFIG_HV_TERMINAL_SOLAR 1
|
||||
#define CONFIG_HV_TERMINAL_NANOGRID 0
|
||||
|
||||
// battery always assumed to be at low-voltage terminal (might need to be changed for boost mode)
|
||||
#define CONFIG_LV_TERMINAL_BATTERY 1
|
||||
|
||||
#define CONFIG_THINGSET_EXPERT_PASSWORD "expert123"
|
||||
#define CONFIG_THINGSET_MAKER_PASSWORD "maker456"
|
||||
|
||||
// Values that are otherwise defined by Kconfig
|
||||
#define CONFIG_CONTROL_FREQUENCY 10 // Hz
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Martin Jäger / Libre Solar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef PCB_STUB_H
|
||||
#define PCB_STUB_H
|
||||
|
||||
// PWM charge controller
|
||||
#define CONFIG_PWM_TERMINAL_SOLAR DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), pwm_switch))
|
||||
|
||||
// MPPT buck/boost or nanogrid mode
|
||||
#define CONFIG_HV_TERMINAL_SOLAR DT_NODE_EXISTS(DT_PATH(dcdc))
|
||||
#define CONFIG_HV_TERMINAL_NANOGRID 0
|
||||
|
||||
// battery always assumed to be at low-voltage terminal (might need to be changed for boost mode)
|
||||
#define CONFIG_LV_TERMINAL_BATTERY 1
|
||||
|
||||
// basic battery configuration
|
||||
#define BATTERY_TYPE BAT_TYPE_GEL ///< GEL most suitable for general batteries (see battery.h for other types)
|
||||
#define BATTERY_NUM_CELLS 6 ///< For lead-acid batteries: 6 for 12V system, 12 for 24V system
|
||||
#define BATTERY_CAPACITY 40 ///< Cell capacity or sum of parallel cells capacity (Ah)
|
||||
|
||||
#define CONFIG_DEVICE_ID 12345678
|
||||
|
||||
#define CONFIG_THINGSET_EXPERT_PASSWORD "expert123"
|
||||
#define CONFIG_THINGSET_MAKER_PASSWORD "maker456"
|
||||
|
||||
// Values that are otherwise defined by Kconfig
|
||||
#define CONFIG_CONTROL_FREQUENCY 10 // Hz
|
||||
|
||||
// pin definition only needed in adc_dma.cpp to detect if they are present on the PCB
|
||||
#define PIN_ADC_TEMP_BAT
|
||||
|
||||
// typical value for Semitec 103AT-5 thermistor: 3435
|
||||
#define NTC_BETA_VALUE 3435
|
||||
#define NTC_SERIES_RESISTOR 8200.0
|
||||
|
||||
#endif
|
||||
@@ -36,6 +36,8 @@
|
||||
* ADC
|
||||
*/
|
||||
#define DT_N_S_adc_inputs_S_temp_bat_EXISTS 1
|
||||
#define DT_N_S_adc_inputs_S_temp_bat_P_multiplier 10000
|
||||
#define DT_N_S_adc_inputs_S_temp_bat_P_divider 1
|
||||
|
||||
#define DT_N_S_adc_inputs_S_v_high_P_multiplier 105600
|
||||
#define DT_N_S_adc_inputs_S_v_high_P_divider 5600
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "devicetree.h"
|
||||
#include "devicetree_unfixed.h"
|
||||
#include "autoconf.h"
|
||||
|
||||
#ifndef __deprecated
|
||||
#define __deprecated __attribute__((deprecated))
|
||||
|
||||
Reference in New Issue
Block a user