diff options
Diffstat (limited to 'lib/chibios/os/hal/templates/hal_adc_lld.h')
-rw-r--r-- | lib/chibios/os/hal/templates/hal_adc_lld.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/templates/hal_adc_lld.h b/lib/chibios/os/hal/templates/hal_adc_lld.h new file mode 100644 index 000000000..056824e47 --- /dev/null +++ b/lib/chibios/os/hal/templates/hal_adc_lld.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file hal_adc_lld.h | ||
19 | * @brief PLATFORM ADC subsystem low level driver header. | ||
20 | * | ||
21 | * @addtogroup ADC | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #ifndef HAL_ADC_LLD_H | ||
26 | #define HAL_ADC_LLD_H | ||
27 | |||
28 | #if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__) | ||
29 | |||
30 | /*===========================================================================*/ | ||
31 | /* Driver constants. */ | ||
32 | /*===========================================================================*/ | ||
33 | |||
34 | /*===========================================================================*/ | ||
35 | /* Driver pre-compile time settings. */ | ||
36 | /*===========================================================================*/ | ||
37 | |||
38 | /** | ||
39 | * @name PLATFORM configuration options | ||
40 | * @{ | ||
41 | */ | ||
42 | /** | ||
43 | * @brief ADC1 driver enable switch. | ||
44 | * @details If set to @p TRUE the support for ADC1 is included. | ||
45 | * @note The default is @p FALSE. | ||
46 | */ | ||
47 | #if !defined(PLATFORM_ADC_USE_ADC1) || defined(__DOXYGEN__) | ||
48 | #define PLATFORM_ADC_USE_ADC1 FALSE | ||
49 | #endif | ||
50 | /** @} */ | ||
51 | |||
52 | /*===========================================================================*/ | ||
53 | /* Derived constants and error checks. */ | ||
54 | /*===========================================================================*/ | ||
55 | |||
56 | /*===========================================================================*/ | ||
57 | /* Driver data structures and types. */ | ||
58 | /*===========================================================================*/ | ||
59 | |||
60 | /** | ||
61 | * @brief ADC sample data type. | ||
62 | */ | ||
63 | typedef uint16_t adcsample_t; | ||
64 | |||
65 | /** | ||
66 | * @brief Channels number in a conversion group. | ||
67 | */ | ||
68 | typedef uint16_t adc_channels_num_t; | ||
69 | |||
70 | /** | ||
71 | * @brief Possible ADC failure causes. | ||
72 | * @note Error codes are architecture dependent and should not relied | ||
73 | * upon. | ||
74 | */ | ||
75 | typedef enum { | ||
76 | ADC_ERR_DMAFAILURE = 0, /**< DMA operations failure. */ | ||
77 | ADC_ERR_OVERFLOW = 1, /**< ADC overflow condition. */ | ||
78 | ADC_ERR_AWD = 2 /**< Analog watchdog triggered. */ | ||
79 | } adcerror_t; | ||
80 | |||
81 | /*===========================================================================*/ | ||
82 | /* Driver macros. */ | ||
83 | /*===========================================================================*/ | ||
84 | |||
85 | /** | ||
86 | * @brief Low level fields of the ADC driver structure. | ||
87 | */ | ||
88 | #define adc_lld_driver_fields \ | ||
89 | /* Dummy field, it is not needed.*/ \ | ||
90 | uint32_t dummy | ||
91 | |||
92 | /** | ||
93 | * @brief Low level fields of the ADC configuration structure. | ||
94 | */ | ||
95 | #define adc_lld_config_fields \ | ||
96 | /* Dummy configuration, it is not needed.*/ \ | ||
97 | uint32_t dummy | ||
98 | |||
99 | /** | ||
100 | * @brief Low level fields of the ADC configuration structure. | ||
101 | */ | ||
102 | #define adc_lld_configuration_group_fields \ | ||
103 | /* Dummy configuration, it is not needed.*/ \ | ||
104 | uint32_t dummy | ||
105 | |||
106 | /*===========================================================================*/ | ||
107 | /* External declarations. */ | ||
108 | /*===========================================================================*/ | ||
109 | |||
110 | #if (PLATFORM_ADC_USE_ADC1 == TRUE) && !defined(__DOXYGEN__) | ||
111 | extern ADCDriver ADCD1; | ||
112 | #endif | ||
113 | |||
114 | #ifdef __cplusplus | ||
115 | extern "C" { | ||
116 | #endif | ||
117 | void adc_lld_init(void); | ||
118 | void adc_lld_start(ADCDriver *adcp); | ||
119 | void adc_lld_stop(ADCDriver *adcp); | ||
120 | void adc_lld_start_conversion(ADCDriver *adcp); | ||
121 | void adc_lld_stop_conversion(ADCDriver *adcp); | ||
122 | #ifdef __cplusplus | ||
123 | } | ||
124 | #endif | ||
125 | |||
126 | #endif /* HAL_USE_ADC == TRUE */ | ||
127 | |||
128 | #endif /* HAL_ADC_LLD_H */ | ||
129 | |||
130 | /** @} */ | ||