Dependencies:   CMSIS-DSP_for_STM32F746G BSP_DISCO_F746NG

signal_processing.cpp

Committer:
bmazzeo
Date:
2019-12-31
Revision:
23:d938f87dd1ee
Child:
24:9ac1187f9012

File content as of revision 23:d938f87dd1ee:

/**
  ******************************************************************************
  * @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"


/**
  * @brief  Process audio channel signals
  * @param  L_channel: Pointer to Left channel data (float)
  * @param  R_channel: Pointer to Right channel data (float)
  * @param  Signal_Length: length of data to process
  * @retval None
  */
void process_audio_channel_signals(float* L_channel, float* R_channel, uint16_t Signal_Length)
{
    char buf[40];
    
    BSP_LCD_SetTextColor(LCD_COLOR_CYAN);
    sprintf(buf, "Processing Signals" );
    BSP_LCD_DisplayStringAt(0, 150, (uint8_t *) buf, LEFT_MODE);
    
    uint16_t i;
    float* L_chan_mem_address;
    float* R_chan_mem_address;
    float L_audio_value;
    float R_audio_value;
        
    L_chan_mem_address = L_channel;
    R_chan_mem_address = R_channel;
    
    for (i=0; i<Signal_Length; i++)
   {
        L_audio_value = *L_chan_mem_address;
        *L_chan_mem_address = L_audio_value * 2;
        L_chan_mem_address++;
        
        R_audio_value = *R_chan_mem_address;
        *R_chan_mem_address = R_audio_value / 2;
        R_chan_mem_address++;
   }

}