summaryrefslogtreecommitdiffstats
path: root/FIR/firmath.h
blob: 3540a98bd2fe1c05a5507567d13086215988fa88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
//  firmath.h
//  FIR_rect_win
//
//  Created by Jacky Jack on 04/07/2021.
//

#ifndef firmath_h
#define firmath_h

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>

typedef struct fir_t {
    uint32_t num_taps;
    double *fir_coef;
} fir_t;

typedef struct firw_t {
    uint32_t num_taps;
    double *win_coef;
} firw_t;

void fir_init(fir_t *fir, uint32_t taps);
void firw_init(firw_t *fir_win, uint32_t taps);

double math_sinx(double x);
void fir_sinc_lp(fir_t *fir, double fc);
void fir_sinc_hp(fir_t *fir, double omega_c);
void fir_sinc_bp(fir_t *fir, double omega_c1, double omega_c2);
void fir_sinc_bs(fir_t *fir, double omega_c1, double omega_c2);
void fir_convolute(fir_t *fir,firw_t *fir_win);
void firw_rect(firw_t *firw);
void firw_hamming(firw_t *firw);
void firw_hanning(firw_t *firw);
void firw_blackman(firw_t *firw);
void fir_print_matlab(fir_t *fir);
void firw_print_matlab(firw_t *firw);
void fir_print_c(fir_t *fir);

#endif /* firmath_h */