#ifndef __SMOOTH_H__ #define __SMOOTH_H__ #define WINDOW_START 79.0 //39.0 #define MAX_SIZE_SMOOTH_INPUT 180 typedef struct { int current_pos_buf_input; _iq23 kp; _iq23 ki; int c; int w_int_simple; _iq23 w; long w_int; _iq23 ee; _iq23 e0; _iq23 av; _iq23 input; _iq23 summ; _iq23 buf_input[MAX_SIZE_SMOOTH_INPUT]; void (*init)(); // Pointer to calculation function void (*add)(); // Pointer to calculation function void (*calc)(); // Pointer to calculation function void (*simple_calc)(); // Pointer to calculation function }SMOOTH; typedef SMOOTH *SMOOTH_handle; #define SMOOTH_DEFAULTS { 0, \ _IQ23(0.1), \ _IQ23(0.01), \ 1, \ 1, \ _IQ23(WINDOW_START), \ WINDOW_START, \ 0, \ 0, \ 0, \ 0, \ 0, \ {0},\ (void (*)(unsigned long))smooth_init,\ (void (*)(unsigned long))smooth_add,\ (void (*)(unsigned long))smooth_calc,\ (void (*)(unsigned long))smooth_simple_calc\ } void smooth_calc(SMOOTH_handle); void smooth_init(SMOOTH_handle); void smooth_add(SMOOTH_handle); void smooth_simple_calc(SMOOTH_handle); void iq_smooth (_iq23 *input, _iq23 *output, int n, int window); #endif // end __ABC_ALPHABETA_H