Metal Detector
 
Loading...
Searching...
No Matches
app_signal.h
Go to the documentation of this file.
1
14#ifndef INC_SIGNAL_H_
15#define INC_SIGNAL_H_
16
17#include <stdint.h>
18#include "arm_math.h"
19
21#define OUTPUT_SINE_SIGNAL_LEN 10
22
24#define OUTPUT_SINE_AUDIO_LEN 100
25
27#define INPUT_BUFF_LEN 2048
28
30#define BUFF_TO_DFT_LEN ( INPUT_BUFF_LEN / 2 )
31
33#define FREQ_DOMAIN_LEN ( BUFF_TO_DFT_LEN / 2 )
34
36#define POLAR_FORM_LEN FREQ_DOMAIN_LEN
37
39#define ADC_MAX_VALUE 4095
40
42#define REF_VOLTAGE 3.3f
43
45#define ADC_HALF_COMPLETE_FLAG 0
46
48#define ADC_FULL_COMPLETE_FLAG 1
49
50
54typedef struct
55{
56 uint16_t adc1;
57 uint16_t adc2;
59
60
64typedef struct
65{
66 float32_t real_part;
67 float32_t imaginary_part;
69
70
74typedef struct
75{
76 float32_t phase;
77 float32_t magnitude;
79
80
97
98
105void sig_start(SIG_Handle_t *const handle);
106
112void sig_load_samples(SIG_Handle_t *const handle, uint8_t flag);
113
119size_t sig_perform_fft(SIG_Handle_t *const handle);
120
121
122#endif /* INC_SIGNAL_H_ */
#define FREQ_DOMAIN_LEN
Number of frequency domain bins (quarter of the input buffer length).
Definition app_signal.h:33
#define BUFF_TO_DFT_LEN
Number of samples to be used for the FFT (half of the input buffer length).
Definition app_signal.h:30
struct SIG_Handle_t SIG_Handle_t
Handle structure for managing signal processing tasks.
void sig_start(SIG_Handle_t *const handle)
Starts the signal processing by initializing ADC and DAC, and starting timers.
Definition app_signal.c:52
#define POLAR_FORM_LEN
Length of the polar form array (same as frequency domain length).
Definition app_signal.h:36
SIG_Handle_t sig_handle
Definition app_signal.c:40
void sig_load_samples(SIG_Handle_t *const handle, uint8_t flag)
Loads samples from the ADC buffer into the processing buffers.
Definition app_signal.c:80
size_t sig_perform_fft(SIG_Handle_t *const handle)
Performs FFT on the loaded signal data and computes magnitude and phase.
Definition app_signal.c:110
#define INPUT_BUFF_LEN
Length of the input buffer for ADC samples.
Definition app_signal.h:27
Structure to hold ADC conversion values from two channels.
Definition app_signal.h:55
uint16_t adc2
Definition app_signal.h:57
uint16_t adc1
Definition app_signal.h:56
Structure representing a complex number in the frequency domain.
Definition app_signal.h:65
float32_t imaginary_part
Definition app_signal.h:67
float32_t real_part
Definition app_signal.h:66
Handle structure for managing signal processing tasks.
Definition app_signal.h:85
SIG_PolarForm_t rx_coil_polar[POLAR_FORM_LEN]
Definition app_signal.h:94
SIG_FreqDomain_t tx_coil_freq_domain[FREQ_DOMAIN_LEN]
Definition app_signal.h:92
SIG_FreqDomain_t rx_coil_freq_domain[FREQ_DOMAIN_LEN]
Definition app_signal.h:91
float32_t tx_coil_sig_to_dft[BUFF_TO_DFT_LEN]
Definition app_signal.h:89
SIG_PolarForm_t tx_coil_polar[POLAR_FORM_LEN]
Definition app_signal.h:95
float32_t rx_coil_sig_to_dft[BUFF_TO_DFT_LEN]
Definition app_signal.h:88
SIG_ADCRegister_t input_sig[INPUT_BUFF_LEN]
Definition app_signal.h:86
Structure representing the magnitude and phase of a frequency component.
Definition app_signal.h:75
float32_t phase
Definition app_signal.h:76
float32_t magnitude
Definition app_signal.h:77