initial
Dependencies: mbed BSP_DISCO_F746NG mbed-dsp
Diff: signal_processing.cpp
- Revision:
- 0:c0f52e8223fe
- Child:
- 1:103e3e426b55
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/signal_processing.cpp Fri Jan 31 21:41:25 2020 +0000 @@ -0,0 +1,104 @@ +/** + ****************************************************************************** + * @file signal_processing.c + * @author Brian Mazzeo + * @date 2020 + * @brief This file provides a set of code for signal processing in 487. + * Parts are taken from example code from STMIcroelectronics + ****************************************************************************** + * @attention + * This code was specifically developed for BYU ECEn 487 course + * Introduction to Digital Signal Processing. + * + * + ****************************************************************************** + */ + +#include "mbed.h" +#include "stm32746g_discovery_lcd.h" +#include "arm_math.h" +#include "arm_const_structs.h" +#include "filter_coefficients.h" + + +/* ---------------------------------------------------------------------- +** Defines for signal processing +** ------------------------------------------------------------------- */ + +#define AUDIO_BLOCK_SAMPLES ((uint32_t)128) // Number of samples (L and R) in audio block (each samples is 16 bits) + +/* For Lab Exercise */ +#define Lab_Execution_Type 0 + + + +/* FUNCTION DEFINITIONS BELOW */ + +/** + * @brief Initialize filter structures to be used in loops later + * @retval None + */ +void initalize_signal_processing(void) { + + switch (Lab_Execution_Type) + { + case 0: // Passthrough case + break; + + case 1: // FIR case (ARM) + break; + + case 2: // FIR case (student) + break; + + case 3: // FFT Overlap-add + break; + + case 4: // FFT Overlap-add with real-imag efficiency + break; + + + } +} + +/** + * @brief Process audio channel signals + * @param L_channel_in: Pointer to Left channel data input (float32_t) + * @param R_channel_in: Pointer to Right channel data input (float32_t) + * @param L_channel_out: Pointer to Left channel data output (float32_t) + * @param R_channel_out: Pointer to Right channel data output (float32_t) + * @param Signal_Length: length of data to process + * @retval None + */ +void process_audio_channel_signals(float32_t* L_channel_in, float32_t* R_channel_in, float32_t* L_channel_out, float32_t* R_channel_out, uint16_t Signal_Length) +{ + char buf[70]; + BSP_LCD_SetFont(&Font8); + BSP_LCD_SetTextColor(LCD_COLOR_CYAN); + sprintf(buf, "Processing Signals" ); + BSP_LCD_DisplayStringAt(0, 200, (uint8_t *) buf, LEFT_MODE); + + switch(Lab_Execution_Type) + { + case 0: // Passthrough case + arm_copy_f32(L_channel_in, L_channel_out, AUDIO_BLOCK_SAMPLES); + arm_copy_f32(R_channel_in, R_channel_out, AUDIO_BLOCK_SAMPLES); + break; + + case 1: // FIR case (ARM) + break; + + case 2: // FIR case (student) + break; + + case 3: // FFT Overlap-add + break; + + case 4: // FFT Overlap-add with real-imag efficiency + break; + + + } + /* Change font back */ + BSP_LCD_SetFont(&Font16); +}