1 /**************************************************************************//** 2 * @file ecap.h 3 * @version V1.00 4 * @brief Enhanced input capture timer (ECAP) driver header file 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 * @copyright (C) 2023 Nuvoton Technology Corp. All rights reserved. 8 *****************************************************************************/ 9 #ifndef __ECAP_H__ 10 #define __ECAP_H__ 11 12 #ifdef __cplusplus 13 extern "C" 14 { 15 #endif 16 17 18 /** @addtogroup Standard_Driver Standard Driver 19 @{ 20 */ 21 22 /** @addtogroup ECAP_Driver ECAP Driver 23 @{ 24 */ 25 26 /** @addtogroup ECAP_EXPORTED_CONSTANTS ECAP Exported Constants 27 @{ 28 */ 29 30 #define ECAP_IC0 (0UL) /*!< ECAP IC0 Unit \hideinitializer */ 31 #define ECAP_IC1 (1UL) /*!< ECAP IC1 Unit \hideinitializer */ 32 #define ECAP_IC2 (2UL) /*!< ECAP IC2 Unit \hideinitializer */ 33 34 /*---------------------------------------------------------------------------------------------------------*/ 35 /* ECAP CTL0 constant definitions */ 36 /*---------------------------------------------------------------------------------------------------------*/ 37 #define ECAP_NOISE_FILTER_CLKDIV_1 (0UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 1 \hideinitializer */ 38 #define ECAP_NOISE_FILTER_CLKDIV_2 (1UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 2 \hideinitializer */ 39 #define ECAP_NOISE_FILTER_CLKDIV_4 (2UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 4 \hideinitializer */ 40 #define ECAP_NOISE_FILTER_CLKDIV_16 (3UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 16 \hideinitializer */ 41 #define ECAP_NOISE_FILTER_CLKDIV_32 (4UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 32 \hideinitializer */ 42 #define ECAP_NOISE_FILTER_CLKDIV_64 (5UL<<ECAP_CTL0_NFCLKSEL_Pos) /*!< Noise filter clock divide by 64 \hideinitializer */ 43 44 #define ECAP_CAP_INPUT_SRC_FROM_IC (0UL) /*!< CAP input source from IC \hideinitializer */ 45 #define ECAP_CAP_INPUT_SRC_FROM_ACMP (1UL) /*!< CAP input source from ACMP \hideinitializer */ 46 #define ECAP_CAP_INPUT_SRC_FROM_CH (2UL) /*!< CAP input source from CH of EQEI \hideinitializer */ 47 48 #define ECAP_DISABLE_COMPARE (0UL<<ECAP_CTL0_CMPEN_Pos) /*!< Input capture compare and reload function disable \hideinitializer */ 49 #define ECAP_COMPARE_FUNCTION (1UL<<ECAP_CTL0_CMPEN_Pos) /*!< Input capture compare function \hideinitializer */ 50 51 /*---------------------------------------------------------------------------------------------------------*/ 52 /* ECAP CTL1 constant definitions */ 53 /*---------------------------------------------------------------------------------------------------------*/ 54 #define ECAP_RISING_EDGE (0UL<<ECAP_CTL1_EDGESEL0_Pos) /*!< ECAP capture rising edge selection \hideinitializer */ 55 #define ECAP_FALLING_EDGE (1UL<<ECAP_CTL1_EDGESEL0_Pos) /*!< ECAP capture falling edge selection \hideinitializer */ 56 #define ECAP_RISING_FALLING_EDGE (2UL<<ECAP_CTL1_EDGESEL0_Pos) /*!< ECAP capture either rising or falling edge selection \hideinitializer */ 57 58 #define ECAP_CAPTURE_TIMER_CLKDIV_1 (0UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 1 \hideinitializer */ 59 #define ECAP_CAPTURE_TIMER_CLKDIV_4 (1UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 4 \hideinitializer */ 60 #define ECAP_CAPTURE_TIMER_CLKDIV_16 (2UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 16 \hideinitializer */ 61 #define ECAP_CAPTURE_TIMER_CLKDIV_32 (3UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 32 \hideinitializer */ 62 #define ECAP_CAPTURE_TIMER_CLKDIV_64 (4UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 64 \hideinitializer */ 63 #define ECAP_CAPTURE_TIMER_CLKDIV_96 (5UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 96 \hideinitializer */ 64 #define ECAP_CAPTURE_TIMER_CLKDIV_112 (6UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 112 \hideinitializer */ 65 #define ECAP_CAPTURE_TIMER_CLKDIV_128 (7UL<<ECAP_CTL1_CLKSEL_Pos) /*!< ECAP capture timer clock divide by 128 \hideinitializer */ 66 67 #define ECAP_CAPTURE_TIMER_CLK_SRC_CAP_CLK (0UL<<ECAP_CTL1_CNTSRCSEL_Pos) /*!< ECAP capture timer/clock source from CAP_CLK \hideinitializer */ 68 #define ECAP_CAPTURE_TIMER_CLK_SRC_CAP0 (1UL<<ECAP_CTL1_CNTSRCSEL_Pos) /*!< ECAP capture timer/clock source from CAP0 \hideinitializer */ 69 #define ECAP_CAPTURE_TIMER_CLK_SRC_CAP1 (2UL<<ECAP_CTL1_CNTSRCSEL_Pos) /*!< ECAP capture timer/clock source from CAP1 \hideinitializer */ 70 #define ECAP_CAPTURE_TIMER_CLK_SRC_CAP2 (3UL<<ECAP_CTL1_CNTSRCSEL_Pos) /*!< ECAP capture timer/clock source from CAP2 \hideinitializer */ 71 72 /*@}*/ /* end of group ECAP_EXPORTED_CONSTANTS */ 73 74 /** @addtogroup ECAP_EXPORTED_FUNCTIONS ECAP Exported Functions 75 @{ 76 */ 77 78 /** 79 * @brief This macro is used to select noise filter clock pre-divide number 80 * @param[in] ecap Specify ECAP port 81 * @param[in] u32ClkSel The noise filter clock divide number 82 * - \ref ECAP_NOISE_FILTER_CLKDIV_1 83 * - \ref ECAP_NOISE_FILTER_CLKDIV_2 84 * - \ref ECAP_NOISE_FILTER_CLKDIV_4 85 * - \ref ECAP_NOISE_FILTER_CLKDIV_16 86 * - \ref ECAP_NOISE_FILTER_CLKDIV_32 87 * - \ref ECAP_NOISE_FILTER_CLKDIV_64 88 * @return None 89 * @details This macro will set the sampling frequency of the noise filter clock. 90 * \hideinitializer 91 */ 92 #define ECAP_SET_NOISE_FILTER_CLKDIV(ecap, u32ClkSel) ((ecap)->CTL0 = ((ecap)->CTL0 & ~ECAP_CTL0_NFCLKSEL_Msk)|(u32ClkSel)) 93 94 /** 95 * @brief This macro is used to disable noise filter 96 * @param[in] ecap Specify ECAP port 97 * @return None 98 * @details This macro will disable the noise filter of input capture. 99 * \hideinitializer 100 */ 101 #define ECAP_NOISE_FILTER_DISABLE(ecap) ((ecap)->CTL0 |= ECAP_CTL0_CAPNFDIS_Msk) 102 103 /** 104 * @brief This macro is used to enable noise filter 105 * @param[in] ecap Specify ECAP port 106 * @param[in] u32ClkSel Select noise filter clock divide number 107 * - \ref ECAP_NOISE_FILTER_CLKDIV_1 108 * - \ref ECAP_NOISE_FILTER_CLKDIV_2 109 * - \ref ECAP_NOISE_FILTER_CLKDIV_4 110 * - \ref ECAP_NOISE_FILTER_CLKDIV_16 111 * - \ref ECAP_NOISE_FILTER_CLKDIV_32 112 * - \ref ECAP_NOISE_FILTER_CLKDIV_64 113 * @return None 114 * @details This macro will enable the noise filter of input capture and set noise filter clock. 115 * \hideinitializer 116 */ 117 #define ECAP_NOISE_FILTER_ENABLE(ecap, u32ClkSel) ((ecap)->CTL0 = ((ecap)->CTL0 & ~(ECAP_CTL0_CAPNFDIS_Msk|ECAP_CTL0_NFCLKSEL_Msk))|(u32ClkSel)) 118 119 /** 120 * @brief This macro is used to enable input channel unit 121 * @param[in] ecap Specify ECAP port 122 * @param[in] u32Mask The input channel mask 123 * - \ref ECAP_CTL0_IC0EN_Msk 124 * - \ref ECAP_CTL0_IC1EN_Msk 125 * - \ref ECAP_CTL0_IC2EN_Msk 126 * @return None 127 * @details This macro will enable the input channel_n to input capture. 128 * \hideinitializer 129 */ 130 #define ECAP_ENABLE_INPUT_CHANNEL(ecap, u32Mask) ((ecap)->CTL0 |= (u32Mask)) 131 132 /** 133 * @brief This macro is used to disable input channel unit 134 * @param[in] ecap Specify ECAP port 135 * @param[in] u32Mask The input channel mask 136 * - \ref ECAP_CTL0_IC0EN_Msk 137 * - \ref ECAP_CTL0_IC1EN_Msk 138 * - \ref ECAP_CTL0_IC2EN_Msk 139 * @return None 140 * @details This macro will disable the input channel_n to input capture. 141 * \hideinitializer 142 */ 143 #define ECAP_DISABLE_INPUT_CHANNEL(ecap, u32Mask) ((ecap)->CTL0 &= ~(u32Mask)) 144 145 /** 146 * @brief This macro is used to select input channel source 147 * @param[in] ecap Specify ECAP port 148 * @param[in] u32Index The input channel number 149 * - \ref ECAP_IC0 150 * - \ref ECAP_IC1 151 * - \ref ECAP_IC2 152 * @param[in] u32Src The input source 153 * - \ref ECAP_CAP_INPUT_SRC_FROM_IC 154 * - \ref ECAP_CAP_INPUT_SRC_FROM_ACMP 155 * - \ref ECAP_CAP_INPUT_SRC_FROM_CH 156 * @return None 157 * @details This macro will select the input source from ICx, CHx. 158 * \hideinitializer 159 */ 160 #define ECAP_SEL_INPUT_SRC(ecap, u32Index, u32Src) ((ecap)->CTL0 = ((ecap)->CTL0 & ~(ECAP_CTL0_CAPSEL0_Msk<<((u32Index)<<1)))|(((u32Src)<<ECAP_CTL0_CAPSEL0_Pos)<<((u32Index)<<1))) 161 162 /** 163 * @brief This macro is used to enable input channel interrupt 164 * @param[in] ecap Specify ECAP port 165 * @param[in] u32Mask The input channel mask 166 * - \ref ECAP_CTL0_CAPIEN0_Msk 167 * - \ref ECAP_CTL0_CAPIEN1_Msk 168 * - \ref ECAP_CTL0_CAPIEN2_Msk 169 * @return None 170 * @details This macro will enable the input channel_n interrupt. 171 * \hideinitializer 172 */ 173 #define ECAP_ENABLE_INT(ecap, u32Mask) ((ecap)->CTL0 |= (u32Mask)) 174 175 /** 176 * @brief This macro is used to disable input channel interrupt 177 * @param[in] ecap Specify ECAP port 178 * @param[in] u32Mask The input channel mask 179 * - \ref ECAP_CTL0_CAPIEN0_Msk 180 * - \ref ECAP_CTL0_CAPIEN1_Msk 181 * - \ref ECAP_CTL0_CAPIEN2_Msk 182 * @return None 183 * @details This macro will disable the input channel_n interrupt. 184 * \hideinitializer 185 */ 186 #define ECAP_DISABLE_INT(ecap, u32Mask) ((ecap)->CTL0 &= ~(u32Mask)) 187 188 /** 189 * @brief This macro is used to enable input channel overflow interrupt 190 * @param[in] ecap Specify ECAP port 191 * @return None 192 * @details This macro will enable the input channel overflow interrupt. 193 * \hideinitializer 194 */ 195 #define ECAP_ENABLE_OVF_INT(ecap) ((ecap)->CTL0 |= ECAP_CTL0_OVIEN_Msk) 196 197 /** 198 * @brief This macro is used to disable input channel overflow interrupt 199 * @param[in] ecap Specify ECAP port 200 * @return None 201 * @details This macro will disable the input channel overflow interrupt. 202 * \hideinitializer 203 */ 204 #define ECAP_DISABLE_OVF_INT(ecap) ((ecap)->CTL0 &= ~ECAP_CTL0_OVIEN_Msk) 205 206 /** 207 * @brief This macro is used to enable input channel compare-match interrupt 208 * @param[in] ecap Specify ECAP port 209 * @return None 210 * @details This macro will enable the input channel compare-match interrupt. 211 * \hideinitializer 212 */ 213 #define ECAP_ENABLE_CMP_MATCH_INT(ecap) ((ecap)->CTL0 |= ECAP_CTL0_CMPIEN_Msk) 214 215 /** 216 * @brief This macro is used to disable input channel compare-match interrupt 217 * @param[in] ecap Specify ECAP port 218 * @return None 219 * @details This macro will disable the input channel compare-match interrupt. 220 * \hideinitializer 221 */ 222 #define ECAP_DISABLE_CMP_MATCH_INT(ecap) ((ecap)->CTL0 &= ~ECAP_CTL0_CMPIEN_Msk) 223 224 /** 225 * @brief This macro is used to start capture counter 226 * @param[in] ecap Specify ECAP port 227 * @return None 228 * @details This macro will start capture counter up-counting. 229 * \hideinitializer 230 */ 231 #define ECAP_CNT_START(ecap) ((ecap)->CTL0 |= ECAP_CTL0_CNTEN_Msk) 232 233 /** 234 * @brief This macro is used to stop capture counter 235 * @param[in] ecap Specify ECAP port 236 * @return None 237 * @details This macro will stop capture counter up-counting. 238 * \hideinitializer 239 */ 240 #define ECAP_CNT_STOP(ecap) ((ecap)->CTL0 &= ~ECAP_CTL0_CNTEN_Msk) 241 242 /** 243 * @brief This macro is used to set event to clear capture counter 244 * @param[in] ecap Specify ECAP port 245 * @param[in] u32Event The input channel number 246 * - \ref ECAP_CTL0_CMPCLREN_Msk 247 * - \ref ECAP_CTL1_CAP0CLREN_Msk 248 * - \ref ECAP_CTL1_CAP1CLREN_Msk 249 * - \ref ECAP_CTL1_CAP2CLREN_Msk 250 * - \ref ECAP_CTL1_CAP0RLDEN_Msk 251 * - \ref ECAP_CTL1_CAP1RLDEN_Msk 252 * - \ref ECAP_CTL1_CAP2RLDEN_Msk 253 * - \ref ECAP_CTL1_OVRLDEN_Msk 254 255 * @return None 256 * @details This macro will enable and select compare or capture event that can clear capture counter. 257 * \hideinitializer 258 */ 259 #define ECAP_SET_CNT_CLEAR_EVENT(ecap, u32Event) do{ \ 260 if((u32Event) & ECAP_CTL0_CMPCLREN_Msk) \ 261 (ecap)->CTL0 |= ECAP_CTL0_CMPCLREN_Msk; \ 262 else \ 263 (ecap)->CTL0 &= ~ECAP_CTL0_CMPCLREN_Msk; \ 264 (ecap)->CTL1 = ((ecap)->CTL1 &~0x00700F00) | ((u32Event) & 0x00700F00); \ 265 }while(0); 266 267 /** 268 * @brief This macro is used to enable compare function 269 * @param[in] ecap Specify ECAP port 270 * @return None 271 * @details This macro will enable the compare function. 272 * \hideinitializer 273 */ 274 #define ECAP_ENABLE_CMP(ecap) ((ecap)->CTL0 |= ECAP_CTL0_CMPEN_Msk) 275 276 /** 277 * @brief This macro is used to disable compare function 278 * @param[in] ecap Specify ECAP port 279 * @return None 280 * @details This macro will disable the compare function. 281 * \hideinitializer 282 */ 283 #define ECAP_DISABLE_CMP(ecap) ((ecap)->CTL0 &= ~ECAP_CTL0_CMPEN_Msk) 284 285 /** 286 * @brief This macro is used to enable input capture function. 287 * @param[in] ecap Specify ECAP port 288 * @return None 289 * @details This macro will enable input capture timer/counter. 290 * \hideinitializer 291 */ 292 #define ECAP_ENABLE_CNT(ecap) ((ecap)->CTL0 |= ECAP_CTL0_CAPEN_Msk) 293 294 /** 295 * @brief This macro is used to disable input capture function. 296 * @param[in] ecap Specify ECAP port 297 * @return None 298 * @details This macro will disable input capture timer/counter. 299 * \hideinitializer 300 */ 301 #define ECAP_DISABLE_CNT(ecap) ((ecap)->CTL0 &= ~ECAP_CTL0_CAPEN_Msk) 302 303 /** 304 * @brief This macro is used to select input channel edge detection 305 * @param[in] ecap Specify ECAP port 306 * @param[in] u32Index The input channel number 307 * - \ref ECAP_IC0 308 * - \ref ECAP_IC1 309 * - \ref ECAP_IC2 310 * @param[in] u32Edge The input source 311 * - \ref ECAP_RISING_EDGE 312 * - \ref ECAP_FALLING_EDGE 313 * - \ref ECAP_RISING_FALLING_EDGE 314 * @return None 315 * @details This macro will select input capture can detect falling edge, rising edge or either rising or falling edge change. 316 * \hideinitializer 317 */ 318 #define ECAP_SEL_CAPTURE_EDGE(ecap, u32Index, u32Edge) ((ecap)->CTL1 = ((ecap)->CTL1 & ~(ECAP_CTL1_EDGESEL0_Msk<<((u32Index)<<1)))|((u32Edge)<<((u32Index)<<1))) 319 320 /** 321 * @brief This macro is used to select ECAP counter reload trigger source 322 * @param[in] ecap Specify ECAP port 323 * @param[in] u32TrigSrc The input source 324 * - \ref ECAP_CTL1_CAP0RLDEN_Msk 325 * - \ref ECAP_CTL1_CAP1RLDEN_Msk 326 * - \ref ECAP_CTL1_CAP2RLDEN_Msk 327 * - \ref ECAP_CTL1_OVRLDEN_Msk 328 * @return None 329 * @details This macro will select capture counter reload trigger source. 330 * \hideinitializer 331 */ 332 #define ECAP_SEL_RELOAD_TRIG_SRC(ecap, u32TrigSrc) ((ecap)->CTL1 = ((ecap)->CTL1 & ~0xF00)|(u32TrigSrc)) 333 334 /** 335 * @brief This macro is used to select capture timer clock divide. 336 * @param[in] ecap Specify ECAP port 337 * @param[in] u32Clkdiv The input source 338 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_1 339 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_4 340 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_16 341 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_32 342 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_64 343 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_96 344 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_112 345 * - \ref ECAP_CAPTURE_TIMER_CLKDIV_128 346 * @return None 347 * @details This macro will select capture timer clock has a pre-divider with eight divided option. 348 * \hideinitializer 349 */ 350 #define ECAP_SEL_TIMER_CLK_DIV(ecap, u32Clkdiv) ((ecap)->CTL1 = ((ecap)->CTL1 & ~ECAP_CTL1_CLKSEL_Msk)|(u32Clkdiv)) 351 352 /** 353 * @brief This macro is used to select capture timer/counter clock source 354 * @param[in] ecap Specify ECAP port 355 * @param[in] u32ClkSrc The input source 356 * - \ref ECAP_CAPTURE_TIMER_CLK_SRC_CAP_CLK 357 * - \ref ECAP_CAPTURE_TIMER_CLK_SRC_CAP0 358 * - \ref ECAP_CAPTURE_TIMER_CLK_SRC_CAP1 359 * - \ref ECAP_CAPTURE_TIMER_CLK_SRC_CAP2 360 * @return None 361 * @details This macro will select capture timer/clock clock source. 362 * \hideinitializer 363 */ 364 #define ECAP_SEL_TIMER_CLK_SRC(ecap, u32ClkSrc) ((ecap)->CTL1 = ((ecap)->CTL1 & ~ECAP_CTL1_CNTSRCSEL_Msk)|(u32ClkSrc)) 365 366 /** 367 * @brief This macro is used to read input capture status 368 * @param[in] ecap Specify ECAP port 369 * @return Input capture status flags 370 * @details This macro will get the input capture interrupt status. 371 * \hideinitializer 372 */ 373 #define ECAP_GET_INT_STATUS(ecap) ((ecap)->STATUS) 374 375 /** 376 * @brief This macro is used to get input channel interrupt flag 377 * @param[in] ecap Specify ECAP port 378 * @param[in] u32Mask The input channel mask 379 * - \ref ECAP_STATUS_CAPTF0_Msk 380 * - \ref ECAP_STATUS_CAPTF1_Msk 381 * - \ref ECAP_STATUS_CAPTF2_Msk 382 * - \ref ECAP_STATUS_CAPOVF_Msk 383 * - \ref ECAP_STATUS_CAPCMPF_Msk 384 * @return None 385 * @details This macro will write 1 to get the input channel_n interrupt flag. 386 * \hideinitializer 387 */ 388 #define ECAP_GET_CAPTURE_FLAG(ecap, u32Mask) (((ecap)->STATUS & (u32Mask))?1:0) 389 390 /** 391 * @brief This macro is used to clear input channel interrupt flag 392 * @param[in] ecap Specify ECAP port 393 * @param[in] u32Mask The input channel mask 394 * - \ref ECAP_STATUS_CAPTF0_Msk 395 * - \ref ECAP_STATUS_CAPTF1_Msk 396 * - \ref ECAP_STATUS_CAPTF2_Msk 397 * - \ref ECAP_STATUS_CAPOVF_Msk 398 * - \ref ECAP_STATUS_CAPCMPF_Msk 399 * @return None 400 * @details This macro will write 1 to clear the input channel_n interrupt flag. 401 * \hideinitializer 402 */ 403 #define ECAP_CLR_CAPTURE_FLAG(ecap, u32Mask) ((ecap)->STATUS = (u32Mask)) 404 405 /** 406 * @brief This macro is used to set input capture counter value 407 * @param[in] ecap Specify ECAP port 408 * @param[in] u32Val Counter value 409 * @return None 410 * @details This macro will set a counter value of input capture. 411 * \hideinitializer 412 */ 413 #define ECAP_SET_CNT_VALUE(ecap, u32Val) ((ecap)->CNT = (u32Val)) 414 415 /** 416 * @brief This macro is used to get input capture counter value 417 * @param[in] ecap Specify ECAP port 418 * @return Capture counter value 419 * @details This macro will get a counter value of input capture. 420 * \hideinitializer 421 */ 422 #define ECAP_GET_CNT_VALUE(ecap) ((ecap)->CNT) 423 424 /** 425 * @brief This macro is used to get input capture counter hold value 426 * @param[in] ecap Specify ECAP port 427 * @param[in] u32Index The input channel number 428 * - \ref ECAP_IC0 429 * - \ref ECAP_IC1 430 * - \ref ECAP_IC2 431 * @return Capture counter hold value 432 * @details This macro will get a hold value of input capture channel_n. 433 * \hideinitializer 434 */ 435 #define ECAP_GET_CNT_HOLD_VALUE(ecap, u32Index) (*(__IO uint32_t *) (&((ecap)->HLD0) + (u32Index))) 436 437 /** 438 * @brief This macro is used to set input capture counter compare value 439 * @param[in] ecap Specify ECAP port 440 * @param[in] u32Val Input capture compare value 441 * @return None 442 * @details This macro will set a compare value of input capture counter. 443 * \hideinitializer 444 */ 445 #define ECAP_SET_CNT_CMP(ecap, u32Val) ((ecap)->CNTCMP = (u32Val)) 446 447 void ECAP_Open(ECAP_T* ecap, uint32_t u32FuncMask); 448 void ECAP_Close(ECAP_T* ecap); 449 void ECAP_EnableINT(ECAP_T* ecap, uint32_t u32Mask); 450 void ECAP_DisableINT(ECAP_T* ecap, uint32_t u32Mask); 451 /*@}*/ /* end of group ECAP_EXPORTED_FUNCTIONS */ 452 453 /*@}*/ /* end of group ECAP_Driver */ 454 455 /*@}*/ /* end of group Standard_Driver */ 456 457 #ifdef __cplusplus 458 } 459 #endif 460 461 #endif /* __ECAP_H__ */ 462 463 /*** (C) COPYRIGHT 2023 Nuvoton Technology Corp. ***/ 464