fir_win.c File Reference

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include "fir_win.h"
#include "dt_window.h"

Include dependency graph for fir_win.c:

Go to the source code of this file.

Data Structures

struct  ts_fwin
 Private Data for Fir Window Filter. More...

Defines

#define FW_2PI   (2.0 * M_PI)
#define DOUBLE_Z_FIR   2

Typedefs

typedef void(* fwin_filter_function )(p_fwin fw)

Functions

static void fwin_apply_window (p_fwin fw)
static void fwin_reapply_window (p_fwin fw)
static void band_pass (p_fwin fw)
static void band_stop (p_fwin fw)
static void low_pass (p_fwin fw)
static void high_pass (p_fwin fw)
static void average (p_fwin fw)
p_fwin fwin_create (double sample_freq, double f_low, double f_high, te_fir_win_filter_type filter_type, te_fir_win_window_type window_type, uint32_t taps)
void fwin_change_freq (p_fwin fw, double f_low, double f_high)
void fwin_apply (p_fwin fw, double *data, uint32_t size)
void fwin_destroy (p_fwin *fw)

Variables

static const te_dt_window_type FW_WINDOW_TABLE [FW_NUMBER_OF_WINDOW_TYPES]
static const fwin_filter_function FW_FILTER_FUNCTIONS [FW_NUMBER_OF_FILTER_TYPES]


Define Documentation

#define DOUBLE_Z_FIR   2

Definition at line 67 of file fir_win.c.

Referenced by fwin_create().

#define FW_2PI   (2.0 * M_PI)

Definition at line 66 of file fir_win.c.

Referenced by band_pass().


Typedef Documentation

typedef void( * fwin_filter_function)(p_fwin fw)

Definition at line 112 of file fir_win.c.


Function Documentation

static void average ( p_fwin  fw  )  [static]

Definition at line 271 of file fir_win.c.

References ts_fwin::h, and ts_fwin::taps.

static void band_pass ( p_fwin  fw  )  [static]

static void band_stop ( p_fwin  fw  )  [static]

Todo:
Implement band_stop.

Definition at line 256 of file fir_win.c.

void fwin_apply ( p_fwin  fw,
double *  data,
uint32_t  size 
)

Apply the FIR filter to sampled data.

Parameters:
fw Pointer to the FIR filter object.
data Pointer to the data to be filtered.
size Number of data points in data.

Definition at line 190 of file fir_win.c.

References ts_fwin::h, ts_fwin::taps, ts_fwin::z, and ts_fwin::z_state.

Referenced by morse_code().

static void fwin_apply_window ( p_fwin  fw  )  [static]

Todo:
These could be combined.

Definition at line 282 of file fir_win.c.

References dt_window_apply(), dt_window_create(), FW_NONE, FW_NUMBER_OF_WINDOW_TYPES, FW_WINDOW_TABLE, ts_fwin::h, ts_fwin::h_window, ts_fwin::taps, and ts_fwin::window_type.

Referenced by fwin_create().

Here is the call graph for this function:

void fwin_change_freq ( p_fwin  fw,
double  f_low,
double  f_high 
)

Changes the frequency response of an existing FIR filter.

Parameters:
fw Pointer to existing FIR filter object.
f_low New low frequency cut-off in Hertz.
f_high New high frequency cut-off in Hertz.

Definition at line 174 of file fir_win.c.

References ts_fwin::f_high, ts_fwin::f_low, ts_fwin::filter_type, FW_FILTER_FUNCTIONS, and fwin_reapply_window().

Referenced by morse_recompute_filter().

Here is the call graph for this function:

p_fwin fwin_create ( double  sample_freq,
double  f_low,
double  f_high,
te_fir_win_filter_type  filter_type,
te_fir_win_window_type  window_type,
uint32_t  taps 
)

Creates a FIR filter via the window method.

Parameters:
sample_freq Sample frequency in Hertz.
f_low Low frequency cut-off in Hertz.
f_high High frequency cut-off in Hertz.
filter_type Filter type, band-pass, high-pass, low-pass, etc...
window_type Window applied to the FIR filter coefficients.
taps Number of FIR filter taps (N).
Returns:
Pointer to the FIR filter object.

Definition at line 133 of file fir_win.c.

References DOUBLE_Z_FIR, ts_fwin::f_high, ts_fwin::f_low, ts_fwin::filter_type, FW_FILTER_FUNCTIONS, FW_NUMBER_OF_FILTER_TYPES, fwin_apply_window(), ts_fwin::h, ts_fwin::h_window, ts_fwin::sample_freq, ts_fwin::taps, ts_fwin::window_type, ts_fwin::z, and ts_fwin::z_state.

Referenced by morse_start_threads().

Here is the call graph for this function:

void fwin_destroy ( p_fwin fw  ) 

Destroys, and frees all memory from a window FIR filter object.

Parameters:
fw Pointer to the FIR filter object to be freed.

Definition at line 220 of file fir_win.c.

Referenced by free_all().

static void fwin_reapply_window ( p_fwin  fw  )  [static]

Definition at line 295 of file fir_win.c.

References dt_window_apply(), FW_NONE, ts_fwin::h, ts_fwin::h_window, and ts_fwin::window_type.

Referenced by fwin_change_freq().

Here is the call graph for this function:

static void high_pass ( p_fwin  fw  )  [static]

Todo:
Implement high_pass.

Definition at line 266 of file fir_win.c.

static void low_pass ( p_fwin  fw  )  [static]

Todo:
Implement low_pass.

Definition at line 261 of file fir_win.c.


Variable Documentation

const fwin_filter_function FW_FILTER_FUNCTIONS[FW_NUMBER_OF_FILTER_TYPES] [static]

Initial value:

Definition at line 125 of file fir_win.c.

Referenced by fwin_change_freq(), and fwin_create().

const te_dt_window_type FW_WINDOW_TABLE[FW_NUMBER_OF_WINDOW_TYPES] [static]

Initial value:

Definition at line 98 of file fir_win.c.

Referenced by fwin_apply_window().


Generated on Mon Jun 22 21:39:06 2009 for morse2txt by  doxygen 1.5.6