hostsim test
[aversive.git] / modules / devices / control_system / filters / ramp / ramp.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  *
19  */
20
21
22 /** \file ramp.h
23 * \brief This module provides structure and functions to filter a ramp.
24 * \author Vincent
25 * \version 1.0
26 * \date 6.01.2005 @ 12:00
27 * \todo Verify the english language
28 * \test filter a constante value to generate a ramp on the hardware. Everything is all right
29 *
30 */
31
32
33
34 #ifndef _RAMP_H
35 #define _RAMP_H
36
37 /** \brief Definition of structur ramp_filter */
38
39 struct ramp_filter {
40         uint32_t var_neg;         /**Authorized negative variation*/
41         uint32_t var_pos;         /**Authorized positive variation*/
42         int32_t prev_out;        /**Previous value calculated*/
43 };
44
45
46
47 /* Begin prototyping ************************/
48
49 /**\brief Initialisation of the ramp_filter structur
50  *\param r ramp_filter structur to initiate
51  **/
52
53 void ramp_init(struct ramp_filter * r );
54
55
56 /**\brief Set the fields of the ramp_filter structur
57  *\param r ramp_structure to modificate
58  *\param neg limit for the negative variation
59  *\param pos limit for the positive variation
60  */ 
61
62 void ramp_set_vars(struct ramp_filter * r, uint32_t neg, uint32_t pos);
63
64
65 /** \brief Apply ramp_filter to a ramp
66 * \param r ramp_filter used to filter the in
67 * \param in ramp to filter
68 * \return filtered in
69 */
70
71
72 int32_t ramp_do_filter(void * r, int32_t in);
73
74 #endif /* ifndef _RAMP_H */