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,12 +22,28 @@
*/
/////
// OwnTech Power API includes
#include "timer.h"
#include "dma/dma.h"
#include "adc/adc.h"
#include "data_dispatch/data_dispatch.h"
/////
// Public functions
// Timer
#define TIMER7_LABEL DT_PROP(DT_NODELABEL(timers7), label)
static const struct device* timer7;
/////
// Private functions
/////
// Public API
void data_acquisition_init()
{
......@@ -39,4 +55,19 @@ void data_acquisition_init()
// DMA
dma_init();
/////
// Initialize data dispatch
data_dispatch_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);
}
Supports Markdown
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