10 #include "stm32l4xx_hal.h" 11 #include "stm32l476g_discovery.h" 50 static volatile uint32_t *
inbuf;
125 working[i] = ((float)((
int)
inbuf[i]-32767))*3.0517578e-05f;
153 outbuf[i] = ((int)((working[i]+1.0)*32768.0f)) & 0x0000ffff;
176 outbuf[i] = ( ((int)((chan2[i]+1.0)*32768.0f)) & 0x0000ffff ) |
177 ((((
int)((chan1[i]+1.0)*32768.0f)) & 0x0000ffff)<<16);
211 chan1[i]=((float)( (
int)(
inbuf[i]&0x0000ffff)-32767))*3.0517578e-05f;
212 chan2[i]=((float)( (
int)((
inbuf[i]&0xffff0000)>>16)-32767))*3.0517578e-05f;
volatile uint32_t * ADC_Input_Buffer
Buffer to store samples transfered from the ADC by a DMA.
static volatile uint32_t * inbuf
volatile int Lower_Ready
Flag to indicate which half of ADC buffer may be processed.
Mono Input: Only configure ADC1, single DMA Transfer.
static volatile uint32_t * outbuf
enum Processor_Task volatile Sampler_Status
User is working on a buffer of data.
void getblockstereo(float *chan1, float *chan2)
Request a block of data from the two ADC sample streams (Stereo input case)
volatile uint32_t * DAC_Output_Buffer
Buffer to hold samples to be transfered to the DAC(s) by a DMA.
void setblocksize(uint32_t blksiz)
Set the number of samples that the user should expect to process per block.
uint32_t ADC_Buffer_Size
Total buffer size being filled by DMA for ADC/DAC.
void flagerror(int errorcode)
Records and indicates an error condition.
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc)
void getblock(float *working)
Request a block of data from the ADC sample stream.
#define SETBLOCKSIZE_ERROR
setblocksize() must be called BEFORE initialize()
User is done working... waiting for the next buffer.
enum Num_Channels_Out Output_Configuration
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
void putblock(float *working)
Send a buffer of data to the DAC output stream.
ECE 486 Interface fuctions to manipulate blocks of sampled data.
Error Handling for ECE 486 STM32L476G-Discovery Interface.
Processor_Task
keep track of whether a user is working on a buffer, or waiting for the next buffer ...
int getblocksize()
Return the number of samples that the user should expect to process per block.
Mono Output: Only configure DAC1, single DMA Transfer.
uint32_t ADC_Block_Size
Number of samples user accesses per data block.
void putblockstereo(float *chan1, float *chan2)
Send two buffers of data to the DACs for stereo output.
User is not ready for data yet.
enum Num_Channels_In Input_Configuration
#define DEFAULT_BLOCKSIZE
Default # samples per block of streamed ADC/DAC data.
#define SAMPLE_OVERRUN
ADC buffer filled before the user serviced the buffer.