diff options
Diffstat (limited to 'lib/chibios-contrib/os/hal/include/hal_opamp.h')
-rw-r--r-- | lib/chibios-contrib/os/hal/include/hal_opamp.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/hal/include/hal_opamp.h b/lib/chibios-contrib/os/hal/include/hal_opamp.h new file mode 100644 index 000000000..b20c93895 --- /dev/null +++ b/lib/chibios-contrib/os/hal/include/hal_opamp.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio | ||
3 | Copyright (C) 2019 Fabien Poussin (fabien.poussin (at) google's mail) | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | |||
18 | #ifndef HAL_OPAMP_H_ | ||
19 | #define HAL_OPAMP_H_ | ||
20 | |||
21 | #include "hal.h" | ||
22 | |||
23 | #if (HAL_USE_OPAMP == TRUE) || defined(__DOXYGEN__) | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver constants. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | #define OPAMP_P_BELOW_M (0U) | ||
30 | #define OPAMP_M_BELOW_P (1U) | ||
31 | |||
32 | /*===========================================================================*/ | ||
33 | /* Driver pre-compile time settings. */ | ||
34 | /*===========================================================================*/ | ||
35 | |||
36 | /*===========================================================================*/ | ||
37 | /* Derived constants and error checks. */ | ||
38 | /*===========================================================================*/ | ||
39 | |||
40 | /*===========================================================================*/ | ||
41 | /* Driver data structures and types. */ | ||
42 | /*===========================================================================*/ | ||
43 | |||
44 | /** | ||
45 | * @brief Driver state machine possible states. | ||
46 | */ | ||
47 | typedef enum { | ||
48 | OPAMP_UNINIT = 0, /**< Not initialized. */ | ||
49 | OPAMP_STOP = 1, /**< Stopped. */ | ||
50 | OPAMP_ACTIVE = 2, /**< Active. */ | ||
51 | OPAMP_CALIBRATING = 3, /**< Calibration in progress. */ | ||
52 | } opampstate_t; | ||
53 | |||
54 | /** | ||
55 | * @brief Type of a structure representing an OPAMP driver. | ||
56 | */ | ||
57 | typedef struct OPAMPDriver OPAMPDriver; | ||
58 | |||
59 | #include "hal_opamp_lld.h" | ||
60 | |||
61 | /*===========================================================================*/ | ||
62 | /* Driver macros. */ | ||
63 | /*===========================================================================*/ | ||
64 | |||
65 | /** | ||
66 | * @brief Calibrate opamps | ||
67 | * * | ||
68 | * @iclass | ||
69 | */ | ||
70 | #define opampCalibrate() opamp_lld_calibrate() | ||
71 | /** @} */ | ||
72 | |||
73 | /** | ||
74 | * @name Low Level driver helper macros | ||
75 | * @{ | ||
76 | */ | ||
77 | |||
78 | /*===========================================================================*/ | ||
79 | /* External declarations. */ | ||
80 | /*===========================================================================*/ | ||
81 | |||
82 | #ifdef __cplusplus | ||
83 | extern "C" { | ||
84 | #endif | ||
85 | void opampInit(void); | ||
86 | void opampObjectInit(OPAMPDriver *opamp); | ||
87 | void opampStart(OPAMPDriver *opamp, const OPAMPConfig *config); | ||
88 | void opampStop(OPAMPDriver *opamp); | ||
89 | void opampEnable(OPAMPDriver *opamp); | ||
90 | void opampDisable(OPAMPDriver *opamp); | ||
91 | #ifdef __cplusplus | ||
92 | } | ||
93 | #endif | ||
94 | |||
95 | #endif /* HAL_USE_OPAMP */ | ||
96 | |||
97 | #endif /* HAL_OPAMP_H_ */ | ||