12 |
12 |
13 /* |
13 /* |
14 * Error codes in this task |
14 * Error codes in this task |
15 */ |
15 */ |
16 #define DS18B20_ERR_NONE 0 ///< No errors |
16 #define DS18B20_ERR_NONE 0 ///< No errors |
17 #define DS18B20_ERR_NOSENSOR 1 ///< No sensor detected |
17 #define DS18B20_ERR_CRC 1 ///< CRC read error |
18 #define DS18B20_ERR_TOOMANY 2 ///< Too many sensors |
18 #define DS18B20_ERR_READ 2 ///< Generic read error |
19 #define DS18B20_ERR_CRC 3 ///< CRC read error |
19 |
20 #define DS18B20_ERR_READ 4 ///< Generic read error |
20 #define DS18B20_MAX 4 |
|
21 |
|
22 /** |
|
23 * @brief Structure for a temperature sensor. |
|
24 */ |
|
25 typedef struct strTempsensor { |
|
26 double temperature; ///< Current temperature. |
|
27 char rom_code[17]; ///< ROM code of this device. |
|
28 int error; ///< Error number. |
|
29 } tempsensor_t; |
|
30 |
21 |
31 |
22 |
32 |
23 /** |
33 /** |
24 * @brief Structure containing the variables for the DS18B20 task. |
34 * @brief Structure containing the variables for the DS18B20 task. |
25 */ |
35 */ |
26 typedef struct { |
36 typedef struct { |
27 bool bottle_valid; ///< Bottle sensor valid reading. |
37 bool valid; ///< Sensor valid reading. |
28 double bottle_temperature; ///< Current bottle temperature. |
38 int num_sensors; ///< Number of sensors |
29 int bottle_error; ///< Bottle error number. |
39 tempsensor_t sensor[DS18B20_MAX]; ///< Temperature sensors |
30 } DS18B20_State; |
40 } DS18B20_State; |
31 |
41 |
32 |
42 |
33 |
43 |
34 /** |
44 /** |