n32g45x_comp.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. /*****************************************************************************
  2. * Copyright (c) 2019, Nations Technologies Inc.
  3. *
  4. * All rights reserved.
  5. * ****************************************************************************
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * - Redistributions of source code must retain the above copyright notice,
  11. * this list of conditions and the disclaimer below.
  12. *
  13. * Nations' name may not be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. *
  16. * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  19. * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  22. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  25. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. * ****************************************************************************/
  27. /**
  28. * @file n32g45x_comp.h
  29. * @author Nations
  30. * @version v1.0.1
  31. *
  32. * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
  33. */
  34. #ifndef __N32G45X_COMP_H__
  35. #define __N32G45X_COMP_H__
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #include "n32g45x.h"
  40. #include <stdbool.h>
  41. /** @addtogroup N32G45X_StdPeriph_Driver
  42. * @{
  43. */
  44. /** @addtogroup COMP
  45. * @{
  46. */
  47. /** @addtogroup COMP_Exported_Constants
  48. * @{
  49. */
  50. typedef enum
  51. {
  52. COMP1 = 0,
  53. COMP2 = 1,
  54. COMP3 = 2,
  55. COMP4 = 3,
  56. COMP5 = 4,
  57. COMP6 = 5,
  58. COMP7 = 6
  59. } COMPX;
  60. // COMPx_CTRL
  61. #define COMP1_CTRL_INPDAC_MASK (0x01L << 18)
  62. #define COMP_CTRL_OUT_MASK (0x01L << 17)
  63. #define COMP_CTRL_BLKING_MASK (0x07L << 14)
  64. typedef enum
  65. {
  66. COMP_CTRL_BLKING_NO = (0x0L << 14),
  67. COMP_CTRL_BLKING_TIM1_OC5 = (0x1L << 14),
  68. COMP_CTRL_BLKING_TIM8_OC5 = (0x2L << 14),
  69. } COMP_CTRL_BLKING;
  70. #define COMPx_CTRL_HYST_MASK (0x03L << 12)
  71. typedef enum
  72. {
  73. COMP_CTRL_HYST_NO = (0x0L << 12),
  74. COMP_CTRL_HYST_LOW = (0x1L << 12),
  75. COMP_CTRL_HYST_MID = (0x2L << 12),
  76. COMP_CTRL_HYST_HIGH = (0x3L << 12),
  77. } COMP_CTRL_HYST;
  78. #define COMP_POL_MASK (0x01L << 11)
  79. #define COMP_CTRL_OUTSEL_MASK (0x0FL << 7)
  80. typedef enum
  81. {
  82. COMPX_CTRL_OUTSEL_NC = (0x0L << 7),
  83. // comp1 out trig
  84. COMP1_CTRL_OUTSEL_NC = (0x0L << 7),
  85. COMP1_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  86. COMP1_CTRL_OUTSEL_TIM1_IC1 = (0x2L << 7),
  87. COMP1_CTRL_OUTSEL_TIM1_OCrefclear = (0x3L << 7),
  88. COMP1_CTRL_OUTSEL_TIM2_IC1 = (0x4L << 7),
  89. COMP1_CTRL_OUTSEL_TIM2_OCrefclear = (0x5L << 7),
  90. COMP1_CTRL_OUTSEL_TIM3_IC1 = (0x6L << 7),
  91. COMP1_CTRL_OUTSEL_TIM3_OCrefclear = (0x7L << 7),
  92. COMP1_CTRL_OUTSEL_TIM4_IC1 = (0x8L << 7),
  93. COMP1_CTRL_OUTSEL_TIM4_OCrefclear = (0x9L << 7),
  94. COMP1_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  95. COMP1_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  96. // comp2 out trig
  97. COMP2_CTRL_OUTSEL_NC = (0x0L << 7),
  98. COMP2_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  99. COMP2_CTRL_OUTSEL_TIM1_IC1 = (0x2L << 7),
  100. COMP2_CTRL_OUTSEL_TIM1_OCrefclear = (0x3L << 7),
  101. COMP2_CTRL_OUTSEL_TIM2_IC2 = (0x4L << 7),
  102. COMP2_CTRL_OUTSEL_TIM2_OCrefclear = (0x5L << 7),
  103. COMP2_CTRL_OUTSEL_TIM3_IC2 = (0x6L << 7),
  104. COMP2_CTRL_OUTSEL_TIM3_OCrefclear = (0x7L << 7),
  105. COMP2_CTRL_OUTSEL_TIM5_IC1 = (0x8L << 7), ////(0x9L << 7)
  106. COMP2_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  107. COMP2_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  108. // comp3 out trig
  109. COMP3_CTRL_OUTSEL_NC = (0x0L << 7),
  110. COMP3_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  111. COMP3_CTRL_OUTSEL_TIM1_IC1 = (0x2L << 7),
  112. COMP3_CTRL_OUTSEL_TIM1_OCrefclear = (0x3L << 7),
  113. COMP3_CTRL_OUTSEL_TIM2_IC3 = (0x4L << 7),
  114. COMP3_CTRL_OUTSEL_TIM2_OCrefclear = (0x5L << 7),
  115. COMP3_CTRL_OUTSEL_TIM4_IC2 = (0x6L << 7),
  116. COMP3_CTRL_OUTSEL_TIM4_OCrefclear = (0x7L << 7),
  117. COMP3_CTRL_OUTSEL_TIM5_IC2 = (0x8L << 7), //(0x9L << 7)
  118. COMP3_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  119. COMP3_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  120. // comp4 out trig
  121. COMP4_CTRL_OUTSEL_NC = (0x0L << 7),
  122. COMP4_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  123. COMP4_CTRL_OUTSEL_TIM3_IC3 = (0x2L << 7),
  124. COMP4_CTRL_OUTSEL_TIM3_OCrefclear = (0x3L << 7),
  125. COMP4_CTRL_OUTSEL_TIM4_IC3 = (0x4L << 7),
  126. COMP4_CTRL_OUTSEL_TIM4_OCrefclear = (0x5L << 7),
  127. COMP4_CTRL_OUTSEL_TIM5_IC3 = (0x6L << 7), //(0x7L << 7)
  128. COMP4_CTRL_OUTSEL_TIM8_IC1 = (0x8L << 7),
  129. COMP4_CTRL_OUTSEL_TIM8_OCrefclear = (0x9L << 7),
  130. COMP4_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  131. COMP4_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  132. // comp5 out trig
  133. COMP5_CTRL_OUTSEL_NC = (0x0L << 7),
  134. COMP5_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  135. COMP5_CTRL_OUTSEL_TIM2_IC4 = (0x2L << 7),
  136. COMP5_CTRL_OUTSEL_TIM2_OCrefclear = (0x3L << 7),
  137. COMP5_CTRL_OUTSEL_TIM3_IC4 = (0x4L << 7),
  138. COMP5_CTRL_OUTSEL_TIM3_OCrefclear = (0x5L << 7),
  139. COMP5_CTRL_OUTSEL_TIM4_IC4 = (0x6L << 7),
  140. COMP5_CTRL_OUTSEL_TIM4_OCrefclear = (0x7L << 7),
  141. COMP5_CTRL_OUTSEL_TIM8_IC1 = (0x8L << 7),
  142. COMP5_CTRL_OUTSEL_TIM8_OCrefclear = (0x9L << 7),
  143. COMP5_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  144. COMP5_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  145. // comp6 out trig
  146. COMP6_CTRL_OUTSEL_NC = (0x0L << 7),
  147. COMP6_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  148. COMP6_CTRL_OUTSEL_TIM2_IC1 = (0x2L << 7),
  149. COMP6_CTRL_OUTSEL_TIM2_OCrefclear = (0x3L << 7),
  150. COMP6_CTRL_OUTSEL_TIM3_IC1 = (0x4L << 7),
  151. COMP6_CTRL_OUTSEL_TIM3_OCrefclear = (0x5L << 7),
  152. COMP6_CTRL_OUTSEL_TIM5_IC1 = (0x6L << 7), //(0x7L << 7)
  153. COMP6_CTRL_OUTSEL_TIM8_IC1 = (0x8L << 7),
  154. COMP6_CTRL_OUTSEL_TIM8_OCrefclear = (0x9L << 7),
  155. COMP6_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  156. COMP6_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  157. // comp7 out trig
  158. COMP7_CTRL_OUTSEL_NC = (0x0L << 7),
  159. COMP7_CTRL_OUTSEL_TIM1_BKIN = (0x1L << 7),
  160. COMP7_CTRL_OUTSEL_TIM2_IC1 = (0x2L << 7),
  161. COMP7_CTRL_OUTSEL_TIM2_OCrefclear = (0x3L << 7),
  162. COMP7_CTRL_OUTSEL_TIM3_IC1 = (0x4L << 7),
  163. COMP7_CTRL_OUTSEL_TIM3_OCrefclear = (0x5L << 7),
  164. COMP7_CTRL_OUTSEL_TIM5_IC1 = (0x6L << 7), //(0x7L << 7)
  165. COMP7_CTRL_OUTSEL_TIM8_IC1 = (0x8L << 7),
  166. COMP7_CTRL_OUTSEL_TIM8_OCrefclear = (0x9L << 7),
  167. COMP7_CTRL_OUTSEL_TIM8_BKIN = (0xAL << 7),
  168. COMP7_CTRL_OUTSEL_TIM1_BKIN_TIM8_BKIN = (0xBL << 7),
  169. } COMP_CTRL_OUTTRIG;
  170. #define COMP_CTRL_INPSEL_MASK (0x07L<<4)
  171. typedef enum {
  172. COMPX_CTRL_INPSEL_RES = (0x7L << 4),
  173. //comp1 inp sel
  174. COMP1_CTRL_INPSEL_PA1 = (0x0L << 4),
  175. COMP1_CTRL_INPSEL_PB10 = (0x1L << 4),
  176. //comp2 inp sel, need recheck maybe wrong
  177. COMP2_CTRL_INPSEL_PA1 = (0x0L << 4),
  178. COMP2_CTRL_INPSEL_PB11 = (0x1L << 4),
  179. COMP2_CTRL_INPSEL_PA7 = (0x2L << 4),
  180. //comp3 inp sel
  181. COMP3_CTRL_INPSEL_PB14 = (0x0L << 4),
  182. COMP3_CTRL_INPSEL_PB0 = (0x1L << 4),
  183. //comp4 inp sel, need recheck maybe wrong
  184. COMP4_CTRL_INPSEL_PB14 = (0x0L << 4),
  185. COMP4_CTRL_INPSEL_PB0 = (0x1L << 4),
  186. COMP4_CTRL_INPSEL_PC9 = (0x2L << 4),
  187. COMP4_CTRL_INPSEL_PB15 = (0x3L << 4),
  188. //comp5 inp sel
  189. COMP5_CTRL_INPSEL_PC4 = (0x0L << 4),
  190. COMP5_CTRL_INPSEL_PC3 = (0x1L << 4),
  191. COMP5_CTRL_INPSEL_PA3 = (0x2L << 4),
  192. //comp6 inp sel, need recheck maybe wrong
  193. COMP6_CTRL_INPSEL_PC4 = (0x0L << 4),
  194. COMP6_CTRL_INPSEL_PC3 = (0x1L << 4),
  195. COMP6_CTRL_INPSEL_PC5 = (0x2L << 4),
  196. COMP6_CTRL_INPSEL_PD9 = (0x3L << 4),
  197. //comp7 inp sel
  198. COMP7_CTRL_INPSEL_PC1 = (0x0L << 4),
  199. }COMP_CTRL_INPSEL;
  200. #define COMP_CTRL_INMSEL_MASK (0x07L<<1)
  201. typedef enum {
  202. COMPX_CTRL_INMSEL_RES = (0x7L << 1),
  203. //comp1 inm sel
  204. COMP1_CTRL_INMSEL_PA0 = (0x0L << 1),
  205. COMP1_CTRL_INMSEL_DAC1_PA4 = (0x1L << 1),
  206. COMP1_CTRL_INMSEL_DAC2_PA5 = (0x2L << 1),
  207. COMP1_CTRL_INMSEL_VREF1 = (0x3L << 1),
  208. COMP1_CTRL_INMSEL_VREF2 = (0x4L << 1),
  209. //comp2 inm sel
  210. COMP2_CTRL_INMSEL_PB1 = (0x0L << 1),
  211. COMP2_CTRL_INMSEL_PE8 = (0x1L << 1),
  212. COMP2_CTRL_INMSEL_DAC1_PA4 = (0x2L << 1),
  213. COMP2_CTRL_INMSEL_DAC2_PA5 = (0x3L << 1),
  214. COMP2_CTRL_INMSEL_VREF1 = (0x4L << 1),
  215. COMP2_CTRL_INMSEL_VREF2 = (0x5L << 1),
  216. //comp3 inm sel
  217. COMP3_CTRL_INMSEL_PB12 = (0x0L << 1),
  218. COMP3_CTRL_INMSEL_PE7 = (0x1L << 1),
  219. COMP3_CTRL_INMSEL_DAC1_PA4 = (0x2L << 1),
  220. COMP3_CTRL_INMSEL_DAC2_PA5 = (0x3L << 1),
  221. COMP3_CTRL_INMSEL_VREF1 = (0x4L << 1),
  222. COMP3_CTRL_INMSEL_VREF2 = (0x5L << 1),
  223. //comp4 inm sel
  224. COMP4_CTRL_INMSEL_PC4 = (0x0L << 1),
  225. COMP4_CTRL_INMSEL_PB13 = (0x1L << 1),
  226. COMP4_CTRL_INMSEL_DAC1_PA4 = (0x2L << 1),
  227. COMP4_CTRL_INMSEL_DAC2_PA5 = (0x3L << 1),
  228. COMP4_CTRL_INMSEL_VREF1 = (0x4L << 1),
  229. COMP4_CTRL_INMSEL_VREF2 = (0x5L << 1),
  230. //comp5 inm sel
  231. COMP5_CTRL_INMSEL_PB10 = (0x0L << 1),
  232. COMP5_CTRL_INMSEL_PD10 = (0x1L << 1),
  233. COMP5_CTRL_INMSEL_DAC1_PA4 = (0x2L << 1),
  234. COMP5_CTRL_INMSEL_DAC2_PA5 = (0x3L << 1),
  235. COMP5_CTRL_INMSEL_VREF1 = (0x4L << 1),
  236. COMP5_CTRL_INMSEL_VREF2 = (0x5L << 1),
  237. //comp6 inm sel
  238. COMP6_CTRL_INMSEL_PA7 = (0x0L << 1),
  239. COMP6_CTRL_INMSEL_PD8 = (0x1L << 1),
  240. COMP6_CTRL_INMSEL_DAC1_PA4 = (0x2L << 1),
  241. COMP6_CTRL_INMSEL_DAC2_PA5 = (0x3L << 1),
  242. COMP6_CTRL_INMSEL_VREF1 = (0x4L << 1),
  243. COMP6_CTRL_INMSEL_VREF2 = (0x5L << 1),
  244. //comp7 inm sel
  245. COMP7_CTRL_INMSEL_PC0 = (0x0L << 1),
  246. COMP7_CTRL_INMSEL_DAC1_PA4 = (0x1L << 1),
  247. COMP7_CTRL_INMSEL_DAC2_PA5 = (0x2L << 1),
  248. COMP7_CTRL_INMSEL_VREF1 = (0x3L << 1),
  249. COMP7_CTRL_INMSEL_VREF2 = (0x4L << 1),
  250. }COMP_CTRL_INMSEL;
  251. #define COMP_CTRL_EN_MASK (0x01L << 0)
  252. //COMPx_FILC
  253. #define COMP_FILC_SAMPW_MASK (0x1FL<<6)//Low filter sample window size. Number of samples to monitor is SAMPWIN+1.
  254. #define COMP_FILC_THRESH_MASK (0x1FL<<1)//For proper operation, the value of THRESH must be greater than SAMPWIN / 2.
  255. #define COMP_FILC_FILEN_MASK (0x01L<<0)//Filter enable.
  256. //COMPx_FILCLKCR
  257. #define COMP_FILCLKCR_CLKPSC_MASK (0xFFFFL<<0)//Low filter sample clock prescale. Number of system clocks between samples = CLK_PRE_CYCLE + 1, e.g.
  258. //COMP_WINMODE @addtogroup COMP_WINMODE_CMPMD
  259. #define COMP_WINMODE_CMPMD_MSK (0x07L <<0)
  260. #define COMP_WINMODE_CMP56MD (0x01L <<2)//1: Comparators 5 and 6 can be used in window mode.
  261. #define COMP_WINMODE_CMP34MD (0x01L <<1)//1: Comparators 3 and 4 can be used in window mode.
  262. #define COMP_WINMODE_CMP12MD (0x01L <<0)//1: Comparators 1 and 2 can be used in window mode.
  263. //COMPx_LOCK
  264. #define COMP_LOCK_CMPLK_MSK (0x7FL <<0)
  265. #define COMP_LOCK_CMP1LK_MSK (0x01L <<0)//1: COMx Lock bit
  266. #define COMP_LOCK_CMP2LK_MSK (0x01L <<1)//1: COMx Lock bit
  267. #define COMP_LOCK_CMP3LK_MSK (0x01L <<2)//1: COMx Lock bit
  268. #define COMP_LOCK_CMP4LK_MSK (0x01L <<3)//1: COMx Lock bit
  269. #define COMP_LOCK_CMP5LK_MSK (0x01L <<4)//1: COMx Lock bit
  270. #define COMP_LOCK_CMP6LK_MSK (0x01L <<5)//1: COMx Lock bit
  271. #define COMP_LOCK_CMP7LK_MSK (0x01L <<6)//1: COMx Lock bit
  272. // COMP_INTEN @addtogroup COMP_INTEN_CMPIEN
  273. #define COMP_INTEN_CMPIEN_MSK (0x7FL << 0)
  274. #define COMP_INTEN_CMP7IEN (0x01L << 6) // This bit control Interrput enable of COMP.
  275. #define COMP_INTEN_CMP6IEN (0x01L << 5)
  276. #define COMP_INTEN_CMP5IEN (0x01L << 4)
  277. #define COMP_INTEN_CMP4IEN (0x01L << 3)
  278. #define COMP_INTEN_CMP3IEN (0x01L << 2)
  279. #define COMP_INTEN_CMP2IEN (0x01L << 1)
  280. #define COMP_INTEN_CMP1IEN (0x01L << 0)
  281. // COMP_INTSTS @addtogroup COMP_INTSTS_CMPIS
  282. #define COMP_INTSTS_INTSTS_MSK (0x7FL << 0)
  283. #define COMP_INTSTS_CMP7IS (0x01L << 6) // This bit control Interrput enable of COMP.
  284. #define COMP_INTSTS_CMP6IS (0x01L << 5)
  285. #define COMP_INTSTS_CMP5IS (0x01L << 4)
  286. #define COMP_INTSTS_CMP4IS (0x01L << 3)
  287. #define COMP_INTSTS_CMP3IS (0x01L << 2)
  288. #define COMP_INTSTS_CMP2IS (0x01L << 1)
  289. #define COMP_INTSTS_CMP1IS (0x01L << 0)
  290. // COMP_VREFSCL @addtogroup COMP_VREFSCL
  291. #define COMP_VREFSCL_VV2TRM_MSK (0x3FL << 8) // Vref2 Voltage scaler triming value.
  292. #define COMP_VREFSCL_VV2EN_MSK (0x01L << 7)
  293. #define COMP_VREFSCL_VV1TRM_MSK (0x3FL << 1) // Vref1 Voltage scaler triming value.
  294. #define COMP_VREFSCL_VV1EN_MSK (0x01L << 0)
  295. /**
  296. * @}
  297. */
  298. /**
  299. * @brief COMP Init structure definition
  300. */
  301. typedef struct
  302. {
  303. // ctrl
  304. bool InpDacConnect; // only COMP1 have this bit
  305. COMP_CTRL_BLKING Blking; /*see @ref COMP_CTRL_BLKING */
  306. COMP_CTRL_HYST Hyst;
  307. bool PolRev; // out polarity reverse
  308. COMP_CTRL_OUTTRIG OutSel;
  309. COMP_CTRL_INPSEL InpSel;
  310. COMP_CTRL_INMSEL InmSel;
  311. bool En;
  312. // filter
  313. uint8_t SampWindow; // 5bit
  314. uint8_t Thresh; // 5bit ,need > SampWindow/2
  315. bool FilterEn;
  316. // filter psc
  317. uint16_t ClkPsc;
  318. } COMP_InitType;
  319. /** @addtogroup COMP_Exported_Functions
  320. * @{
  321. */
  322. void COMP_DeInit(void);
  323. void COMP_StructInit(COMP_InitType* COMP_InitStruct);
  324. void COMP_Init(COMPX COMPx, COMP_InitType* COMP_InitStruct);
  325. void COMP_Enable(COMPX COMPx, FunctionalState en);
  326. void COMP_SetInpSel(COMPX COMPx, COMP_CTRL_INPSEL VpSel);
  327. void COMP_SetInmSel(COMPX COMPx, COMP_CTRL_INMSEL VmSel);
  328. void COMP_SetOutTrig(COMPX COMPx, COMP_CTRL_OUTTRIG OutTrig);
  329. void COMP_SetLock(uint32_t Lock); // see @COMP_LOCK_CMPLK
  330. void COMP_SetIntEn(uint32_t IntEn); // see @COMP_INTEN_CMPIEN
  331. uint32_t COMP_GetIntSts(void); // return see @COMP_INTSTS_CMPIS
  332. void COMP_SetRefScl(uint8_t Vv2Trim, bool Vv2En, uint8_t Vv1Trim, bool Vv1En); // parma range see @COMP_VREFSCL
  333. FlagStatus COMP_GetOutStatus(COMPX COMPx);
  334. FlagStatus COMP_GetIntStsOneComp(COMPX COMPx);
  335. void COMP_SetFilterPrescaler(COMPX COMPx , uint16_t FilPreVal);
  336. void COMP_SetFilterControl(COMPX COMPx , uint8_t FilEn, uint8_t TheresNum , uint8_t SampPW);
  337. void COMP_SetHyst(COMPX COMPx , COMP_CTRL_HYST HYST);
  338. void COMP_SetBlanking(COMPX COMPx , COMP_CTRL_BLKING BLK);
  339. /**
  340. * @}
  341. */
  342. #ifdef __cplusplus
  343. }
  344. #endif
  345. #endif /*__N32G45X_ADC_H */
  346. /**
  347. * @}
  348. */
  349. /**
  350. * @}
  351. */