ADC & DMA renamed to DAQ (data acquisition)

This commit is contained in:
Martin Jaeger
2020-01-27 15:13:53 +01:00
parent dc394cc198
commit 05292c12ba
16 changed files with 199 additions and 193 deletions
+8 -17
View File
@@ -20,12 +20,12 @@
#include "dcdc.h" // DC/DC converter control (hardware independent)
#include "pwm_switch.h" // PWM charge controller
#include "bat_charger.h" // battery settings and charger state machine
#include "adc_dma.h" // ADC using DMA and conversion to measurement values
#include "ext/ext.h" // communication interfaces, displays, etc. in UEXT connector
#include "daq.h" // ADC using DMA and conversion to measurement values
#include "ext/ext.h" // communication interfaces, displays, etc. in UEXT connector
#include "eeprom.h" // external I2C EEPROM
#include "load.h" // load and USB output management
#include "leds.h" // LED switching using charlieplexing
#include "device_status.h" // log data (error memory, min/max measurements, etc.)
#include "device_status.h" // log data (error memory, min/max measurements, etc.)
#include "data_objects.h" // for access to internal data via ThingSet
PowerPort lv_terminal; // low voltage terminal (battery for typical MPPT)
@@ -100,17 +100,8 @@ void main(void)
//ts.set_user_password(THINGSET_USER_PASSWORD); // passwords defined in config.h (see template)
//ts.set_maker_password(THINGSET_MAKER_PASSWORD);
// ADC, DMA and sensor calibration
adc_setup();
dma_setup();
struct k_timer adc_trigger_timer;
k_timer_init(&adc_trigger_timer, adc_trigger_conversion, NULL);
k_timer_start(&adc_trigger_timer, K_MSEC(1), K_MSEC(1)); // 1 kHz
k_sleep(500); // wait for ADC to collect some measurement values
update_measurements();
calibrate_current_sensors();
// Data Acquisition (DAQ) setup
daq_setup();
// initialize all extensions and external communication interfaces
ext_mgr.enable_all();
@@ -145,10 +136,10 @@ void control_thread()
while (1) {
// convert ADC readings to meaningful measurement values
update_measurements();
daq_update();
// alerts should trigger only for transients, so update based on actual voltage
adc_set_lv_alerts(lv_terminal.voltage * 1.2, lv_terminal.voltage * 0.8);
daq_set_lv_alerts(lv_terminal.voltage * 1.2, lv_terminal.voltage * 0.8);
#if CONFIG_HAS_PWM_SWITCH
ports_update_current_limits(&pwm_port_int, &bat_terminal, &load_terminal);
@@ -158,7 +149,7 @@ void control_thread()
#if CONFIG_HAS_DCDC_CONVERTER
ports_update_current_limits(&dcdc_lv_port, &bat_terminal, &load_terminal);
dcdc.control(); // control of DC/DC including MPPT algorithm
//dcdc.control(); // control of DC/DC including MPPT algorithm
leds_set_charging(half_bridge_enabled());
#endif