|
1 |
|
2 /** |
|
3 * @file task_ds18b20.h |
|
4 * @brief The FreeRTOS task to query the DS18B20 sensors on one or two |
|
5 * one-wire busses. Each bus must have only one sensor. That way |
|
6 * we don't need to care about the DS18B20 internal ROM address. |
|
7 * The task will update the DS18B20_State structure. |
|
8 */ |
|
9 |
|
10 #ifndef _TASK_DS18B20_H |
|
11 #define _TASK_DS18B20_H |
|
12 |
|
13 /* |
|
14 * Error codes in this task |
|
15 */ |
|
16 #define DS18B20_ERR_NONE 0 ///< No errors |
|
17 #define DS18B20_ERR_NOSENSOR 1 ///< No sensor detected |
|
18 #define DS18B20_ERR_TOOMANY 2 ///< Too many sensors |
|
19 #define DS18B20_ERR_CRC 3 ///< CRC read error |
|
20 #define DS18B20_ERR_READ 4 ///< Generic read error |
|
21 |
|
22 |
|
23 /** |
|
24 * @brief Structure containing the variables for the DS18B20 task. |
|
25 */ |
|
26 typedef struct { |
|
27 bool bottle_valid; ///< Bottle sensor valid reading. |
|
28 double bottle_temperature; ///< Current bottle temperature. |
|
29 int bottle_error; ///< Bottle error number. |
|
30 } DS18B20_State; |
|
31 |
|
32 |
|
33 |
|
34 /** |
|
35 * @brief Request a new measurement |
|
36 */ |
|
37 void request_ds18b20(void); |
|
38 |
|
39 |
|
40 /** |
|
41 * @brief Measurement ready state |
|
42 * @return Returns true if the temperature measurements are ready |
|
43 */ |
|
44 bool ready_ds18b20(void); |
|
45 |
|
46 |
|
47 /** |
|
48 * @brief The FreeRTOS task to update the DS18B20 temperature sensors on request. |
|
49 */ |
|
50 void task_ds18b20(void *); |
|
51 |
|
52 |
|
53 #endif |
|
54 |