Minimize contract, add ADC read and send its data to coonsole

This commit is contained in:
2026-04-13 00:04:48 +03:00
parent 732a2dfa32
commit 977227296e
12 changed files with 269 additions and 67 deletions

View File

@@ -0,0 +1,39 @@
#include "sampler_task.h"
#include "adc_reader.h"
#include "ringbuf.h"
extern "C" {
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
}
// буфер объявим здесь (глобальный для простоты)
static ringbuf_t rb;
// дать доступ другим модулям (sender потом возьмёт)
ringbuf_t* sampler_get_buffer() {
return &rb;
}
static void sampler_task(void *arg) {
while (1) {
int val = adc_reader_read();
ringbuf_push(&rb, val);
vTaskDelay(pdMS_TO_TICKS(100)); // 10 Гц
}
}
void sampler_task_start() {
ringbuf_init(&rb);
adc_reader_init();
xTaskCreate(
sampler_task,
"sampler",
2048,
NULL,
5,
NULL
);
}