![]() |
Zap'Em Blast'Em Robots
robots that play laser tag!
|
ADC task driver for managing DMA-based ADC value acquisition and assignment. More...
#include "adc_task.h"
#include "stm32f4xx_hal_tim.h"
#include <stdio.h>
#include "controller_task.h"
#include "photoresistor_task.h"
Functions | |
void | adc_task_run (ADCTask *adc_task) |
Executes the current state of the ADC task. | |
void | adc_task_state_0_init (ADCTask *adc_task) |
Initializes the ADC task. | |
void | adc_task_state_1_read (ADCTask *adc_task) |
Reads ADC values from DMA buffer and assigns them to respective photo resistors and controllers. |
ADC task driver for managing DMA-based ADC value acquisition and assignment.
Created on: Jun 5, 2025
void adc_task_run | ( | ADCTask * | adc_task | ) |
Executes the current state of the ADC task.
Executes the current ADC task state.
This function checks the validity of the current state, then calls the corresponding state handler from the state's function pointer list.
adc_task | Pointer to the ADCTask structure containing state and hardware info. |
void adc_task_state_0_init | ( | ADCTask * | adc_task | ) |
Initializes the ADC task.
Initializes the ADC task (state 0).
Sets the task's state to 1 and starts the ADC with DMA to fill the dma_buffer.
adc_task | Pointer to the ADCTask structure. |
void adc_task_state_1_read | ( | ADCTask * | adc_task | ) |
Reads ADC values from DMA buffer and assigns them to respective photo resistors and controllers.
Reads and assigns values from the ADC DMA buffer (state 1).
This function maps each DMA buffer value to its corresponding sensor's adc_val.
adc_task | Pointer to the ADCTask structure. |