#ifndef FIRFILTER_H__
#define FIRFILTER_H__

#include <stdint.h>


#define SAMPLE  int16_t      /* define the type used for data samples */
#define SAMPLE32 int32_t     /* define the type used for data samples */

/**@brief Function for initializing the module 
 *
 * Clear a buffer
 */
void fir_clear(int ntaps, SAMPLE z[]);      


/**@brief Generic FIR filter function
 *
 * Run FIR on one sample
 */
SAMPLE fir_split(SAMPLE input, int ntaps, const SAMPLE h[], SAMPLE z[],
                 int *p_state);


/**@brief Run low-pass FIR filter on one sample
 *
 * @return filtered sample (delayed)
 */
SAMPLE fir_lp_filter(SAMPLE input);


/**@brief Run band-pass FIR filter on one sample
 *
 * @return filtered sample (delayed)
 */
SAMPLE fir_bp_filter(SAMPLE input);


/**@brief Delay one sample to line up with fir filter output
 *
 * @return delayed sample (FIRTAPS+1)/2
 */
SAMPLE fir_delay(SAMPLE input);


/**@brief Delay one sample to line up with fir filter output (minus one)
 *
 * @return delayed sample (FIRTAPS+1)/2-1
 */
SAMPLE fir_delay_1(SAMPLE input);

/**@brief Delay one sample to line up with fir filter output (minus one)
 *
 * @return delayed sample (FIRTAPS+1)/2-1
 */
SAMPLE fir_delay_2(SAMPLE input);

/**@brief Run low-pass FIR filter on one sample
 *
 * @return filtered sample (delayed)
 */
SAMPLE32 fir_filter_tq(SAMPLE32 input);

#endif
