Microchip® Advanced Software Framework

filter_task.c File Reference

Filtering Management Task.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <stddef.h>
#include <stdio.h>
#include <avr32/io.h>
#include "compiler.h"
#include "filter_task.h"
#include "dsp.h"
#include "conf_demo.h"

Macros

#define FIR_COEF_SIZE   25
 

Functions

void filter_task (void)
 Filter Task Function: More...
 
static void filter_task_fir (float *vect2, float *vect1, int b_length, float *h, int h_size)
 Local function of filtering through floating point implementation of FIR filter. More...
 
static void filter_task_fir_fp (dsp32_t *vect2, dsp32_t *vect1, int b_length, dsp32_t *h, int h_size)
 Local function of filtering through fixed point implementation of FIR filter. More...
 
void filter_task_init (void)
 Filter Task Init Function. More...
 

Variables

A_ALIGNED dsp32_t fir_coef32b [FIR_COEF_SIZE]
 
float fir_coef_fl [FIR_COEF_SIZE]
 
dsp16_t signalin_noise_gui [GUI_BUFFER_LENGTH]
 Reference to Signal In + Noise Signal Buff 16-bit fixed point Format scaled in GUI format for the GUI task. More...
 
volatile float signalin_noise_remote [GUI_BUFFER_LENGTH]
 Reference to Signal In + Noise Signal Buff in floating point Format scaled for the remote task. More...
 
A_ALIGNED dsp16_t signalout_fp_gui [GUI_BUFFER_LENGTH]
 Reference to Filtered Signal through 16-bit fixed point Format scaled in GUI format for the GUI task. More...
 
volatile float signalout_fp_remote [GUI_BUFFER_LENGTH]
 Reference to Filtered Signal through 16-bit fixed point Format scaled for the remote task. More...
 
A_ALIGNED dsp16_t signalout_fpu_gui [GUI_BUFFER_LENGTH]
 Reference to Filtered Signal through floating point Format scaled in GUI format for the GUI task. More...
 
volatile float signalout_fpu_remote [GUI_BUFFER_LENGTH]
 Reference to Filtered Signal through floating point Format scaled for the remote task. More...
 
float w [FIR_COEF_SIZE]
 Floating Point Implementation of FIR Filter. More...
 
dsp32_t w_fp [FIR_COEF_SIZE]
 Fixed Point Implementation of FIR Filter in 32-bits format. More...
 

#define FIR_COEF_SIZE   25

Referenced by filter_task().

void filter_task ( void  )

Filter Task Function:

  • Filter signal using Fixed Point Implementation
  • Filter signal using Floating Point Implementation
  • Rr

References A_ALIGNED, filter_task_fir(), filter_task_fir_fp(), fir_coef32b, fir_coef_fl, FIR_COEF_SIZE, GUI_BUFFER_LENGTH, GUI_SCALE_GAIN_VALUE, GUI_SCALE_OFFSET_VALUE, i, signalin_noise_remote, signalout_fp_gui, signalout_fp_remote, signalout_fpu_gui, and signalout_fpu_remote.

Referenced by main().

static void filter_task_fir ( float *  vect2,
float *  vect1,
int  b_length,
float *  h,
int  h_size 
)
static

Local function of filtering through floating point implementation of FIR filter.

References i, and j.

Referenced by filter_task().

static void filter_task_fir_fp ( dsp32_t vect2,
dsp32_t vect1,
int  b_length,
dsp32_t h,
int  h_size 
)
static

Local function of filtering through fixed point implementation of FIR filter.

References i, and j.

Referenced by filter_task().

void filter_task_init ( void  )

Filter Task Init Function.

Referenced by main().

Initial value:
= {
DSP32_Q(0.02213774312),
DSP32_Q(0.02660861642),
DSP32_Q(0.03103291928),
DSP32_Q(0.03533215215),
DSP32_Q(0.03942863824),
DSP32_Q(0.04324724164),
DSP32_Q(0.04671704392),
DSP32_Q(0.04977293804),
DSP32_Q(0.05235710024),
DSP32_Q(0.05442030354),
DSP32_Q(0.05592304013),
DSP32_Q(0.05683642486),
DSP32_Q(0.05714285714),
DSP32_Q(0.05683642486),
DSP32_Q(0.05592304013),
DSP32_Q(0.05442030354),
DSP32_Q(0.05235710024),
DSP32_Q(0.04977293804),
DSP32_Q(0.04671704392),
DSP32_Q(0.04324724164),
DSP32_Q(0.03942863824),
DSP32_Q(0.03533215215),
DSP32_Q(0.03103291928),
DSP32_Q(0.02660861642),
}
#define DSP32_Q(fnum)
Convert a float into a 32-bit signed fixed-point type.
Definition: dsp_types.h:294

Referenced by filter_task().

float fir_coef_fl[FIR_COEF_SIZE]
Initial value:
= {
(0.02213774312f),
(0.02660861642f),
(0.03103291928f),
(0.03533215215f),
(0.03942863824f),
(0.04324724164f),
(0.04671704392f),
(0.04977293804f),
(0.05235710024f),
(0.05442030354f),
(0.05592304013f),
(0.05683642486f),
(0.05714285714f),
(0.05683642486f),
(0.05592304013f),
(0.05442030354f),
(0.05235710024f),
(0.04977293804f),
(0.04671704392f),
(0.04324724164f),
(0.03942863824f),
(0.03533215215f),
(0.03103291928f),
(0.02660861642f),
(0.02213774312f)
}

Referenced by filter_task().

dsp16_t signalin_noise_gui[GUI_BUFFER_LENGTH]

Reference to Signal In + Noise Signal Buff 16-bit fixed point Format scaled in GUI format for the GUI task.

volatile float signalin_noise_remote[GUI_BUFFER_LENGTH]

Reference to Signal In + Noise Signal Buff in floating point Format scaled for the remote task.

A_ALIGNED dsp16_t signalout_fp_gui[GUI_BUFFER_LENGTH]

Reference to Filtered Signal through 16-bit fixed point Format scaled in GUI format for the GUI task.

Referenced by filter_task(), and gui_task().

volatile float signalout_fp_remote[GUI_BUFFER_LENGTH]

Reference to Filtered Signal through 16-bit fixed point Format scaled for the remote task.

Referenced by filter_task(), and remote_task().

A_ALIGNED dsp16_t signalout_fpu_gui[GUI_BUFFER_LENGTH]

Reference to Filtered Signal through floating point Format scaled in GUI format for the GUI task.

Referenced by filter_task(), and gui_task().

volatile float signalout_fpu_remote[GUI_BUFFER_LENGTH]

Reference to Filtered Signal through floating point Format scaled for the remote task.

Referenced by filter_task(), and remote_task().

Fixed Point Implementation of FIR Filter in 32-bits format.