The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_K64F/TOOLCHAIN_IAR/fsl_cmp.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 145:64910690c574 | 1 | /* |
AnnaBridge | 145:64910690c574 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
AnnaBridge | 145:64910690c574 | 3 | * All rights reserved. |
AnnaBridge | 145:64910690c574 | 4 | * |
AnnaBridge | 145:64910690c574 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 145:64910690c574 | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 145:64910690c574 | 7 | * |
AnnaBridge | 145:64910690c574 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 145:64910690c574 | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 145:64910690c574 | 10 | * |
AnnaBridge | 145:64910690c574 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
AnnaBridge | 145:64910690c574 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
AnnaBridge | 145:64910690c574 | 13 | * other materials provided with the distribution. |
AnnaBridge | 145:64910690c574 | 14 | * |
AnnaBridge | 145:64910690c574 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
AnnaBridge | 145:64910690c574 | 16 | * contributors may be used to endorse or promote products derived from this |
AnnaBridge | 145:64910690c574 | 17 | * software without specific prior written permission. |
AnnaBridge | 145:64910690c574 | 18 | * |
AnnaBridge | 145:64910690c574 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 145:64910690c574 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 145:64910690c574 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 145:64910690c574 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 145:64910690c574 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 145:64910690c574 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 145:64910690c574 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 145:64910690c574 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 145:64910690c574 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 145:64910690c574 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 145:64910690c574 | 29 | */ |
AnnaBridge | 145:64910690c574 | 30 | |
AnnaBridge | 145:64910690c574 | 31 | #ifndef _FSL_CMP_H_ |
AnnaBridge | 145:64910690c574 | 32 | #define _FSL_CMP_H_ |
AnnaBridge | 145:64910690c574 | 33 | |
AnnaBridge | 145:64910690c574 | 34 | #include "fsl_common.h" |
AnnaBridge | 145:64910690c574 | 35 | |
AnnaBridge | 145:64910690c574 | 36 | /*! |
AnnaBridge | 145:64910690c574 | 37 | * @addtogroup cmp |
AnnaBridge | 145:64910690c574 | 38 | * @{ |
AnnaBridge | 145:64910690c574 | 39 | */ |
AnnaBridge | 145:64910690c574 | 40 | |
AnnaBridge | 145:64910690c574 | 41 | |
AnnaBridge | 145:64910690c574 | 42 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 43 | * Definitions |
AnnaBridge | 145:64910690c574 | 44 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 45 | |
AnnaBridge | 145:64910690c574 | 46 | /*! @name Driver version */ |
AnnaBridge | 145:64910690c574 | 47 | /*@{*/ |
AnnaBridge | 145:64910690c574 | 48 | /*! @brief CMP driver version 2.0.0. */ |
AnnaBridge | 145:64910690c574 | 49 | #define FSL_CMP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
AnnaBridge | 145:64910690c574 | 50 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 51 | |
AnnaBridge | 145:64910690c574 | 52 | /*! |
AnnaBridge | 145:64910690c574 | 53 | * @brief Interrupt enable/disable mask. |
AnnaBridge | 145:64910690c574 | 54 | */ |
AnnaBridge | 145:64910690c574 | 55 | enum _cmp_interrupt_enable |
AnnaBridge | 145:64910690c574 | 56 | { |
AnnaBridge | 145:64910690c574 | 57 | kCMP_OutputRisingInterruptEnable = CMP_SCR_IER_MASK, /*!< Comparator interrupt enable rising. */ |
AnnaBridge | 145:64910690c574 | 58 | kCMP_OutputFallingInterruptEnable = CMP_SCR_IEF_MASK, /*!< Comparator interrupt enable falling. */ |
AnnaBridge | 145:64910690c574 | 59 | }; |
AnnaBridge | 145:64910690c574 | 60 | |
AnnaBridge | 145:64910690c574 | 61 | /*! |
AnnaBridge | 145:64910690c574 | 62 | * @brief Status flags' mask. |
AnnaBridge | 145:64910690c574 | 63 | */ |
AnnaBridge | 145:64910690c574 | 64 | enum _cmp_status_flags |
AnnaBridge | 145:64910690c574 | 65 | { |
AnnaBridge | 145:64910690c574 | 66 | kCMP_OutputRisingEventFlag = CMP_SCR_CFR_MASK, /*!< Rising-edge on the comparison output has occurred. */ |
AnnaBridge | 145:64910690c574 | 67 | kCMP_OutputFallingEventFlag = CMP_SCR_CFF_MASK, /*!< Falling-edge on the comparison output has occurred. */ |
AnnaBridge | 145:64910690c574 | 68 | kCMP_OutputAssertEventFlag = CMP_SCR_COUT_MASK, /*!< Return the current value of the analog comparator output. */ |
AnnaBridge | 145:64910690c574 | 69 | }; |
AnnaBridge | 145:64910690c574 | 70 | |
AnnaBridge | 145:64910690c574 | 71 | /*! |
AnnaBridge | 145:64910690c574 | 72 | * @brief CMP Hysteresis mode. |
AnnaBridge | 145:64910690c574 | 73 | */ |
AnnaBridge | 145:64910690c574 | 74 | typedef enum _cmp_hysteresis_mode |
AnnaBridge | 145:64910690c574 | 75 | { |
AnnaBridge | 145:64910690c574 | 76 | kCMP_HysteresisLevel0 = 0U, /*!< Hysteresis level 0. */ |
AnnaBridge | 145:64910690c574 | 77 | kCMP_HysteresisLevel1 = 1U, /*!< Hysteresis level 1. */ |
AnnaBridge | 145:64910690c574 | 78 | kCMP_HysteresisLevel2 = 2U, /*!< Hysteresis level 2. */ |
AnnaBridge | 145:64910690c574 | 79 | kCMP_HysteresisLevel3 = 3U, /*!< Hysteresis level 3. */ |
AnnaBridge | 145:64910690c574 | 80 | } cmp_hysteresis_mode_t; |
AnnaBridge | 145:64910690c574 | 81 | |
AnnaBridge | 145:64910690c574 | 82 | /*! |
AnnaBridge | 145:64910690c574 | 83 | * @brief CMP Voltage Reference source. |
AnnaBridge | 145:64910690c574 | 84 | */ |
AnnaBridge | 145:64910690c574 | 85 | typedef enum _cmp_reference_voltage_source |
AnnaBridge | 145:64910690c574 | 86 | { |
AnnaBridge | 145:64910690c574 | 87 | kCMP_VrefSourceVin1 = 0U, /*!< Vin1 is selected as a resistor ladder network supply reference Vin. */ |
AnnaBridge | 145:64910690c574 | 88 | kCMP_VrefSourceVin2 = 1U, /*!< Vin2 is selected as a resistor ladder network supply reference Vin. */ |
AnnaBridge | 145:64910690c574 | 89 | } cmp_reference_voltage_source_t; |
AnnaBridge | 145:64910690c574 | 90 | |
AnnaBridge | 145:64910690c574 | 91 | /*! |
AnnaBridge | 145:64910690c574 | 92 | * @brief Configures the comparator. |
AnnaBridge | 145:64910690c574 | 93 | */ |
AnnaBridge | 145:64910690c574 | 94 | typedef struct _cmp_config |
AnnaBridge | 145:64910690c574 | 95 | { |
AnnaBridge | 145:64910690c574 | 96 | bool enableCmp; /*!< Enable the CMP module. */ |
AnnaBridge | 145:64910690c574 | 97 | cmp_hysteresis_mode_t hysteresisMode; /*!< CMP Hysteresis mode. */ |
AnnaBridge | 145:64910690c574 | 98 | bool enableHighSpeed; /*!< Enable High-speed (HS) comparison mode. */ |
AnnaBridge | 145:64910690c574 | 99 | bool enableInvertOutput; /*!< Enable the inverted comparator output. */ |
AnnaBridge | 145:64910690c574 | 100 | bool useUnfilteredOutput; /*!< Set the compare output(COUT) to equal COUTA(true) or COUT(false). */ |
AnnaBridge | 145:64910690c574 | 101 | bool enablePinOut; /*!< The comparator output is available on the associated pin. */ |
AnnaBridge | 145:64910690c574 | 102 | #if defined(FSL_FEATURE_CMP_HAS_TRIGGER_MODE) && FSL_FEATURE_CMP_HAS_TRIGGER_MODE |
AnnaBridge | 145:64910690c574 | 103 | bool enableTriggerMode; /*!< Enable the trigger mode. */ |
AnnaBridge | 145:64910690c574 | 104 | #endif /* FSL_FEATURE_CMP_HAS_TRIGGER_MODE */ |
AnnaBridge | 145:64910690c574 | 105 | } cmp_config_t; |
AnnaBridge | 145:64910690c574 | 106 | |
AnnaBridge | 145:64910690c574 | 107 | /*! |
AnnaBridge | 145:64910690c574 | 108 | * @brief Configures the filter. |
AnnaBridge | 145:64910690c574 | 109 | */ |
AnnaBridge | 145:64910690c574 | 110 | typedef struct _cmp_filter_config |
AnnaBridge | 145:64910690c574 | 111 | { |
AnnaBridge | 145:64910690c574 | 112 | #if defined(FSL_FEATURE_CMP_HAS_EXTERNAL_SAMPLE_SUPPORT) && FSL_FEATURE_CMP_HAS_EXTERNAL_SAMPLE_SUPPORT |
AnnaBridge | 145:64910690c574 | 113 | bool enableSample; /*!< Using the external SAMPLE as a sampling clock input or using a divided bus clock. */ |
AnnaBridge | 145:64910690c574 | 114 | #endif /* FSL_FEATURE_CMP_HAS_EXTERNAL_SAMPLE_SUPPORT */ |
AnnaBridge | 145:64910690c574 | 115 | uint8_t filterCount; /*!< Filter Sample Count. Available range is 1-7; 0 disables the filter.*/ |
AnnaBridge | 145:64910690c574 | 116 | uint8_t filterPeriod; /*!< Filter Sample Period. The divider to the bus clock. Available range is 0-255. */ |
AnnaBridge | 145:64910690c574 | 117 | } cmp_filter_config_t; |
AnnaBridge | 145:64910690c574 | 118 | |
AnnaBridge | 145:64910690c574 | 119 | /*! |
AnnaBridge | 145:64910690c574 | 120 | * @brief Configures the internal DAC. |
AnnaBridge | 145:64910690c574 | 121 | */ |
AnnaBridge | 145:64910690c574 | 122 | typedef struct _cmp_dac_config |
AnnaBridge | 145:64910690c574 | 123 | { |
AnnaBridge | 145:64910690c574 | 124 | cmp_reference_voltage_source_t referenceVoltageSource; /*!< Supply voltage reference source. */ |
AnnaBridge | 145:64910690c574 | 125 | uint8_t DACValue; /*!< Value for the DAC Output Voltage. Available range is 0-63.*/ |
AnnaBridge | 145:64910690c574 | 126 | } cmp_dac_config_t; |
AnnaBridge | 145:64910690c574 | 127 | |
AnnaBridge | 145:64910690c574 | 128 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 129 | extern "C" { |
AnnaBridge | 145:64910690c574 | 130 | #endif |
AnnaBridge | 145:64910690c574 | 131 | |
AnnaBridge | 145:64910690c574 | 132 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 133 | * API |
AnnaBridge | 145:64910690c574 | 134 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 135 | |
AnnaBridge | 145:64910690c574 | 136 | /*! |
AnnaBridge | 145:64910690c574 | 137 | * @name Initialization |
AnnaBridge | 145:64910690c574 | 138 | * @{ |
AnnaBridge | 145:64910690c574 | 139 | */ |
AnnaBridge | 145:64910690c574 | 140 | |
AnnaBridge | 145:64910690c574 | 141 | /*! |
AnnaBridge | 145:64910690c574 | 142 | * @brief Initializes the CMP. |
AnnaBridge | 145:64910690c574 | 143 | * |
AnnaBridge | 145:64910690c574 | 144 | * This function initializes the CMP module. The operations included are as follows. |
AnnaBridge | 145:64910690c574 | 145 | * - Enabling the clock for CMP module. |
AnnaBridge | 145:64910690c574 | 146 | * - Configuring the comparator. |
AnnaBridge | 145:64910690c574 | 147 | * - Enabling the CMP module. |
AnnaBridge | 145:64910690c574 | 148 | * Note that for some devices, multiple CMP instances share the same clock gate. In this case, to enable the clock for |
AnnaBridge | 145:64910690c574 | 149 | * any instance enables all CMPs. See the appropriate MCU reference manual for the clock assignment of the CMP. |
AnnaBridge | 145:64910690c574 | 150 | * |
AnnaBridge | 145:64910690c574 | 151 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 152 | * @param config Pointer to the configuration structure. |
AnnaBridge | 145:64910690c574 | 153 | */ |
AnnaBridge | 145:64910690c574 | 154 | void CMP_Init(CMP_Type *base, const cmp_config_t *config); |
AnnaBridge | 145:64910690c574 | 155 | |
AnnaBridge | 145:64910690c574 | 156 | /*! |
AnnaBridge | 145:64910690c574 | 157 | * @brief De-initializes the CMP module. |
AnnaBridge | 145:64910690c574 | 158 | * |
AnnaBridge | 145:64910690c574 | 159 | * This function de-initializes the CMP module. The operations included are as follows. |
AnnaBridge | 145:64910690c574 | 160 | * - Disabling the CMP module. |
AnnaBridge | 145:64910690c574 | 161 | * - Disabling the clock for CMP module. |
AnnaBridge | 145:64910690c574 | 162 | * |
AnnaBridge | 145:64910690c574 | 163 | * This function disables the clock for the CMP. |
AnnaBridge | 145:64910690c574 | 164 | * Note that for some devices, multiple CMP instances share the same clock gate. In this case, before disabling the |
AnnaBridge | 145:64910690c574 | 165 | * clock for the CMP, ensure that all the CMP instances are not used. |
AnnaBridge | 145:64910690c574 | 166 | * |
AnnaBridge | 145:64910690c574 | 167 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 168 | */ |
AnnaBridge | 145:64910690c574 | 169 | void CMP_Deinit(CMP_Type *base); |
AnnaBridge | 145:64910690c574 | 170 | |
AnnaBridge | 145:64910690c574 | 171 | /*! |
AnnaBridge | 145:64910690c574 | 172 | * @brief Enables/disables the CMP module. |
AnnaBridge | 145:64910690c574 | 173 | * |
AnnaBridge | 145:64910690c574 | 174 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 175 | * @param enable Enables or disables the module. |
AnnaBridge | 145:64910690c574 | 176 | */ |
AnnaBridge | 145:64910690c574 | 177 | static inline void CMP_Enable(CMP_Type *base, bool enable) |
AnnaBridge | 145:64910690c574 | 178 | { |
AnnaBridge | 145:64910690c574 | 179 | if (enable) |
AnnaBridge | 145:64910690c574 | 180 | { |
AnnaBridge | 145:64910690c574 | 181 | base->CR1 |= CMP_CR1_EN_MASK; |
AnnaBridge | 145:64910690c574 | 182 | } |
AnnaBridge | 145:64910690c574 | 183 | else |
AnnaBridge | 145:64910690c574 | 184 | { |
AnnaBridge | 145:64910690c574 | 185 | base->CR1 &= ~CMP_CR1_EN_MASK; |
AnnaBridge | 145:64910690c574 | 186 | } |
AnnaBridge | 145:64910690c574 | 187 | } |
AnnaBridge | 145:64910690c574 | 188 | |
AnnaBridge | 145:64910690c574 | 189 | /*! |
AnnaBridge | 145:64910690c574 | 190 | * @brief Initializes the CMP user configuration structure. |
AnnaBridge | 145:64910690c574 | 191 | * |
AnnaBridge | 145:64910690c574 | 192 | * This function initializes the user configuration structure to these default values. |
AnnaBridge | 145:64910690c574 | 193 | * @code |
AnnaBridge | 145:64910690c574 | 194 | * config->enableCmp = true; |
AnnaBridge | 145:64910690c574 | 195 | * config->hysteresisMode = kCMP_HysteresisLevel0; |
AnnaBridge | 145:64910690c574 | 196 | * config->enableHighSpeed = false; |
AnnaBridge | 145:64910690c574 | 197 | * config->enableInvertOutput = false; |
AnnaBridge | 145:64910690c574 | 198 | * config->useUnfilteredOutput = false; |
AnnaBridge | 145:64910690c574 | 199 | * config->enablePinOut = false; |
AnnaBridge | 145:64910690c574 | 200 | * config->enableTriggerMode = false; |
AnnaBridge | 145:64910690c574 | 201 | * @endcode |
AnnaBridge | 145:64910690c574 | 202 | * @param config Pointer to the configuration structure. |
AnnaBridge | 145:64910690c574 | 203 | */ |
AnnaBridge | 145:64910690c574 | 204 | void CMP_GetDefaultConfig(cmp_config_t *config); |
AnnaBridge | 145:64910690c574 | 205 | |
AnnaBridge | 145:64910690c574 | 206 | /*! |
AnnaBridge | 145:64910690c574 | 207 | * @brief Sets the input channels for the comparator. |
AnnaBridge | 145:64910690c574 | 208 | * |
AnnaBridge | 145:64910690c574 | 209 | * This function sets the input channels for the comparator. |
AnnaBridge | 145:64910690c574 | 210 | * Note that two input channels cannot be set the same way in the application. When the user selects the same input |
AnnaBridge | 145:64910690c574 | 211 | * from the analog mux to the positive and negative port, the comparator is disabled automatically. |
AnnaBridge | 145:64910690c574 | 212 | * |
AnnaBridge | 145:64910690c574 | 213 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 214 | * @param positiveChannel Positive side input channel number. Available range is 0-7. |
AnnaBridge | 145:64910690c574 | 215 | * @param negativeChannel Negative side input channel number. Available range is 0-7. |
AnnaBridge | 145:64910690c574 | 216 | */ |
AnnaBridge | 145:64910690c574 | 217 | void CMP_SetInputChannels(CMP_Type *base, uint8_t positiveChannel, uint8_t negativeChannel); |
AnnaBridge | 145:64910690c574 | 218 | |
AnnaBridge | 145:64910690c574 | 219 | /* @} */ |
AnnaBridge | 145:64910690c574 | 220 | |
AnnaBridge | 145:64910690c574 | 221 | /*! |
AnnaBridge | 145:64910690c574 | 222 | * @name Advanced Features |
AnnaBridge | 145:64910690c574 | 223 | * @{ |
AnnaBridge | 145:64910690c574 | 224 | */ |
AnnaBridge | 145:64910690c574 | 225 | |
AnnaBridge | 145:64910690c574 | 226 | #if defined(FSL_FEATURE_CMP_HAS_DMA) && FSL_FEATURE_CMP_HAS_DMA |
AnnaBridge | 145:64910690c574 | 227 | /*! |
AnnaBridge | 145:64910690c574 | 228 | * @brief Enables/disables the DMA request for rising/falling events. |
AnnaBridge | 145:64910690c574 | 229 | * |
AnnaBridge | 145:64910690c574 | 230 | * This function enables/disables the DMA request for rising/falling events. Either event triggers the generation of |
AnnaBridge | 145:64910690c574 | 231 | * the DMA request from CMP if the DMA feature is enabled. Both events are ignored for generating the DMA request from the CMP |
AnnaBridge | 145:64910690c574 | 232 | * if the DMA is disabled. |
AnnaBridge | 145:64910690c574 | 233 | * |
AnnaBridge | 145:64910690c574 | 234 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 235 | * @param enable Enables or disables the feature. |
AnnaBridge | 145:64910690c574 | 236 | */ |
AnnaBridge | 145:64910690c574 | 237 | void CMP_EnableDMA(CMP_Type *base, bool enable); |
AnnaBridge | 145:64910690c574 | 238 | #endif /* FSL_FEATURE_CMP_HAS_DMA */ |
AnnaBridge | 145:64910690c574 | 239 | |
AnnaBridge | 145:64910690c574 | 240 | #if defined(FSL_FEATURE_CMP_HAS_WINDOW_MODE) && FSL_FEATURE_CMP_HAS_WINDOW_MODE |
AnnaBridge | 145:64910690c574 | 241 | /*! |
AnnaBridge | 145:64910690c574 | 242 | * @brief Enables/disables the window mode. |
AnnaBridge | 145:64910690c574 | 243 | * |
AnnaBridge | 145:64910690c574 | 244 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 245 | * @param enable Enables or disables the feature. |
AnnaBridge | 145:64910690c574 | 246 | */ |
AnnaBridge | 145:64910690c574 | 247 | static inline void CMP_EnableWindowMode(CMP_Type *base, bool enable) |
AnnaBridge | 145:64910690c574 | 248 | { |
AnnaBridge | 145:64910690c574 | 249 | if (enable) |
AnnaBridge | 145:64910690c574 | 250 | { |
AnnaBridge | 145:64910690c574 | 251 | base->CR1 |= CMP_CR1_WE_MASK; |
AnnaBridge | 145:64910690c574 | 252 | } |
AnnaBridge | 145:64910690c574 | 253 | else |
AnnaBridge | 145:64910690c574 | 254 | { |
AnnaBridge | 145:64910690c574 | 255 | base->CR1 &= ~CMP_CR1_WE_MASK; |
AnnaBridge | 145:64910690c574 | 256 | } |
AnnaBridge | 145:64910690c574 | 257 | } |
AnnaBridge | 145:64910690c574 | 258 | #endif /* FSL_FEATURE_CMP_HAS_WINDOW_MODE */ |
AnnaBridge | 145:64910690c574 | 259 | |
AnnaBridge | 145:64910690c574 | 260 | #if defined(FSL_FEATURE_CMP_HAS_PASS_THROUGH_MODE) && FSL_FEATURE_CMP_HAS_PASS_THROUGH_MODE |
AnnaBridge | 145:64910690c574 | 261 | /*! |
AnnaBridge | 145:64910690c574 | 262 | * @brief Enables/disables the pass through mode. |
AnnaBridge | 145:64910690c574 | 263 | * |
AnnaBridge | 145:64910690c574 | 264 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 265 | * @param enable Enables or disables the feature. |
AnnaBridge | 145:64910690c574 | 266 | */ |
AnnaBridge | 145:64910690c574 | 267 | static inline void CMP_EnablePassThroughMode(CMP_Type *base, bool enable) |
AnnaBridge | 145:64910690c574 | 268 | { |
AnnaBridge | 145:64910690c574 | 269 | if (enable) |
AnnaBridge | 145:64910690c574 | 270 | { |
AnnaBridge | 145:64910690c574 | 271 | base->MUXCR |= CMP_MUXCR_PSTM_MASK; |
AnnaBridge | 145:64910690c574 | 272 | } |
AnnaBridge | 145:64910690c574 | 273 | else |
AnnaBridge | 145:64910690c574 | 274 | { |
AnnaBridge | 145:64910690c574 | 275 | base->MUXCR &= ~CMP_MUXCR_PSTM_MASK; |
AnnaBridge | 145:64910690c574 | 276 | } |
AnnaBridge | 145:64910690c574 | 277 | } |
AnnaBridge | 145:64910690c574 | 278 | #endif /* FSL_FEATURE_CMP_HAS_PASS_THROUGH_MODE */ |
AnnaBridge | 145:64910690c574 | 279 | |
AnnaBridge | 145:64910690c574 | 280 | /*! |
AnnaBridge | 145:64910690c574 | 281 | * @brief Configures the filter. |
AnnaBridge | 145:64910690c574 | 282 | * |
AnnaBridge | 145:64910690c574 | 283 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 284 | * @param config Pointer to the configuration structure. |
AnnaBridge | 145:64910690c574 | 285 | */ |
AnnaBridge | 145:64910690c574 | 286 | void CMP_SetFilterConfig(CMP_Type *base, const cmp_filter_config_t *config); |
AnnaBridge | 145:64910690c574 | 287 | |
AnnaBridge | 145:64910690c574 | 288 | /*! |
AnnaBridge | 145:64910690c574 | 289 | * @brief Configures the internal DAC. |
AnnaBridge | 145:64910690c574 | 290 | * |
AnnaBridge | 145:64910690c574 | 291 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 292 | * @param config Pointer to the configuration structure. "NULL" disables the feature. |
AnnaBridge | 145:64910690c574 | 293 | */ |
AnnaBridge | 145:64910690c574 | 294 | void CMP_SetDACConfig(CMP_Type *base, const cmp_dac_config_t *config); |
AnnaBridge | 145:64910690c574 | 295 | |
AnnaBridge | 145:64910690c574 | 296 | /*! |
AnnaBridge | 145:64910690c574 | 297 | * @brief Enables the interrupts. |
AnnaBridge | 145:64910690c574 | 298 | * |
AnnaBridge | 145:64910690c574 | 299 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 300 | * @param mask Mask value for interrupts. See "_cmp_interrupt_enable". |
AnnaBridge | 145:64910690c574 | 301 | */ |
AnnaBridge | 145:64910690c574 | 302 | void CMP_EnableInterrupts(CMP_Type *base, uint32_t mask); |
AnnaBridge | 145:64910690c574 | 303 | |
AnnaBridge | 145:64910690c574 | 304 | /*! |
AnnaBridge | 145:64910690c574 | 305 | * @brief Disables the interrupts. |
AnnaBridge | 145:64910690c574 | 306 | * |
AnnaBridge | 145:64910690c574 | 307 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 308 | * @param mask Mask value for interrupts. See "_cmp_interrupt_enable". |
AnnaBridge | 145:64910690c574 | 309 | */ |
AnnaBridge | 145:64910690c574 | 310 | void CMP_DisableInterrupts(CMP_Type *base, uint32_t mask); |
AnnaBridge | 145:64910690c574 | 311 | |
AnnaBridge | 145:64910690c574 | 312 | /* @} */ |
AnnaBridge | 145:64910690c574 | 313 | |
AnnaBridge | 145:64910690c574 | 314 | /*! |
AnnaBridge | 145:64910690c574 | 315 | * @name Results |
AnnaBridge | 145:64910690c574 | 316 | * @{ |
AnnaBridge | 145:64910690c574 | 317 | */ |
AnnaBridge | 145:64910690c574 | 318 | |
AnnaBridge | 145:64910690c574 | 319 | /*! |
AnnaBridge | 145:64910690c574 | 320 | * @brief Gets the status flags. |
AnnaBridge | 145:64910690c574 | 321 | * |
AnnaBridge | 145:64910690c574 | 322 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 323 | * |
AnnaBridge | 145:64910690c574 | 324 | * @return Mask value for the asserted flags. See "_cmp_status_flags". |
AnnaBridge | 145:64910690c574 | 325 | */ |
AnnaBridge | 145:64910690c574 | 326 | uint32_t CMP_GetStatusFlags(CMP_Type *base); |
AnnaBridge | 145:64910690c574 | 327 | |
AnnaBridge | 145:64910690c574 | 328 | /*! |
AnnaBridge | 145:64910690c574 | 329 | * @brief Clears the status flags. |
AnnaBridge | 145:64910690c574 | 330 | * |
AnnaBridge | 145:64910690c574 | 331 | * @param base CMP peripheral base address. |
AnnaBridge | 145:64910690c574 | 332 | * @param mask Mask value for the flags. See "_cmp_status_flags". |
AnnaBridge | 145:64910690c574 | 333 | */ |
AnnaBridge | 145:64910690c574 | 334 | void CMP_ClearStatusFlags(CMP_Type *base, uint32_t mask); |
AnnaBridge | 145:64910690c574 | 335 | |
AnnaBridge | 145:64910690c574 | 336 | /* @} */ |
AnnaBridge | 145:64910690c574 | 337 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 338 | } |
AnnaBridge | 145:64910690c574 | 339 | #endif |
AnnaBridge | 145:64910690c574 | 340 | /*! |
AnnaBridge | 145:64910690c574 | 341 | * @} |
AnnaBridge | 145:64910690c574 | 342 | */ |
AnnaBridge | 145:64910690c574 | 343 | #endif /* _FSL_CMP_H_ */ |