fsl_acmp.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2020 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_ACMP_H_
  9. #define _FSL_ACMP_H_
  10. #include "fsl_common.h"
  11. /*!
  12. * @addtogroup acmp
  13. * @{
  14. */
  15. /*******************************************************************************
  16. * Definitions
  17. ******************************************************************************/
  18. /*! @name Driver version */
  19. /*@{*/
  20. /*! @brief ACMP driver version 2.0.6. */
  21. #define FSL_ACMP_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 6U))
  22. /*@}*/
  23. /*! @brief The mask of status flags cleared by writing 1. */
  24. #define CMP_C0_CFx_MASK (CMP_C0_CFR_MASK | CMP_C0_CFF_MASK)
  25. #define CMP_C1_CHNn_MASK 0xFF0000U /* C1_CHN0 - C1_CHN7. */
  26. #define CMP_C2_CHnF_MASK 0xFF0000U /* C2_CH0F - C2_CH7F. */
  27. /*! @brief Interrupt enable/disable mask. */
  28. enum _acmp_interrupt_enable
  29. {
  30. kACMP_OutputRisingInterruptEnable = (1U << 0U), /*!< Enable the interrupt when comparator outputs rising. */
  31. kACMP_OutputFallingInterruptEnable = (1U << 1U), /*!< Enable the interrupt when comparator outputs falling. */
  32. kACMP_RoundRobinInterruptEnable = (1U << 2U), /*!< Enable the Round-Robin interrupt. */
  33. };
  34. /*! @brief Status flag mask. */
  35. enum _acmp_status_flags
  36. {
  37. kACMP_OutputRisingEventFlag = CMP_C0_CFR_MASK, /*!< Rising-edge on compare output has occurred. */
  38. kACMP_OutputFallingEventFlag = CMP_C0_CFF_MASK, /*!< Falling-edge on compare output has occurred. */
  39. kACMP_OutputAssertEventFlag = CMP_C0_COUT_MASK, /*!< Return the current value of the analog comparator output. */
  40. };
  41. #if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U)
  42. /*!
  43. * @brief Comparator hard block offset control.
  44. *
  45. * If OFFSET level is 1, then there is no hysteresis in the case of positive port input crossing negative port
  46. * input in the positive direction (or negative port input crossing positive port input in the negative direction).
  47. * Hysteresis still exists for positive port input crossing negative port input in the falling direction.
  48. * If OFFSET level is 0, then the hysteresis selected by acmp_hysteresis_mode_t is valid for both directions.
  49. */
  50. typedef enum _acmp_offset_mode
  51. {
  52. kACMP_OffsetLevel0 = 0U, /*!< The comparator hard block output has level 0 offset internally. */
  53. kACMP_OffsetLevel1 = 1U, /*!< The comparator hard block output has level 1 offset internally. */
  54. } acmp_offset_mode_t;
  55. #endif /* FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT */
  56. /*!
  57. * @brief Comparator hard block hysteresis control.
  58. *
  59. * See chip data sheet to get the actual hysteresis value with each level.
  60. */
  61. typedef enum _acmp_hysteresis_mode
  62. {
  63. kACMP_HysteresisLevel0 = 0U, /*!< Offset is level 0 and Hysteresis is level 0. */
  64. kACMP_HysteresisLevel1 = 1U, /*!< Offset is level 0 and Hysteresis is level 1. */
  65. kACMP_HysteresisLevel2 = 2U, /*!< Offset is level 0 and Hysteresis is level 2. */
  66. kACMP_HysteresisLevel3 = 3U, /*!< Offset is level 0 and Hysteresis is level 3. */
  67. } acmp_hysteresis_mode_t;
  68. /*! @brief CMP Voltage Reference source. */
  69. typedef enum _acmp_reference_voltage_source
  70. {
  71. kACMP_VrefSourceVin1 = 0U, /*!< Vin1 is selected as resistor ladder network supply reference Vin. */
  72. kACMP_VrefSourceVin2 = 1U, /*!< Vin2 is selected as resistor ladder network supply reference Vin. */
  73. } acmp_reference_voltage_source_t;
  74. #if defined(FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT == 1U)
  75. /*! @brief Port input source. */
  76. typedef enum _acmp_port_input
  77. {
  78. kACMP_PortInputFromDAC = 0U, /*!< Port input from the 8-bit DAC output. */
  79. kACMP_PortInputFromMux = 1U, /*!< Port input from the analog 8-1 mux. */
  80. } acmp_port_input_t;
  81. #endif /* FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT */
  82. /*! @brief Fixed mux port. */
  83. typedef enum _acmp_fixed_port
  84. {
  85. kACMP_FixedPlusPort = 0U, /*!< Only the inputs to the Minus port are swept in each round. */
  86. kACMP_FixedMinusPort = 1U, /*!< Only the inputs to the Plus port are swept in each round. */
  87. } acmp_fixed_port_t;
  88. #if defined(FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT == 1U)
  89. /*! @brief Internal DAC's work mode. */
  90. typedef enum _acmp_dac_work_mode
  91. {
  92. kACMP_DACWorkLowSpeedMode = 0U, /*!< DAC is selected to work in low speed and low power mode. */
  93. kACMP_DACWorkHighSpeedMode = 1U, /*!< DAC is selected to work in high speed high power mode. */
  94. } acmp_dac_work_mode_t;
  95. #endif /* FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT */
  96. /*! @brief Configuration for ACMP. */
  97. typedef struct _acmp_config
  98. {
  99. #if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U)
  100. acmp_offset_mode_t offsetMode; /*!< Offset mode. */
  101. #endif /* FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT */
  102. acmp_hysteresis_mode_t hysteresisMode; /*!< Hysteresis mode. */
  103. bool enableHighSpeed; /*!< Enable High Speed (HS) comparison mode. */
  104. bool enableInvertOutput; /*!< Enable inverted comparator output. */
  105. bool useUnfilteredOutput; /*!< Set compare output(COUT) to equal COUTA(true) or COUT(false). */
  106. bool enablePinOut; /*!< The comparator output is available on the associated pin. */
  107. } acmp_config_t;
  108. /*!
  109. * @brief Configuration for channel.
  110. *
  111. * The comparator's port can be input from channel mux or DAC. If port input is from channel mux, detailed channel
  112. * number for the mux should be configured.
  113. */
  114. typedef struct _acmp_channel_config
  115. {
  116. #if defined(FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT == 1U)
  117. acmp_port_input_t positivePortInput; /*!< Input source of the comparator's positive port. */
  118. #endif /* FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT */
  119. uint32_t plusMuxInput; /*!< Plus mux input channel(0~7). */
  120. #if defined(FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT == 1U)
  121. acmp_port_input_t negativePortInput; /*!< Input source of the comparator's negative port. */
  122. #endif /* FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT */
  123. uint32_t minusMuxInput; /*!< Minus mux input channel(0~7). */
  124. } acmp_channel_config_t;
  125. /*! @brief Configuration for filter. */
  126. typedef struct _acmp_filter_config
  127. {
  128. bool enableSample; /*!< Using external SAMPLE as sampling clock input, or using divided bus clock. */
  129. uint32_t filterCount; /*!< Filter Sample Count. Available range is 1-7, 0 would cause the filter disabled. */
  130. uint32_t filterPeriod; /*!< Filter Sample Period. The divider to bus clock. Available range is 0-255. */
  131. } acmp_filter_config_t;
  132. /*! @brief Configuration for DAC. */
  133. typedef struct _acmp_dac_config
  134. {
  135. acmp_reference_voltage_source_t referenceVoltageSource; /*!< Supply voltage reference source. */
  136. uint32_t DACValue; /*!< Value for DAC Output Voltage. Available range is 0-255. */
  137. #if defined(FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT == 1U)
  138. bool enableOutput; /*!< Enable the DAC output. */
  139. #endif /* FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT */
  140. #if defined(FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT == 1U)
  141. acmp_dac_work_mode_t workMode;
  142. #endif /* FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT */
  143. } acmp_dac_config_t;
  144. /*! @brief Configuration for round robin mode. */
  145. typedef struct _acmp_round_robin_config
  146. {
  147. acmp_fixed_port_t fixedPort; /*!< Fixed mux port. */
  148. uint32_t fixedChannelNumber; /*!< Indicates which channel is fixed in the fixed mux port. */
  149. uint32_t checkerChannelMask; /*!< Mask of checker channel index. Available range is channel0:0x01 to channel7:0x80
  150. for round-robin checker. */
  151. uint32_t sampleClockCount; /*!< Specifies how many round-robin clock cycles(0~3) later the sample takes place. */
  152. uint32_t delayModulus; /*!< Comparator and DAC initialization delay modulus. */
  153. } acmp_round_robin_config_t;
  154. #if defined(FSL_FEATURE_ACMP_HAS_C3_REG) && (FSL_FEATURE_ACMP_HAS_C3_REG == 1U)
  155. /*! @brief Discrete mode clock selection. */
  156. typedef enum _acmp_discrete_clock_source
  157. {
  158. kACMP_DiscreteClockSlow = 0U, /*!< Slow clock (32kHz) is used as the discrete mode clock. */
  159. kACMP_DiscreteClockFast = 1U, /*!< Fast clock (16-20MHz) is used as the discrete mode clock. */
  160. } acmp_discrete_clock_source_t;
  161. /*!
  162. * @brief ACMP discrete sample selection.
  163. * These values configures the analog comparator sampling timing (speicified by the discrete mode clock period T which
  164. * is selected by #acmp_discrete_clock_source_t) in discrete mode.
  165. */
  166. typedef enum _acmp_discrete_sample_time
  167. {
  168. kACMP_DiscreteSampleTimeAs1T = 0U, /*!< The sampling time equals to 1xT. */
  169. kACMP_DiscreteSampleTimeAs2T = 1U, /*!< The sampling time equals to 2xT. */
  170. kACMP_DiscreteSampleTimeAs4T = 2U, /*!< The sampling time equals to 4xT. */
  171. kACMP_DiscreteSampleTimeAs8T = 3U, /*!< The sampling time equals to 8xT. */
  172. kACMP_DiscreteSampleTimeAs16T = 4U, /*!< The sampling time equals to 16xT. */
  173. kACMP_DiscreteSampleTimeAs32T = 5U, /*!< The sampling time equals to 32xT. */
  174. kACMP_DiscreteSampleTimeAs64T = 6U, /*!< The sampling time equals to 64xT. */
  175. kACMP_DiscreteSampleTimeAs256T = 7U, /*!< The sampling time equals to 256xT. */
  176. } acmp_discrete_sample_time_t;
  177. /*!
  178. * @brief ACMP discrete phase time selection.
  179. * There are two phases for sampling input signals, phase 1 and phase 2.
  180. */
  181. typedef enum _acmp_discrete_phase_time
  182. {
  183. kACMP_DiscretePhaseTimeAlt0 = 0U, /*!< The phase x active in one sampling selection 0. */
  184. kACMP_DiscretePhaseTimeAlt1 = 1U, /*!< The phase x active in one sampling selection 1. */
  185. kACMP_DiscretePhaseTimeAlt2 = 2U, /*!< The phase x active in one sampling selection 2. */
  186. kACMP_DiscretePhaseTimeAlt3 = 3U, /*!< The phase x active in one sampling selection 3. */
  187. kACMP_DiscretePhaseTimeAlt4 = 4U, /*!< The phase x active in one sampling selection 4. */
  188. kACMP_DiscretePhaseTimeAlt5 = 5U, /*!< The phase x active in one sampling selection 5. */
  189. kACMP_DiscretePhaseTimeAlt6 = 6U, /*!< The phase x active in one sampling selection 6. */
  190. kACMP_DiscretePhaseTimeAlt7 = 7U, /*!< The phase x active in one sampling selection 7. */
  191. } acmp_discrete_phase_time_t;
  192. /*! @brief Configuration for discrete mode. */
  193. typedef struct _acmp_discrete_mode_config
  194. {
  195. bool enablePositiveChannelDiscreteMode; /*!< Positive Channel Continuous Mode Enable. By default, the continuous
  196. mode is used. */
  197. bool enableNegativeChannelDiscreteMode; /*!< Negative Channel Continuous Mode Enable. By default, the continuous
  198. mode is used. */
  199. bool enableResistorDivider; /*!< Resistor Divider Enable is used to enable the resistor divider for the inputs when
  200. they come from 3v domain and their values are above 1.8v. */
  201. acmp_discrete_clock_source_t clockSource; /*!< Select the clock source in order to generate the requiried timing for
  202. comparator to work in discrete mode. */
  203. acmp_discrete_sample_time_t sampleTime; /*!< Select the ACMP total sampling time period. */
  204. acmp_discrete_phase_time_t phase1Time; /*!< Select the ACMP phase 1 sampling time. */
  205. acmp_discrete_phase_time_t phase2Time; /*!< Select the ACMP phase 2 sampling time. */
  206. } acmp_discrete_mode_config_t;
  207. #endif /* FSL_FEATURE_ACMP_HAS_C3_REG */
  208. #if defined(__cplusplus)
  209. extern "C" {
  210. #endif
  211. /*******************************************************************************
  212. * API
  213. ******************************************************************************/
  214. /*!
  215. * @name Initialization and deinitialization
  216. * @{
  217. */
  218. /*!
  219. * @brief Initializes the ACMP.
  220. *
  221. * The default configuration can be got by calling ACMP_GetDefaultConfig().
  222. *
  223. * @param base ACMP peripheral base address.
  224. * @param config Pointer to ACMP configuration structure.
  225. */
  226. void ACMP_Init(CMP_Type *base, const acmp_config_t *config);
  227. /*!
  228. * @brief Deinitializes the ACMP.
  229. *
  230. * @param base ACMP peripheral base address.
  231. */
  232. void ACMP_Deinit(CMP_Type *base);
  233. /*!
  234. * @brief Gets the default configuration for ACMP.
  235. *
  236. * This function initializes the user configuration structure to default value. The default value are:
  237. *
  238. * Example:
  239. @code
  240. config->enableHighSpeed = false;
  241. config->enableInvertOutput = false;
  242. config->useUnfilteredOutput = false;
  243. config->enablePinOut = false;
  244. config->enableHysteresisBothDirections = false;
  245. config->hysteresisMode = kACMP_hysteresisMode0;
  246. @endcode
  247. *
  248. * @param config Pointer to ACMP configuration structure.
  249. */
  250. void ACMP_GetDefaultConfig(acmp_config_t *config);
  251. /* @} */
  252. /*!
  253. * @name Basic Operations
  254. * @{
  255. */
  256. /*!
  257. * @brief Enables or disables the ACMP.
  258. *
  259. * @param base ACMP peripheral base address.
  260. * @param enable True to enable the ACMP.
  261. */
  262. void ACMP_Enable(CMP_Type *base, bool enable);
  263. #if defined(FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT) && (FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT == 1U)
  264. /*!
  265. * @brief Enables the link from CMP to DAC enable.
  266. *
  267. * When this bit is set, the DAC enable/disable is controlled by the bit CMP_C0[EN] instead of CMP_C1[DACEN].
  268. *
  269. * @param base ACMP peripheral base address.
  270. * @param enable Enable the feature or not.
  271. */
  272. void ACMP_EnableLinkToDAC(CMP_Type *base, bool enable);
  273. #endif /* FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT */
  274. /*!
  275. * @brief Sets the channel configuration.
  276. *
  277. * Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but
  278. * from channel mux.
  279. *
  280. * Example:
  281. @code
  282. acmp_channel_config_t configStruct = {0};
  283. configStruct.positivePortInput = kACMP_PortInputFromDAC;
  284. configStruct.negativePortInput = kACMP_PortInputFromMux;
  285. configStruct.minusMuxInput = 1U;
  286. ACMP_SetChannelConfig(CMP0, &configStruct);
  287. @endcode
  288. *
  289. * @param base ACMP peripheral base address.
  290. * @param config Pointer to channel configuration structure.
  291. */
  292. void ACMP_SetChannelConfig(CMP_Type *base, const acmp_channel_config_t *config);
  293. /* @} */
  294. /*!
  295. * @name Advanced Operations
  296. * @{
  297. */
  298. /*!
  299. * @brief Enables or disables DMA.
  300. *
  301. * @param base ACMP peripheral base address.
  302. * @param enable True to enable DMA.
  303. */
  304. void ACMP_EnableDMA(CMP_Type *base, bool enable);
  305. /*!
  306. * @brief Enables or disables window mode.
  307. *
  308. * @param base ACMP peripheral base address.
  309. * @param enable True to enable window mode.
  310. */
  311. void ACMP_EnableWindowMode(CMP_Type *base, bool enable);
  312. /*!
  313. * @brief Configures the filter.
  314. *
  315. * The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample
  316. * clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed
  317. * usage can be got from the reference manual.
  318. *
  319. * Example:
  320. @code
  321. acmp_filter_config_t configStruct = {0};
  322. configStruct.filterCount = 5U;
  323. configStruct.filterPeriod = 200U;
  324. configStruct.enableSample = false;
  325. ACMP_SetFilterConfig(CMP0, &configStruct);
  326. @endcode
  327. *
  328. * @param base ACMP peripheral base address.
  329. * @param config Pointer to filter configuration structure.
  330. */
  331. void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config);
  332. /*!
  333. * @brief Configures the internal DAC.
  334. *
  335. * Example:
  336. @code
  337. acmp_dac_config_t configStruct = {0};
  338. configStruct.referenceVoltageSource = kACMP_VrefSourceVin1;
  339. configStruct.DACValue = 20U;
  340. configStruct.enableOutput = false;
  341. configStruct.workMode = kACMP_DACWorkLowSpeedMode;
  342. ACMP_SetDACConfig(CMP0, &configStruct);
  343. @endcode
  344. *
  345. * @param base ACMP peripheral base address.
  346. * @param config Pointer to DAC configuration structure. "NULL" is for disabling the feature.
  347. */
  348. void ACMP_SetDACConfig(CMP_Type *base, const acmp_dac_config_t *config);
  349. /*!
  350. * @brief Configures the round robin mode.
  351. *
  352. * Example:
  353. @code
  354. acmp_round_robin_config_t configStruct = {0};
  355. configStruct.fixedPort = kACMP_FixedPlusPort;
  356. configStruct.fixedChannelNumber = 3U;
  357. configStruct.checkerChannelMask = 0xF7U;
  358. configStruct.sampleClockCount = 0U;
  359. configStruct.delayModulus = 0U;
  360. ACMP_SetRoundRobinConfig(CMP0, &configStruct);
  361. @endcode
  362. * @param base ACMP peripheral base address.
  363. * @param config Pointer to round robin mode configuration structure. "NULL" is for disabling the feature.
  364. */
  365. void ACMP_SetRoundRobinConfig(CMP_Type *base, const acmp_round_robin_config_t *config);
  366. /*!
  367. * @brief Defines the pre-set state of channels in round robin mode.
  368. *
  369. * Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits.
  370. * So get-round-robin-result can't return the same value as the value are set by pre-state.
  371. *
  372. * @param base ACMP peripheral base address.
  373. * @param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80.
  374. */
  375. void ACMP_SetRoundRobinPreState(CMP_Type *base, uint32_t mask);
  376. /*!
  377. * @brief Gets the channel input changed flags in round robin mode.
  378. *
  379. * @param base ACMP peripheral base address.
  380. * @return Mask of channel input changed asserted flags. Available range is channel0:0x01 to channel7:0x80.
  381. */
  382. static inline uint32_t ACMP_GetRoundRobinStatusFlags(CMP_Type *base)
  383. {
  384. return (((base->C2) & CMP_C2_CHnF_MASK) >> CMP_C2_CH0F_SHIFT);
  385. }
  386. /*!
  387. * @brief Clears the channel input changed flags in round robin mode.
  388. *
  389. * @param base ACMP peripheral base address.
  390. * @param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80.
  391. */
  392. void ACMP_ClearRoundRobinStatusFlags(CMP_Type *base, uint32_t mask);
  393. /*!
  394. * @brief Gets the round robin result.
  395. *
  396. * Note that the set-pre-state has different circuit with get-round-robin-result in the SOC even though they are same
  397. * bits. So ACMP_GetRoundRobinResult() can't return the same value as the value are set by ACMP_SetRoundRobinPreState.
  398. * @param base ACMP peripheral base address.
  399. * @return Mask of round robin channel result. Available range is channel0:0x01 to channel7:0x80.
  400. */
  401. static inline uint32_t ACMP_GetRoundRobinResult(CMP_Type *base)
  402. {
  403. return ((base->C2 & CMP_C2_ACOn_MASK) >> CMP_C2_ACOn_SHIFT);
  404. }
  405. /* @} */
  406. /*!
  407. * @name Interrupts
  408. * @{
  409. */
  410. /*!
  411. * @brief Enables interrupts.
  412. *
  413. * @param base ACMP peripheral base address.
  414. * @param mask Interrupts mask. See "_acmp_interrupt_enable".
  415. */
  416. void ACMP_EnableInterrupts(CMP_Type *base, uint32_t mask);
  417. /*!
  418. * @brief Disables interrupts.
  419. *
  420. * @param base ACMP peripheral base address.
  421. * @param mask Interrupts mask. See "_acmp_interrupt_enable".
  422. */
  423. void ACMP_DisableInterrupts(CMP_Type *base, uint32_t mask);
  424. /* @} */
  425. /*!
  426. * @name Status
  427. * @{
  428. */
  429. /*!
  430. * @brief Gets status flags.
  431. *
  432. * @param base ACMP peripheral base address.
  433. * @return Status flags asserted mask. See "_acmp_status_flags".
  434. */
  435. uint32_t ACMP_GetStatusFlags(CMP_Type *base);
  436. /*!
  437. * @brief Clears status flags.
  438. *
  439. * @param base ACMP peripheral base address.
  440. * @param mask Status flags mask. See "_acmp_status_flags".
  441. */
  442. void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask);
  443. /* @} */
  444. #if defined(FSL_FEATURE_ACMP_HAS_C3_REG) && (FSL_FEATURE_ACMP_HAS_C3_REG == 1U)
  445. /*!
  446. * @name Discrete mode
  447. * @{
  448. */
  449. /*!
  450. * @brief Configure the discrete mode.
  451. *
  452. * Configure the discrete mode when supporting 3V domain with 1.8V core.
  453. *
  454. * @param base ACMP peripheral base address.
  455. * @param config Pointer to configuration structure. See "acmp_discrete_mode_config_t".
  456. */
  457. void ACMP_SetDiscreteModeConfig(CMP_Type *base, const acmp_discrete_mode_config_t *config);
  458. /*!
  459. * @brief Get the default configuration for discrete mode setting.
  460. *
  461. * @param config Pointer to configuration structure to be restored with the setting values.
  462. */
  463. void ACMP_GetDefaultDiscreteModeConfig(acmp_discrete_mode_config_t *config);
  464. /* @} */
  465. #endif /* FSL_FEATURE_ACMP_HAS_C3_REG */
  466. #if defined(__cplusplus)
  467. }
  468. #endif
  469. /*! @}*/
  470. #endif /* _FSL_ACMP_H_ */