lab 3
Dependencies: mbed BSP_DISCO_F746NG mbed-dsp
Diff: main.cpp
- Revision:
- 3:02dd3dd9120a
- Parent:
- 0:c0f52e8223fe
--- a/main.cpp Tue Mar 10 17:25:30 2020 +0000 +++ b/main.cpp Tue Mar 10 23:55:33 2020 +0000 @@ -21,6 +21,7 @@ #include "stm32746g_discovery_lcd.h" #include "arm_math.h" #include "signal_processing.h" +#include "spectrum.h" /* The following type definitions are used to control the * buffering of the audio data using a double buffering technique. @@ -105,6 +106,9 @@ BSP_LCD_DisplayStringAt(0, OSC_Y_POS - 20, (uint8_t *)"L", LEFT_MODE); BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(0, OSC_Y_POS, (uint8_t *)"R", LEFT_MODE); + + //Set up the spectrum background display + Draw_Spectrum_Background(); /* The following code should not be code that you need to worry about - it sets up the audio interfaces. */ /* Initialize the Audio Interface */ @@ -152,6 +156,8 @@ Erase_Trace(OSC_START_X_POS, OSC_Y_POS, AUDIO_BLOCK_SAMPLES); Draw_Trace(OSC_START_X_POS, OSC_Y_POS, (uint16_t *) AUDIO_BUFFER_IN, AUDIO_BLOCK_SAMPLES); + + /* Convert data to floating point representation for processing */ Audio_to_Float((uint16_t *) AUDIO_BUFFER_IN, L_channel_float_in_p, R_channel_float_in_p, AUDIO_BLOCK_SAMPLES); @@ -159,6 +165,7 @@ /* Here is where signal processing can be done on the floating point arrays */ process_audio_channel_signals(L_channel_float_in_p, R_channel_float_in_p, L_channel_float_out_p, R_channel_float_out_p, AUDIO_BLOCK_SAMPLES); + FFT_audio_input(L_channel_float_in_p, R_channel_float_in_p, AUDIO_BLOCK_SAMPLES); /* Here is where signal processing can end on the floating point arrays */ /* -------------------------------------------------------------------- */ @@ -196,6 +203,7 @@ /* Here is where signal processing can be done on the floating point arrays */ process_audio_channel_signals(L_channel_float_in_p, R_channel_float_in_p, L_channel_float_out_p, R_channel_float_out_p, AUDIO_BLOCK_SAMPLES); + FFT_audio_input(L_channel_float_in_p, R_channel_float_in_p, AUDIO_BLOCK_SAMPLES); /* Here is where signal processing can end on the floating point arrays */ /* -------------------------------------------------------------------- */ @@ -290,6 +298,12 @@ } + + + + + + /** * @brief Converts audio data in buffer to floating point representation. * @param buffer_in: Pointer to Audio buffer start location