nrf_comp.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. /**
  2. * Copyright (c) 2015 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef NRF_COMP_H_
  41. #define NRF_COMP_H_
  42. #include <nrfx.h>
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. /**
  47. * @defgroup nrf_comp_hal COMP HAL
  48. * @{
  49. * @ingroup nrf_comp
  50. * @brief Hardware access layer (HAL) for managing the Comparator (COMP) peripheral.
  51. */
  52. /** @brief COMP analog pin selection. */
  53. typedef enum
  54. {
  55. NRF_COMP_INPUT_0 = COMP_PSEL_PSEL_AnalogInput0, /*!< AIN0 selected as analog input. */
  56. NRF_COMP_INPUT_1 = COMP_PSEL_PSEL_AnalogInput1, /*!< AIN1 selected as analog input. */
  57. NRF_COMP_INPUT_2 = COMP_PSEL_PSEL_AnalogInput2, /*!< AIN2 selected as analog input. */
  58. NRF_COMP_INPUT_3 = COMP_PSEL_PSEL_AnalogInput3, /*!< AIN3 selected as analog input. */
  59. #if defined (COMP_PSEL_PSEL_AnalogInput4) || defined (__NRFX_DOXYGEN__)
  60. NRF_COMP_INPUT_4 = COMP_PSEL_PSEL_AnalogInput4, /*!< AIN4 selected as analog input. */
  61. #endif
  62. #if defined (COMP_PSEL_PSEL_AnalogInput5) || defined (__NRFX_DOXYGEN__)
  63. NRF_COMP_INPUT_5 = COMP_PSEL_PSEL_AnalogInput5, /*!< AIN5 selected as analog input. */
  64. #endif
  65. #if defined (COMP_PSEL_PSEL_AnalogInput6) || defined (__NRFX_DOXYGEN__)
  66. NRF_COMP_INPUT_6 = COMP_PSEL_PSEL_AnalogInput6, /*!< AIN6 selected as analog input. */
  67. #endif
  68. #if defined (COMP_PSEL_PSEL_AnalogInput7) || defined (__NRFX_DOXYGEN__)
  69. NRF_COMP_INPUT_7 = COMP_PSEL_PSEL_AnalogInput7, /*!< AIN7 selected as analog input. */
  70. #endif
  71. #if defined (COMP_PSEL_PSEL_VddDiv2) || defined (__NRFX_DOXYGEN__)
  72. NRF_COMP_VDD_DIV2 = COMP_PSEL_PSEL_VddDiv2, /*!< VDD/2 selected as analog input. */
  73. #endif
  74. #if defined (COMP_PSEL_PSEL_VddhDiv5) || defined (__NRFX_DOXYGEN__)
  75. NRF_COMP_VDDH_DIV5 = COMP_PSEL_PSEL_VddhDiv5, /*!< VDDH/5 selected as analog input. */
  76. #endif
  77. } nrf_comp_input_t;
  78. /** @brief COMP reference selection. */
  79. typedef enum
  80. {
  81. NRF_COMP_REF_Int1V2 = COMP_REFSEL_REFSEL_Int1V2, /*!< VREF = internal 1.2 V reference (VDD >= 1.7 V). */
  82. NRF_COMP_REF_Int1V8 = COMP_REFSEL_REFSEL_Int1V8, /*!< VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V). */
  83. NRF_COMP_REF_Int2V4 = COMP_REFSEL_REFSEL_Int2V4, /*!< VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V). */
  84. NRF_COMP_REF_VDD = COMP_REFSEL_REFSEL_VDD, /*!< VREF = VDD. */
  85. NRF_COMP_REF_ARef = COMP_REFSEL_REFSEL_ARef /*!< VREF = AREF (VDD >= VREF >= AREFMIN). */
  86. } nrf_comp_ref_t;
  87. /** @brief COMP external analog reference selection. */
  88. typedef enum
  89. {
  90. NRF_COMP_EXT_REF_0 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference0, /*!< Use AIN0 as external analog reference. */
  91. NRF_COMP_EXT_REF_1 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference1, /*!< Use AIN1 as external analog reference. */
  92. NRF_COMP_EXT_REF_2 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference2, /*!< Use AIN2 as external analog reference. */
  93. NRF_COMP_EXT_REF_3 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference3, /*!< Use AIN3 as external analog reference. */
  94. #if defined (COMP_EXTREFSEL_EXTREFSEL_AnalogReference4) || defined (__NRFX_DOXYGEN__)
  95. NRF_COMP_EXT_REF_4 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference4, /*!< Use AIN4 as external analog reference. */
  96. #endif
  97. #if defined (COMP_EXTREFSEL_EXTREFSEL_AnalogReference5) || defined (__NRFX_DOXYGEN__)
  98. NRF_COMP_EXT_REF_5 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference5, /*!< Use AIN5 as external analog reference. */
  99. #endif
  100. #if defined (COMP_EXTREFSEL_EXTREFSEL_AnalogReference6) || defined (__NRFX_DOXYGEN__)
  101. NRF_COMP_EXT_REF_6 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference6, /*!< Use AIN6 as external analog reference. */
  102. #endif
  103. #if defined (COMP_EXTREFSEL_EXTREFSEL_AnalogReference7) || defined (__NRFX_DOXYGEN__)
  104. NRF_COMP_EXT_REF_7 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference7 /*!< Use AIN7 as external analog reference. */
  105. #endif
  106. } nrf_comp_ext_ref_t;
  107. /** @brief COMP THDOWN and THUP values that are used to calculate the threshold voltages VDOWN and VUP. */
  108. typedef struct
  109. {
  110. uint8_t th_down; /*!< THDOWN value. */
  111. uint8_t th_up; /*!< THUP value. */
  112. } nrf_comp_th_t;
  113. /** @brief COMP main operation mode. */
  114. typedef enum
  115. {
  116. NRF_COMP_MAIN_MODE_SE = COMP_MODE_MAIN_SE, /*!< Single-ended mode. */
  117. NRF_COMP_MAIN_MODE_Diff = COMP_MODE_MAIN_Diff /*!< Differential mode. */
  118. } nrf_comp_main_mode_t;
  119. /** @brief COMP speed and power mode. */
  120. typedef enum
  121. {
  122. NRF_COMP_SP_MODE_Low = COMP_MODE_SP_Low, /*!< Low power mode. */
  123. NRF_COMP_SP_MODE_Normal = COMP_MODE_SP_Normal, /*!< Normal mode. */
  124. NRF_COMP_SP_MODE_High = COMP_MODE_SP_High /*!< High-speed mode. */
  125. } nrf_comp_sp_mode_t;
  126. /** @brief COMP comparator hysteresis. */
  127. typedef enum
  128. {
  129. NRF_COMP_HYST_NoHyst = COMP_HYST_HYST_NoHyst, /*!< Comparator hysteresis disabled. */
  130. NRF_COMP_HYST_50mV = COMP_HYST_HYST_Hyst50mV /*!< Comparator hysteresis enabled. */
  131. } nrf_comp_hyst_t;
  132. #if defined (COMP_ISOURCE_ISOURCE_Msk) || defined (__NRFX_DOXYGEN__)
  133. /** @brief COMP current source selection on analog input. */
  134. typedef enum
  135. {
  136. NRF_COMP_ISOURCE_Off = COMP_ISOURCE_ISOURCE_Off, /*!< Current source disabled. */
  137. NRF_COMP_ISOURCE_Ien2uA5 = COMP_ISOURCE_ISOURCE_Ien2mA5, /*!< Current source enabled (+/- 2.5 uA). */
  138. NRF_COMP_ISOURCE_Ien5uA = COMP_ISOURCE_ISOURCE_Ien5mA, /*!< Current source enabled (+/- 5 uA). */
  139. NRF_COMP_ISOURCE_Ien10uA = COMP_ISOURCE_ISOURCE_Ien10mA /*!< Current source enabled (+/- 10 uA). */
  140. } nrf_isource_t;
  141. #endif
  142. /** @brief COMP tasks. */
  143. typedef enum
  144. {
  145. NRF_COMP_TASK_START = offsetof(NRF_COMP_Type, TASKS_START), /*!< COMP start sampling task. */
  146. NRF_COMP_TASK_STOP = offsetof(NRF_COMP_Type, TASKS_STOP), /*!< COMP stop sampling task. */
  147. NRF_COMP_TASK_SAMPLE = offsetof(NRF_COMP_Type, TASKS_SAMPLE) /*!< Sample comparator value. */
  148. } nrf_comp_task_t;
  149. /** @brief COMP events. */
  150. typedef enum
  151. {
  152. NRF_COMP_EVENT_READY = offsetof(NRF_COMP_Type, EVENTS_READY), /*!< COMP is ready and output is valid. */
  153. NRF_COMP_EVENT_DOWN = offsetof(NRF_COMP_Type, EVENTS_DOWN), /*!< Input voltage crossed the threshold going down. */
  154. NRF_COMP_EVENT_UP = offsetof(NRF_COMP_Type, EVENTS_UP), /*!< Input voltage crossed the threshold going up. */
  155. NRF_COMP_EVENT_CROSS = offsetof(NRF_COMP_Type, EVENTS_CROSS) /*!< Input voltage crossed the threshold in any direction. */
  156. } nrf_comp_event_t;
  157. /** @brief COMP reference configuration. */
  158. typedef struct
  159. {
  160. nrf_comp_ref_t reference; /*!< COMP reference selection. */
  161. nrf_comp_ext_ref_t external; /*!< COMP external analog reference selection. */
  162. } nrf_comp_ref_conf_t;
  163. /** @brief Function for enabling the COMP peripheral. */
  164. __STATIC_INLINE void nrf_comp_enable(void);
  165. /** @brief Function for disabling the COMP peripheral. */
  166. __STATIC_INLINE void nrf_comp_disable(void);
  167. /**
  168. * @brief Function for checking if the COMP peripheral is enabled.
  169. *
  170. * @retval true The COMP peripheral is enabled.
  171. * @retval false The COMP peripheral is not enabled.
  172. */
  173. __STATIC_INLINE bool nrf_comp_enable_check(void);
  174. /**
  175. * @brief Function for setting the reference source.
  176. *
  177. * @param[in] reference COMP reference selection.
  178. */
  179. __STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference);
  180. /**
  181. * @brief Function for setting the external analog reference source.
  182. *
  183. * @param[in] ext_ref COMP external analog reference selection.
  184. */
  185. __STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref);
  186. /**
  187. * @brief Function for setting threshold voltages.
  188. *
  189. * @param[in] threshold COMP VDOWN and VUP thresholds.
  190. */
  191. __STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold);
  192. /**
  193. * @brief Function for setting the main mode.
  194. *
  195. * @param[in] main_mode COMP main operation mode.
  196. */
  197. __STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode);
  198. /**
  199. * @brief Function for setting the speed mode.
  200. *
  201. * @param[in] speed_mode COMP speed and power mode.
  202. */
  203. __STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode);
  204. /**
  205. * @brief Function for setting the hysteresis.
  206. *
  207. * @param[in] hyst COMP comparator hysteresis.
  208. */
  209. __STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst);
  210. #if defined (COMP_ISOURCE_ISOURCE_Msk) || defined (__NRFX_DOXYGEN__)
  211. /**
  212. * @brief Function for setting the current source on the analog input.
  213. *
  214. * @param[in] isource COMP current source selection on analog input.
  215. */
  216. __STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource);
  217. #endif
  218. /**
  219. * @brief Function for selecting the active input of the COMP.
  220. *
  221. * @param[in] input Input to be selected.
  222. */
  223. __STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input);
  224. /**
  225. * @brief Function for getting the last COMP compare result.
  226. *
  227. * @note If VIN+ == VIN-, the return value depends on the previous result.
  228. *
  229. * @return The last compare result. If 0, then VIN+ < VIN-. If 1, then VIN+ > VIN-.
  230. */
  231. __STATIC_INLINE uint32_t nrf_comp_result_get(void);
  232. /**
  233. * @brief Function for enabling interrupts from COMP.
  234. *
  235. * @param[in] mask Mask of interrupts to be enabled.
  236. *
  237. * @sa nrf_comp_int_enable_check
  238. */
  239. __STATIC_INLINE void nrf_comp_int_enable(uint32_t mask);
  240. /**
  241. * @brief Function for disabling interrupts from COMP.
  242. *
  243. * @param[in] mask Mask of interrupts to be disabled.
  244. *
  245. * @sa nrf_comp_int_enable_check
  246. */
  247. __STATIC_INLINE void nrf_comp_int_disable(uint32_t mask);
  248. /**
  249. * @brief Function for getting the enabled interrupts of COMP.
  250. *
  251. * @param[in] mask Mask of interrupts to be checked.
  252. *
  253. * @retval true At least one interrupt from the specified mask is enabled.
  254. * @retval false No interrupt provided by the specified mask are enabled.
  255. */
  256. __STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t mask);
  257. /**
  258. * @brief Function for getting the address of the specified COMP task register.
  259. *
  260. * @param[in] task COMP task.
  261. *
  262. * @return Address of the specified COMP task.
  263. */
  264. __STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t task);
  265. /**
  266. * @brief Function for getting the address of the specified COMP event register.
  267. *
  268. * @param[in] event COMP event.
  269. *
  270. * @return Address of the specified COMP event.
  271. */
  272. __STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t event);
  273. /**
  274. * @brief Function for setting COMP shortcuts.
  275. *
  276. * @param[in] mask Mask of shortcuts.
  277. */
  278. __STATIC_INLINE void nrf_comp_shorts_enable(uint32_t mask);
  279. /**
  280. * @brief Function for clearing COMP shortcuts by mask.
  281. *
  282. * @param[in] mask Mask of shortcuts.
  283. */
  284. __STATIC_INLINE void nrf_comp_shorts_disable(uint32_t mask);
  285. /**
  286. * @brief Function for setting the specified COMP task.
  287. *
  288. * @param[in] task Task to be activated.
  289. */
  290. __STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t task);
  291. /**
  292. * @brief Function for clearing the specified COMP event.
  293. *
  294. * @param[in] event COMP event to be cleared.
  295. */
  296. __STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t event);
  297. /**
  298. * @brief Function for retrieving the state of the UARTE event.
  299. *
  300. * @param[in] event Event to be checked.
  301. *
  302. * @retval true The event has been generated.
  303. * @retval false The event has not been generated.
  304. */
  305. __STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t event);
  306. #ifndef SUPPRESS_INLINE_IMPLEMENTATION
  307. __STATIC_INLINE void nrf_comp_enable(void)
  308. {
  309. NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Enabled << COMP_ENABLE_ENABLE_Pos);
  310. }
  311. __STATIC_INLINE void nrf_comp_disable(void)
  312. {
  313. NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Disabled << COMP_ENABLE_ENABLE_Pos);
  314. }
  315. __STATIC_INLINE bool nrf_comp_enable_check(void)
  316. {
  317. return ((NRF_COMP->ENABLE) & COMP_ENABLE_ENABLE_Enabled);
  318. }
  319. __STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference)
  320. {
  321. NRF_COMP->REFSEL = (reference << COMP_REFSEL_REFSEL_Pos);
  322. }
  323. __STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref)
  324. {
  325. NRF_COMP->EXTREFSEL = (ext_ref << COMP_EXTREFSEL_EXTREFSEL_Pos);
  326. }
  327. __STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold)
  328. {
  329. NRF_COMP->TH =
  330. (((uint32_t)threshold.th_down << COMP_TH_THDOWN_Pos) & COMP_TH_THDOWN_Msk) |
  331. (((uint32_t)threshold.th_up << COMP_TH_THUP_Pos) & COMP_TH_THUP_Msk);
  332. }
  333. __STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode)
  334. {
  335. NRF_COMP->MODE |= (main_mode << COMP_MODE_MAIN_Pos);
  336. }
  337. __STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode)
  338. {
  339. NRF_COMP->MODE |= (speed_mode << COMP_MODE_SP_Pos);
  340. }
  341. __STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst)
  342. {
  343. NRF_COMP->HYST = (hyst << COMP_HYST_HYST_Pos) & COMP_HYST_HYST_Msk;
  344. }
  345. #if defined (COMP_ISOURCE_ISOURCE_Msk)
  346. __STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource)
  347. {
  348. NRF_COMP->ISOURCE = (isource << COMP_ISOURCE_ISOURCE_Pos) & COMP_ISOURCE_ISOURCE_Msk;
  349. }
  350. #endif
  351. __STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input)
  352. {
  353. NRF_COMP->PSEL = ((uint32_t)input << COMP_PSEL_PSEL_Pos);
  354. }
  355. __STATIC_INLINE uint32_t nrf_comp_result_get(void)
  356. {
  357. return (uint32_t)NRF_COMP->RESULT;
  358. }
  359. __STATIC_INLINE void nrf_comp_int_enable(uint32_t mask)
  360. {
  361. NRF_COMP->INTENSET = mask;
  362. }
  363. __STATIC_INLINE void nrf_comp_int_disable(uint32_t mask)
  364. {
  365. NRF_COMP->INTENCLR = mask;
  366. }
  367. __STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t mask)
  368. {
  369. return (NRF_COMP->INTENSET & mask); // When read, this register returns the value of INTEN.
  370. }
  371. __STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t task)
  372. {
  373. return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)task);
  374. }
  375. __STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t event)
  376. {
  377. return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)event);
  378. }
  379. __STATIC_INLINE void nrf_comp_shorts_enable(uint32_t mask)
  380. {
  381. NRF_COMP->SHORTS |= mask;
  382. }
  383. __STATIC_INLINE void nrf_comp_shorts_disable(uint32_t mask)
  384. {
  385. NRF_COMP->SHORTS &= ~mask;
  386. }
  387. __STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t task)
  388. {
  389. *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + (uint32_t)task) ) = 1;
  390. }
  391. __STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t event)
  392. {
  393. *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + (uint32_t)event) ) = 0;
  394. #if __CORTEX_M == 0x04
  395. volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)event));
  396. (void)dummy;
  397. #endif
  398. }
  399. __STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t event)
  400. {
  401. return (bool) (*(volatile uint32_t *)( (uint8_t *)NRF_COMP + (uint32_t)event));
  402. }
  403. #endif // SUPPRESS_INLINE_IMPLEMENTATION
  404. /** @} */
  405. #ifdef __cplusplus
  406. }
  407. #endif
  408. #endif // NRF_COMP_H_