Commit dc309e52 authored by Clément Foucher's avatar Clément Foucher
Browse files

Use timer 7 for OwnTech data acquisition module so that it can run fully in...

Use timer 7 for OwnTech data acquisition module so that it can run fully in background without requiring user calls.
parent dddc3fef
......@@ -22,21 +22,52 @@
*/
/////
// OwnTech Power API includes
#include "timer.h"
#include "dma/dma.h"
#include "adc/adc.h"
#include "data_dispatch/data_dispatch.h"
/////
// Timer
#define TIMER7_LABEL DT_PROP(DT_NODELABEL(timers7), label)
static const struct device* timer7;
/////
// Public functions
// Private functions
/////
// Public API
void data_acquisition_init()
{
/////
// Initialize peripherals
/////
// Initialize peripherals
// ADC
adc_init();
// DMA
dma_init();
// ADC
adc_init();
/////
// Initialize data dispatch
data_dispatch_init();
// DMA
dma_init();
/////
// Configure timer for background data dispatch
timer7 = device_get_binding(TIMER7_LABEL);
struct timer_config_t timer_cfg =
{
.timer_enable_irq = 1,
.timer_callback = data_dispatch_do_dispatch
};
timer_config(timer7, &timer_cfg);
timer_start(timer7, 25);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment