void filter1_hp_init(Filter1 *filter, float fg, float Ts, int signal_dim) { /* calculate filter time constant */ float T = filter_constant(fg); /* filter coefficients for 2nd order highpass filter */ float a[1]; a[0] = (2.0f * Ts) / (2.0f * T + Ts) - 1.0f; float b[2]; b[0] = 2.0f / (2.0f * T + Ts); b[1] = -b[0]; filter1_init(filter, a, b, Ts, signal_dim); }
filter1Type *filter1_create( void ) { filter1Type *result = (filter1Type *)malloc( sizeof( filter1Type ) ); // Allocate memory for the object filter1_init( result ); // Initialize it return result; // Return the result }