![]() |
Zap'Em Blast'Em Robots
robots that play laser tag!
|
Header file for the ADC task system. More...
#include <stdlib.h>
#include <stdio.h>
#include "stm32f4xx_hal.h"
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | ADCTask |
Structure that represents the ADC task state and configuration. More... |
Typedefs | |
typedef struct ControllerTask | ControllerTask |
Forward declaration for ControllerTask. | |
typedef struct PhotoresistorTask | PhotoresistorTask |
Forward declaration for PhotoresistorTask. | |
typedef struct ADCTask | ADCTask |
Forward declaration for ADCTask. | |
typedef void(* | adc_fcn_t) (ADCTask *adc_task) |
Function pointer type for ADC state functions. |
Functions | |
void | adc_task_state_0_init (ADCTask *adc_task) |
Initializes the ADC task (state 0). | |
void | adc_task_run (ADCTask *adc_task) |
Executes the current ADC task state. | |
void | adc_task_state_1_read (ADCTask *adc_task) |
Reads and assigns values from the ADC DMA buffer (state 1). |
Header file for the ADC task system.
Created on: Jun 5, 2025
typedef void(* adc_fcn_t) (ADCTask *adc_task) |
Function pointer type for ADC state functions.
Each state function must take a pointer to ADCTask as its argument.
typedef struct ControllerTask ControllerTask |
Forward declaration for ControllerTask.
Forward declaration of ControllerTask structure.
typedef struct PhotoresistorTask PhotoresistorTask |
Forward declaration for PhotoresistorTask.
Forward declaration of PhotoresistorTask structure.
void adc_task_run | ( | ADCTask * | adc_task | ) |
Executes the current ADC task state.
adc_task | Pointer to the ADCTask instance. |
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 | ) |
void adc_task_state_1_read | ( | ADCTask * | adc_task | ) |
Reads and assigns values from the ADC DMA buffer (state 1).
adc_task | Pointer to the ADCTask instance. |
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. |