remove CVS
[aversive.git] / modules / devices / control_system / filters / quadramp / quadramp.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: quadramp.h,v 1.3.4.4 2009-05-18 12:29:51 zer0 Exp $
19  *
20  */
21
22 #ifndef _QUADRAMP_H_
23 #define _QUADRAMP_H_
24
25 #include <aversive.h>
26
27 struct quadramp_filter
28 {
29     uint32_t var_2nd_ord_pos;
30     uint32_t var_2nd_ord_neg;
31     uint32_t var_1st_ord_pos;
32     uint32_t var_1st_ord_neg;
33
34     int32_t previous_var;
35     int32_t previous_out;
36     int32_t previous_in;
37 };
38
39 /** Initialization of the filter */
40 void quadramp_init(struct quadramp_filter *q);
41
42 void quadramp_reset(struct quadramp_filter * q);
43
44 void quadramp_set_2nd_order_vars(struct quadramp_filter *q, 
45                                  uint32_t var_2nd_ord_pos, 
46                                  uint32_t var_2nd_ord_neg);
47
48 void quadramp_set_1st_order_vars(struct quadramp_filter *q, 
49                                  uint32_t var_1st_ord_pos, 
50                                  uint32_t var_1st_ord_neg);
51
52 /**
53  * Return 1 when (filter_input == filter_output && 1st_ord variation
54  * is 0 --speed is 0-- ).
55  */
56 uint8_t quadramp_is_finished(struct quadramp_filter *q);
57
58 /**
59  * Process the ramp
60  * 
61  * \param data should be a (struct quadramp_filter *) pointer
62  * \param in is the input of the filter
63  */
64 int32_t quadramp_do_filter(void * data, int32_t in);
65
66 #endif