main/task_adc.h

changeset 0
88d965579617
child 44
e52d11b8f252
equal deleted inserted replaced
-1:000000000000 0:88d965579617
1 /**
2 * @file task_adc.h
3 * @brief The FreeRTOS task to query the pressure sensors connected to
4 * ADC inputs.
5 * The task will update the ADC_State structure.
6 */
7
8 #ifndef _TASK_ADC_H
9 #define _TASK_ADC_H
10
11 /*
12 * Error codes in this task
13 */
14 #define ADC_ERR_NONE 0 ///< No errors
15 #define ADC_ERR_READ 1 ///< Generic read error
16
17
18
19 /**
20 * @brief Pressure sensors
21 */
22 typedef struct strPressure {
23 bool valid; ///< Valid measurement
24 adc_channel_t channel; ///< Channel
25 adc_atten_t atten; ///< Attenuation
26 uint32_t voltage; ///< Voltage measured
27 int error; ///< Error result
28 } pressure_t;
29
30
31 /**
32 * @brief Structure containing the variables for the ADC task.
33 */
34 typedef struct {
35 pressure_t Pressure[3]; ///< Pressure sensors
36 uint32_t Batt_voltage; ///< Battery voltage
37 int Batt_error; ///< Battery error state
38 } ADC_State;
39
40
41
42 /**
43 * @brief Request a new measurement
44 */
45 void request_adc(void);
46
47
48 /**
49 * @brief Check if results are ready
50 * @return true of results are ready, else false.
51 */
52 bool ready_adc(void);
53
54
55 /**
56 * @brief The FreeRTOS task to update the pressure sensors on request.
57 */
58 void task_adc(void *);
59
60
61 #endif
62

mercurial