Remove all board.h files
Final updates to devicetree files (adding temperature sensor information) make board.h files obsolete.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user