Implementation file for signal processing and FFT operations. More...
#include "adc.h"
#include "dac.h"
#include "tim.h"
#include "lvgl.h"
#include "ui.h"
#include "app_tasks.h"
#include "app_signal.h"
Functions | |
void | sig_start (SIG_Handle_t *const handle) |
Initializes and starts the signal processing components. | |
void | sig_load_samples (SIG_Handle_t *const handle, uint8_t flag) |
Loads samples into the processing buffers. | |
size_t | sig_perform_fft (SIG_Handle_t *const handle) |
Performs Fast Fourier Transform (FFT) on the signal data. | |
void | HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc) |
Callback function for ADC conversion complete interrupt. | |
void | HAL_ADC_ConvHalfCpltCallback (ADC_HandleTypeDef *hadc) |
Callback function for ADC half conversion complete interrupt. | |
Variables | |
const uint32_t | OUTPUT_SINE_SIGNAL [OUTPUT_SINE_SIGNAL_LEN] = {2048, 3251, 3995, 3996, 3253, 2051, 847, 101, 98, 839} |
const uint32_t | OUTPUT_AUDIO_SIGNAL [OUTPUT_SINE_AUDIO_LEN] |
SIG_Handle_t | sig_handle = {0} |
Implementation file for signal processing and FFT operations.
This file contains the implementation for handling signal processing tasks, including ADC and DAC setup, sample loading, and FFT operations. Functions include initialization of ADC and DAC, loading samples from the ADC buffer, performing FFT, and handling ADC conversion complete callbacks. The file interfaces with the hardware and performs signal analysis using the CMSIS DSP library.
Created on: Jul 5, 2024 Author: Viktor
void HAL_ADC_ConvCpltCallback | ( | ADC_HandleTypeDef * | hadc | ) |
Callback function for ADC conversion complete interrupt.
This function is called when the ADC conversion is complete. It places a flag in the message queue to indicate that the ADC data is ready for processing.
hadc | Pointer to the ADC_HandleTypeDef structure. |
void HAL_ADC_ConvHalfCpltCallback | ( | ADC_HandleTypeDef * | hadc | ) |
Callback function for ADC half conversion complete interrupt.
This function is called when half of the ADC conversion is complete. It places a flag in the message queue to indicate that the first half of the ADC data is ready for processing.
hadc | Pointer to the ADC_HandleTypeDef structure. |
void sig_load_samples | ( | SIG_Handle_t *const | handle, |
uint8_t | flag ) |
Loads samples into the processing buffers.
Loads samples from the ADC buffer into the processing buffers.
This function copies samples from the input buffer to the processing buffers for further signal analysis. The samples are loaded based on the provided flag.
handle | Pointer to the SIG_Handle_t structure containing the buffers. |
flag | Flag indicating the completion status of ADC conversion. |
size_t sig_perform_fft | ( | SIG_Handle_t *const | handle | ) |
Performs Fast Fourier Transform (FFT) on the signal data.
Performs FFT on the loaded signal data and computes magnitude and phase.
This function calculates the FFT of the input signals for both the receive and transmit coils. It then computes the magnitude and phase of the frequency domain data and returns the index of the maximum magnitude value.
handle | Pointer to the SIG_Handle_t structure containing the signal data. |
void sig_start | ( | SIG_Handle_t *const | handle | ) |
Initializes and starts the signal processing components.
Starts the signal processing by initializing ADC and DAC, and starting timers.
This function initializes the ADC and DAC peripherals, starts the ADC conversion in DMA mode, and begins the DAC output with a sine wave signal. It also starts the timer used for signal processing.
handle | Pointer to the SIG_Handle_t structure containing the configuration. |
const uint32_t OUTPUT_AUDIO_SIGNAL[OUTPUT_SINE_AUDIO_LEN] |
SIG_Handle_t sig_handle = {0} |
Global handle for signal processing