aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/templates/hal_icu_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/templates/hal_icu_lld.c')
-rw-r--r--lib/chibios/os/hal/templates/hal_icu_lld.c187
1 files changed, 187 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/templates/hal_icu_lld.c b/lib/chibios/os/hal/templates/hal_icu_lld.c
new file mode 100644
index 000000000..bdf7349b9
--- /dev/null
+++ b/lib/chibios/os/hal/templates/hal_icu_lld.c
@@ -0,0 +1,187 @@
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_icu_lld.c
19 * @brief PLATFORM ADC subsystem low level driver source.
20 *
21 * @addtogroup ICU
22 * @{
23 */
24
25#include "hal.h"
26
27#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
28
29/*===========================================================================*/
30/* Driver local definitions. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver exported variables. */
35/*===========================================================================*/
36
37/**
38 * @brief ICUD1 driver identifier.
39 * @note The driver ICUD1 allocates the complex timer TIM1 when enabled.
40 */
41#if (PLATFORM_ICU_USE_ICU1 == TRUE) || defined(__DOXYGEN__)
42ICUDriver ICUD1;
43#endif
44
45/*===========================================================================*/
46/* Driver local variables and types. */
47/*===========================================================================*/
48
49/*===========================================================================*/
50/* Driver local functions. */
51/*===========================================================================*/
52
53/*===========================================================================*/
54/* Driver interrupt handlers. */
55/*===========================================================================*/
56
57/*===========================================================================*/
58/* Driver exported functions. */
59/*===========================================================================*/
60
61/**
62 * @brief Low level ICU driver initialization.
63 *
64 * @notapi
65 */
66void icu_lld_init(void) {
67
68#if PLATFORM_ICU_USE_ICU1 == TRUE
69 /* Driver initialization.*/
70 icuObjectInit(&ICUD1);
71#endif
72}
73
74/**
75 * @brief Configures and activates the ICU peripheral.
76 *
77 * @param[in] icup pointer to the @p ICUDriver object
78 *
79 * @notapi
80 */
81void icu_lld_start(ICUDriver *icup) {
82
83 if (icup->state == ICU_STOP) {
84 /* Clock activation and timer reset.*/
85#if PLATFORM_ICU_USE_ICU1 == TRUE
86 if (&ICUD1 == icup) {
87
88 }
89#endif
90 }
91}
92
93/**
94 * @brief Deactivates the ICU peripheral.
95 *
96 * @param[in] icup pointer to the @p ICUDriver object
97 *
98 * @notapi
99 */
100void icu_lld_stop(ICUDriver *icup) {
101
102 if (icup->state == ICU_READY) {
103 /* Clock deactivation.*/
104#if PLATFORM_ICU_USE_ICU1 == TRUE
105 if (&ICUD1 == icup) {
106
107 }
108#endif
109 }
110}
111
112/**
113 * @brief Starts the input capture.
114 *
115 * @param[in] icup pointer to the @p ICUDriver object
116 *
117 * @notapi
118 */
119void icu_lld_start_capture(ICUDriver *icup) {
120
121 (void)icup;
122}
123
124/**
125 * @brief Waits for a completed capture.
126 * @note The operation is performed in polled mode.
127 * @note In order to use this function notifications must be disabled.
128 *
129 * @param[in] icup pointer to the @p ICUDriver object
130 * @return The capture status.
131 * @retval false if the capture is successful.
132 * @retval true if a timer overflow occurred.
133 *
134 * @notapi
135 */
136bool icu_lld_wait_capture(ICUDriver *icup) {
137
138 (void)icup;
139
140 return false;
141}
142
143/**
144 * @brief Stops the input capture.
145 *
146 * @param[in] icup pointer to the @p ICUDriver object
147 *
148 * @notapi
149 */
150void icu_lld_stop_capture(ICUDriver *icup) {
151
152 (void)icup;
153}
154
155/**
156 * @brief Enables notifications.
157 * @pre The ICU unit must have been activated using @p icuStart() and the
158 * capture started using @p icuStartCapture().
159 * @note If the notification is already enabled then the call has no effect.
160 *
161 * @param[in] icup pointer to the @p ICUDriver object
162 *
163 * @api
164 */
165void icu_lld_enable_notifications(ICUDriver *icup) {
166
167 (void)icup;
168}
169
170/**
171 * @brief Disables notifications.
172 * @pre The ICU unit must have been activated using @p icuStart() and the
173 * capture started using @p icuStartCapture().
174 * @note If the notification is already disabled then the call has no effect.
175 *
176 * @param[in] icup pointer to the @p ICUDriver object
177 *
178 * @api
179 */
180void icu_lld_disable_notifications(ICUDriver *icup) {
181
182 (void)icup;
183}
184
185#endif /* HAL_USE_ICU == TRUE */
186
187/** @} */