diff --git a/src/adc_dma.cpp b/src/adc_dma.cpp index 975ebed..b381395 100644 --- a/src/adc_dma.cpp +++ b/src/adc_dma.cpp @@ -292,6 +292,11 @@ void adc_setup() ref_i_dcdc = 0.1; // reference voltage for zero current (0.1 for buck, 0.9 for boost, 0.5 for bi-directional) #endif +#ifdef PIN_V_SOLAR_EN + DigitalOut solar_en(PIN_V_SOLAR_EN); + solar_en = 1; +#endif + ADC_HandleTypeDef hadc; ADC_ChannelConfTypeDef sConfig = {0}; diff --git a/src/pcbs/pcb_cs_06.h b/src/pcbs/pcb_cs_06.h index 5afb5f4..ea6cab6 100644 --- a/src/pcbs/pcb_cs_06.h +++ b/src/pcbs/pcb_cs_06.h @@ -47,6 +47,8 @@ #define PIN_REF_I_DCDC PA_4 +#define PIN_TEMP_INT_PD PA_8 + enum pin_state_t { PIN_HIGH, PIN_LOW, PIN_FLOAT }; // assignment LED numbers on PCB to their meaning @@ -73,15 +75,16 @@ static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { }; // pin definition only needed in adc_dma.cpp to detect if they are present on the PCB -//#define PIN_ADC_TEMP_FETS PA_5 +#define PIN_ADC_TEMP_BAT // typical value for Semitec 103AT-5 thermistor: 3435 #define NTC_BETA_VALUE 3435 +#define NTC_SERIES_RESISTOR 10000.0 #define ADC_GAIN_V_BAT (105.6 / 5.6) // both voltage dividers: 100k + 5.6k #define ADC_GAIN_V_SOLAR (105.6 / 5.6) -#define ADC_GAIN_I_LOAD (1000 / 4 / 50) // amp gain: 50, resistor: 4 mOhm -#define ADC_GAIN_I_DCDC (1000 / 4 / 50) +#define ADC_GAIN_I_LOAD (1000.0 / 3.0 / 50.0) // amp gain: 50, resistor: 3 mOhm +#define ADC_GAIN_I_DCDC (1000.0 / 3.0 / 50.0) // position in the array written by the DMA controller enum {