Signed-off by Robin Gilham:
[bertos.git] / bertos / drv / thermo.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2004, 2005, 2009 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief Thermo-control driver.
34  *
35  * This module implements multiple thermo controls, which is the logic needed to try
36  * keeping the temperature of a device constant. For this module, a "device" is a black box
37  * whose temperature can be measured, and which has a mean to make it hotter or colder.
38  * For instance, a device could be the combination of a NTC (analog temperature reader) and
39  * a Peltier connected to the same physic block.
40  *
41  * This module relies on a low-level driver to communicate with the device (implementation
42  * of the black box). This low-level driver also controls the units in which the temperature
43  * is expressed: thermo control treats it just as a number.
44  *
45  *
46  * \author Giovanni Bajo <rasky@develer.com>
47  * \author Francesco Sacchi <batt@develer.com>
48  * \author Daniele Basile <asterix@develer.com>
49  *
50  * $WIZ$ module_name = "thermo"
51  * $WIZ$ module_depends = "timer", "ntc"
52  * $WIZ$ module_configuration = "bertos/cfg/cfg_thermo.h"
53  * $WIZ$ module_hw = "bertos/hw/hw_thermo.h", "bertos/hw/thermo_map.h"
54  */
55
56 #ifndef DRV_THERMO_H
57 #define DRV_THERMO_H
58
59 #include "hw/thermo_map.h"
60
61 #include <drv/ntc.h>
62 #include <drv/timer.h>
63
64 typedef uint8_t thermostatus_t;
65
66
67 /**
68  * Set the target temperature at which a given device should be kept.
69  *
70  * \param dev Device
71  * \param temperature Target temperature
72  */
73 void thermo_setTarget(ThermoDev dev, deg_t temperature);
74
75 /**
76  * Start thermo control for a certain device \a dev and stop it after
77  *  \a on_time msec.
78  */
79 void thermo_timer(ThermoDev dev, mtime_t on_time);
80
81 /** Start thermo control for a certain device \a dev */
82 void thermo_start(ThermoDev dev);
83
84 /** Stop thermo control for a certain device \a dev */
85 void thermo_stop(ThermoDev dev);
86
87 /** Clear errors for channel \a dev */
88 void thermo_clearErrors(ThermoDev dev);
89
90 /** Return the status of the specific \a dev thermo-device. */
91 thermostatus_t thermo_status(ThermoDev dev);
92
93 /**
94  * Return the current temperature of a device currently under thermo
95  * control.
96  *
97  * \param dev Device
98  * \return Current temperature (Celsius degrees * 10)
99  */
100 deg_t thermo_readTemperature(ThermoDev dev);
101
102 void thermo_init(void);
103
104
105 #endif /* DRV_THERMO_H */