Mouse code for the MacroRat
mbed-dev/targets/TARGET_NUVOTON/TARGET_M451/device/StdDriver/m451_tk.c@18:6a4db94011d3, 2017-05-14 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sun May 14 23:18:57 2017 +0000
- Revision:
- 18:6a4db94011d3
Publishing again
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /**************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file tk.c |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @version V1.00 |
sahilmgandhi | 18:6a4db94011d3 | 4 | * $Revision: 6 $ |
sahilmgandhi | 18:6a4db94011d3 | 5 | * $Date: 15/08/24 4:54p $ |
sahilmgandhi | 18:6a4db94011d3 | 6 | * @brief M451 series TK driver source file |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * @note |
sahilmgandhi | 18:6a4db94011d3 | 9 | * Copyright (C) 2014~2015 Nuvoton Technology Corp. All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 10 | * |
sahilmgandhi | 18:6a4db94011d3 | 11 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 12 | #include "M451Series.h" |
sahilmgandhi | 18:6a4db94011d3 | 13 | |
sahilmgandhi | 18:6a4db94011d3 | 14 | /** @addtogroup Standard_Driver Standard Driver |
sahilmgandhi | 18:6a4db94011d3 | 15 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 16 | */ |
sahilmgandhi | 18:6a4db94011d3 | 17 | |
sahilmgandhi | 18:6a4db94011d3 | 18 | /** @addtogroup TK_Driver TK Driver |
sahilmgandhi | 18:6a4db94011d3 | 19 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 20 | */ |
sahilmgandhi | 18:6a4db94011d3 | 21 | |
sahilmgandhi | 18:6a4db94011d3 | 22 | |
sahilmgandhi | 18:6a4db94011d3 | 23 | /** @addtogroup TK_EXPORTED_FUNCTIONS TK Exported Functions |
sahilmgandhi | 18:6a4db94011d3 | 24 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 25 | */ |
sahilmgandhi | 18:6a4db94011d3 | 26 | |
sahilmgandhi | 18:6a4db94011d3 | 27 | |
sahilmgandhi | 18:6a4db94011d3 | 28 | /** |
sahilmgandhi | 18:6a4db94011d3 | 29 | * @brief Enable touch key function |
sahilmgandhi | 18:6a4db94011d3 | 30 | * @param None |
sahilmgandhi | 18:6a4db94011d3 | 31 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 32 | * @note This function will enable touch key function and initial idle and polarity state as GND first for all scan keys |
sahilmgandhi | 18:6a4db94011d3 | 33 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 34 | */ |
sahilmgandhi | 18:6a4db94011d3 | 35 | |
sahilmgandhi | 18:6a4db94011d3 | 36 | void TK_Open(void) |
sahilmgandhi | 18:6a4db94011d3 | 37 | { |
sahilmgandhi | 18:6a4db94011d3 | 38 | TK->CTL |= TK_CTL_TKEN_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 39 | //set idle and polarity state as GND |
sahilmgandhi | 18:6a4db94011d3 | 40 | TK->IDLESEL = 0; |
sahilmgandhi | 18:6a4db94011d3 | 41 | TK->POLSEL = 0; |
sahilmgandhi | 18:6a4db94011d3 | 42 | TK->POLCTL &= ~(TK_POLCTL_IDLS16_Msk | TK_POLCTL_POLSEL16_Msk); |
sahilmgandhi | 18:6a4db94011d3 | 43 | } |
sahilmgandhi | 18:6a4db94011d3 | 44 | |
sahilmgandhi | 18:6a4db94011d3 | 45 | /** |
sahilmgandhi | 18:6a4db94011d3 | 46 | * @brief Disable touch key function |
sahilmgandhi | 18:6a4db94011d3 | 47 | * @param None |
sahilmgandhi | 18:6a4db94011d3 | 48 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 49 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 50 | */ |
sahilmgandhi | 18:6a4db94011d3 | 51 | void TK_Close(void) |
sahilmgandhi | 18:6a4db94011d3 | 52 | { |
sahilmgandhi | 18:6a4db94011d3 | 53 | TK->CTL &= ~TK_CTL_TKEN_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 54 | } |
sahilmgandhi | 18:6a4db94011d3 | 55 | |
sahilmgandhi | 18:6a4db94011d3 | 56 | /** |
sahilmgandhi | 18:6a4db94011d3 | 57 | * @brief Set touch key scan mode |
sahilmgandhi | 18:6a4db94011d3 | 58 | * @param[in] u32Mode Single ,periodic or all key scan mode |
sahilmgandhi | 18:6a4db94011d3 | 59 | * - \ref TK_SCAN_MODE_SINGLE |
sahilmgandhi | 18:6a4db94011d3 | 60 | * - \ref TK_SCAN_MODE_PERIODIC |
sahilmgandhi | 18:6a4db94011d3 | 61 | * - \ref TK_SCAN_MODE_ALL_KEY |
sahilmgandhi | 18:6a4db94011d3 | 62 | * - \ref TK_SCAN_MODE_PERIODIC_ALL_KEY |
sahilmgandhi | 18:6a4db94011d3 | 63 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 64 | * @details This function is used to set touch key scan mode. |
sahilmgandhi | 18:6a4db94011d3 | 65 | * @note If touch key controller sets as periodic mode, touch key will be trigger scan by Timer0. So Timer0 must be enabled and operated in periodic mode. |
sahilmgandhi | 18:6a4db94011d3 | 66 | * If touch key controller sets as single scan mode, touch key can be trigger scan by calling TK_START_SCAN(). |
sahilmgandhi | 18:6a4db94011d3 | 67 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 68 | */ |
sahilmgandhi | 18:6a4db94011d3 | 69 | void TK_SetScanMode(uint32_t u32Mode) |
sahilmgandhi | 18:6a4db94011d3 | 70 | { |
sahilmgandhi | 18:6a4db94011d3 | 71 | TK->CTL &= ~TK_CTL_TMRTRGEN_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 72 | TK->REFCTL &= ~TK_REFCTL_SCANALL_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 73 | if(u32Mode == TK_SCAN_MODE_PERIODIC) |
sahilmgandhi | 18:6a4db94011d3 | 74 | { |
sahilmgandhi | 18:6a4db94011d3 | 75 | TK->CTL |= u32Mode; |
sahilmgandhi | 18:6a4db94011d3 | 76 | } |
sahilmgandhi | 18:6a4db94011d3 | 77 | else if(u32Mode == TK_SCAN_MODE_ALL_KEY) |
sahilmgandhi | 18:6a4db94011d3 | 78 | { |
sahilmgandhi | 18:6a4db94011d3 | 79 | TK->REFCTL |= u32Mode; |
sahilmgandhi | 18:6a4db94011d3 | 80 | } |
sahilmgandhi | 18:6a4db94011d3 | 81 | else if(u32Mode == TK_SCAN_MODE_PERIODIC_ALL_KEY) |
sahilmgandhi | 18:6a4db94011d3 | 82 | { |
sahilmgandhi | 18:6a4db94011d3 | 83 | TK->CTL |= TK_CTL_TMRTRGEN_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 84 | TK->REFCTL |= TK_REFCTL_SCANALL_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 85 | } |
sahilmgandhi | 18:6a4db94011d3 | 86 | } |
sahilmgandhi | 18:6a4db94011d3 | 87 | |
sahilmgandhi | 18:6a4db94011d3 | 88 | /** |
sahilmgandhi | 18:6a4db94011d3 | 89 | * @brief Configure touch key scan sensitivity |
sahilmgandhi | 18:6a4db94011d3 | 90 | * @param[in] u32PulseWidth Sensing pulse width |
sahilmgandhi | 18:6a4db94011d3 | 91 | * - \ref TK_SENSE_PULSE_1 |
sahilmgandhi | 18:6a4db94011d3 | 92 | * - \ref TK_SENSE_PULSE_2 |
sahilmgandhi | 18:6a4db94011d3 | 93 | * - \ref TK_SENSE_PULSE_4 |
sahilmgandhi | 18:6a4db94011d3 | 94 | * - \ref TK_SENSE_PULSE_8 |
sahilmgandhi | 18:6a4db94011d3 | 95 | * @param[in] u32SenseCnt Sensing count |
sahilmgandhi | 18:6a4db94011d3 | 96 | * - \ref TK_SENSE_CNT_128 |
sahilmgandhi | 18:6a4db94011d3 | 97 | * - \ref TK_SENSE_CNT_255 |
sahilmgandhi | 18:6a4db94011d3 | 98 | * - \ref TK_SENSE_CNT_511 |
sahilmgandhi | 18:6a4db94011d3 | 99 | * - \ref TK_SENSE_CNT_1023 |
sahilmgandhi | 18:6a4db94011d3 | 100 | * @param[in] u32AVCCHSel voltage selection |
sahilmgandhi | 18:6a4db94011d3 | 101 | * - \ref TK_AVCCH_1_DIV_16 |
sahilmgandhi | 18:6a4db94011d3 | 102 | * - \ref TK_AVCCH_1_DIV_8 |
sahilmgandhi | 18:6a4db94011d3 | 103 | * - \ref TK_AVCCH_3_DIV_16 |
sahilmgandhi | 18:6a4db94011d3 | 104 | * - \ref TK_AVCCH_1_DIV_4 |
sahilmgandhi | 18:6a4db94011d3 | 105 | * - \ref TK_AVCCH_5_DIV_16 |
sahilmgandhi | 18:6a4db94011d3 | 106 | * - \ref TK_AVCCH_3_DIV_8 |
sahilmgandhi | 18:6a4db94011d3 | 107 | * - \ref TK_AVCCH_7_DIV_16 |
sahilmgandhi | 18:6a4db94011d3 | 108 | * - \ref TK_AVCCH_1_DIV_2 |
sahilmgandhi | 18:6a4db94011d3 | 109 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 110 | * @details This function is used to configure touch key scan sensitivity. |
sahilmgandhi | 18:6a4db94011d3 | 111 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 112 | */ |
sahilmgandhi | 18:6a4db94011d3 | 113 | void TK_ConfigSensitivity(uint32_t u32PulseWidth, uint32_t u32SenseCnt, uint32_t u32AVCCHSel) |
sahilmgandhi | 18:6a4db94011d3 | 114 | { |
sahilmgandhi | 18:6a4db94011d3 | 115 | TK->REFCTL = (TK->REFCTL & ~(TK_REFCTL_SENPTCTL_Msk | TK_REFCTL_SENTCTL_Msk)) | (u32PulseWidth | u32SenseCnt); |
sahilmgandhi | 18:6a4db94011d3 | 116 | TK->CTL = (TK->CTL & ~TK_CTL_AVCCHSEL_Msk) | u32AVCCHSel; |
sahilmgandhi | 18:6a4db94011d3 | 117 | } |
sahilmgandhi | 18:6a4db94011d3 | 118 | |
sahilmgandhi | 18:6a4db94011d3 | 119 | /** |
sahilmgandhi | 18:6a4db94011d3 | 120 | * @brief Set touch key capacitor bank polarity |
sahilmgandhi | 18:6a4db94011d3 | 121 | * @param[in] u32CapBankPolSel capacitor bank polarity selection |
sahilmgandhi | 18:6a4db94011d3 | 122 | * - \ref TK_CAP_BANK_POL_SEL_GND |
sahilmgandhi | 18:6a4db94011d3 | 123 | * - \ref TK_CAP_BANK_POL_SEL_AVCCH |
sahilmgandhi | 18:6a4db94011d3 | 124 | * - \ref TK_CAP_BANK_POL_SEL_VDD |
sahilmgandhi | 18:6a4db94011d3 | 125 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 126 | * @details This function is used to set touch key capacitor bank polarity. |
sahilmgandhi | 18:6a4db94011d3 | 127 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 128 | */ |
sahilmgandhi | 18:6a4db94011d3 | 129 | void TK_SetCapBankPol(uint32_t u32CapBankPolSel) |
sahilmgandhi | 18:6a4db94011d3 | 130 | { |
sahilmgandhi | 18:6a4db94011d3 | 131 | TK->POLCTL = (TK->POLCTL & ~TK_POLCTL_CBPOLSEL_Msk) | u32CapBankPolSel; |
sahilmgandhi | 18:6a4db94011d3 | 132 | } |
sahilmgandhi | 18:6a4db94011d3 | 133 | |
sahilmgandhi | 18:6a4db94011d3 | 134 | /** |
sahilmgandhi | 18:6a4db94011d3 | 135 | * @brief Configure touch key polarity |
sahilmgandhi | 18:6a4db94011d3 | 136 | * @param[in] u32Mask Combination of touch keys which need to be configured |
sahilmgandhi | 18:6a4db94011d3 | 137 | * @param[in] u32TKnPolSel touch key polarity selection |
sahilmgandhi | 18:6a4db94011d3 | 138 | * - \ref TK_TKn_POL_SEL_GND |
sahilmgandhi | 18:6a4db94011d3 | 139 | * - \ref TK_TKn_POL_SEL_AVCCH |
sahilmgandhi | 18:6a4db94011d3 | 140 | * - \ref TK_TKn_POL_SEL_VDD |
sahilmgandhi | 18:6a4db94011d3 | 141 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 142 | * @details This function is used to configure touch key polarity. |
sahilmgandhi | 18:6a4db94011d3 | 143 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 144 | */ |
sahilmgandhi | 18:6a4db94011d3 | 145 | void TK_SetTkPol(uint32_t u32Mask, uint32_t u32PolSel) |
sahilmgandhi | 18:6a4db94011d3 | 146 | { |
sahilmgandhi | 18:6a4db94011d3 | 147 | uint32_t i; |
sahilmgandhi | 18:6a4db94011d3 | 148 | |
sahilmgandhi | 18:6a4db94011d3 | 149 | if((1ul << 16) & u32Mask) |
sahilmgandhi | 18:6a4db94011d3 | 150 | TK->POLCTL = (TK->POLCTL & ~TK_POLCTL_POLSEL16_Msk) | (u32PolSel << TK_POLCTL_POLSEL16_Pos); |
sahilmgandhi | 18:6a4db94011d3 | 151 | |
sahilmgandhi | 18:6a4db94011d3 | 152 | for(i = 0 ; i < 16 ; i++) |
sahilmgandhi | 18:6a4db94011d3 | 153 | { |
sahilmgandhi | 18:6a4db94011d3 | 154 | if((1ul << i) & u32Mask) |
sahilmgandhi | 18:6a4db94011d3 | 155 | TK->POLSEL = (TK->POLSEL & ~(TK_POLSEL_POLSELn_Msk << (i*2))) | (u32PolSel << (i*2)); |
sahilmgandhi | 18:6a4db94011d3 | 156 | } |
sahilmgandhi | 18:6a4db94011d3 | 157 | } |
sahilmgandhi | 18:6a4db94011d3 | 158 | |
sahilmgandhi | 18:6a4db94011d3 | 159 | /** |
sahilmgandhi | 18:6a4db94011d3 | 160 | * @brief Enable the polarity of specified touch key(s) |
sahilmgandhi | 18:6a4db94011d3 | 161 | * @param[in] u32Mask Combination of enabled scan keys. Each bit corresponds to a touch key |
sahilmgandhi | 18:6a4db94011d3 | 162 | * Bit 0 represents touch key 0, bit 1 represents touch key 1... |
sahilmgandhi | 18:6a4db94011d3 | 163 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 164 | * @details This function is used to enable the polarity of specified touch key(s). |
sahilmgandhi | 18:6a4db94011d3 | 165 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 166 | */ |
sahilmgandhi | 18:6a4db94011d3 | 167 | void TK_EnableTkPolarity(uint32_t u32Mask) |
sahilmgandhi | 18:6a4db94011d3 | 168 | { |
sahilmgandhi | 18:6a4db94011d3 | 169 | TK->POLCTL |= (u32Mask << TK_POLCTL_POLEN0_Pos); |
sahilmgandhi | 18:6a4db94011d3 | 170 | } |
sahilmgandhi | 18:6a4db94011d3 | 171 | |
sahilmgandhi | 18:6a4db94011d3 | 172 | /** |
sahilmgandhi | 18:6a4db94011d3 | 173 | * @brief Disable the polarity of specified touch key(s) |
sahilmgandhi | 18:6a4db94011d3 | 174 | * @param[in] u32Mask Combination of enabled scan keys. Each bit corresponds to a touch key |
sahilmgandhi | 18:6a4db94011d3 | 175 | * Bit 0 represents touch key 0, bit 1 represents touch key 1... |
sahilmgandhi | 18:6a4db94011d3 | 176 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 177 | * @details This function is used to disable the polarity of specified touch key(s). |
sahilmgandhi | 18:6a4db94011d3 | 178 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 179 | */ |
sahilmgandhi | 18:6a4db94011d3 | 180 | void TK_DisableTkPolarity(uint32_t u32Mask) |
sahilmgandhi | 18:6a4db94011d3 | 181 | { |
sahilmgandhi | 18:6a4db94011d3 | 182 | TK->POLCTL &= ~(u32Mask << TK_POLCTL_POLEN0_Pos); |
sahilmgandhi | 18:6a4db94011d3 | 183 | } |
sahilmgandhi | 18:6a4db94011d3 | 184 | |
sahilmgandhi | 18:6a4db94011d3 | 185 | /** |
sahilmgandhi | 18:6a4db94011d3 | 186 | * @brief Set complement capacitor bank data of specified touch key |
sahilmgandhi | 18:6a4db94011d3 | 187 | * @param[in] u32TKNum Touch key number. The valid value is 0~16. |
sahilmgandhi | 18:6a4db94011d3 | 188 | * @param[in] u32CapData Complement capacitor bank data. The valid value is 0~0xFF. |
sahilmgandhi | 18:6a4db94011d3 | 189 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 190 | * @details This function is used to set complement capacitor bank data of specified touch key. |
sahilmgandhi | 18:6a4db94011d3 | 191 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 192 | */ |
sahilmgandhi | 18:6a4db94011d3 | 193 | void TK_SetCompCapBankData(uint32_t u32TKNum, uint32_t u32CapData) |
sahilmgandhi | 18:6a4db94011d3 | 194 | { |
sahilmgandhi | 18:6a4db94011d3 | 195 | *(__IO uint32_t *)(&(TK->CCBDAT0) + (u32TKNum >> 2)) &= ~(TK_CCBDAT0_CCBDAT0_Msk << (u32TKNum % 4 * 8)); |
sahilmgandhi | 18:6a4db94011d3 | 196 | *(__IO uint32_t *)(&(TK->CCBDAT0) + (u32TKNum >> 2)) |= (u32CapData << (u32TKNum % 4 * 8)); |
sahilmgandhi | 18:6a4db94011d3 | 197 | } |
sahilmgandhi | 18:6a4db94011d3 | 198 | |
sahilmgandhi | 18:6a4db94011d3 | 199 | /** |
sahilmgandhi | 18:6a4db94011d3 | 200 | * @brief Set complement capacitor bank data of reference touch key |
sahilmgandhi | 18:6a4db94011d3 | 201 | * @param[in] u32CapData Complement capacitor bank data. The valid value is 0~0xFF. |
sahilmgandhi | 18:6a4db94011d3 | 202 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 203 | * @details This function is used to set complement capacitor bank data of reference touch key. |
sahilmgandhi | 18:6a4db94011d3 | 204 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 205 | */ |
sahilmgandhi | 18:6a4db94011d3 | 206 | void TK_SetRefKeyCapBankData(uint32_t u32CapData) |
sahilmgandhi | 18:6a4db94011d3 | 207 | { |
sahilmgandhi | 18:6a4db94011d3 | 208 | TK->CCBDAT4 = (TK->CCBDAT4 & ~TK_CCBDAT4_REFCBDAT_Msk) | (u32CapData << TK_CCBDAT4_REFCBDAT_Pos); |
sahilmgandhi | 18:6a4db94011d3 | 209 | } |
sahilmgandhi | 18:6a4db94011d3 | 210 | |
sahilmgandhi | 18:6a4db94011d3 | 211 | /** |
sahilmgandhi | 18:6a4db94011d3 | 212 | * @brief Set high and low threshold of specified touch key for threshold control interrupt |
sahilmgandhi | 18:6a4db94011d3 | 213 | * @param[in] u32TKNum Touch key number. The valid value is 0~16. |
sahilmgandhi | 18:6a4db94011d3 | 214 | * @param[in] u32HighLevel High level for touch key threshold control. The valid value is 0~0xFF. |
sahilmgandhi | 18:6a4db94011d3 | 215 | * @param[in] u32LowLevel Low level for touch key threshold control. The valid value is 0~0xFF. |
sahilmgandhi | 18:6a4db94011d3 | 216 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 217 | * @details This function is used to set high and low threshold of specified touch key for threshold control interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 218 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 219 | */ |
sahilmgandhi | 18:6a4db94011d3 | 220 | void TK_SetScanThreshold(uint32_t u32TKNum, uint32_t u32HighLevel, uint32_t u32LowLevel) |
sahilmgandhi | 18:6a4db94011d3 | 221 | { |
sahilmgandhi | 18:6a4db94011d3 | 222 | *(__IO uint32_t *)(&(TK->TH0_1) + (u32TKNum >> 1)) &= ~((TK_TH0_1_HTH0_Msk | TK_TH0_1_LTH0_Msk) << (u32TKNum % 2 * 16)); |
sahilmgandhi | 18:6a4db94011d3 | 223 | *(__IO uint32_t *)(&(TK->TH0_1) + (u32TKNum >> 1)) |= ((u32HighLevel << TK_TH0_1_HTH0_Pos) | (u32LowLevel << TK_TH0_1_LTH0_Pos)) << (u32TKNum % 2 * 16); |
sahilmgandhi | 18:6a4db94011d3 | 224 | } |
sahilmgandhi | 18:6a4db94011d3 | 225 | |
sahilmgandhi | 18:6a4db94011d3 | 226 | /** |
sahilmgandhi | 18:6a4db94011d3 | 227 | * @brief Enable touch key scan interrupt |
sahilmgandhi | 18:6a4db94011d3 | 228 | * @param[in] u32Msk Interrupt type selection. |
sahilmgandhi | 18:6a4db94011d3 | 229 | * - \ref TK_INT_EN_SCAN_COMPLETE |
sahilmgandhi | 18:6a4db94011d3 | 230 | * - \ref TK_INT_EN_SCAN_COMPLETE_EDGE_TH |
sahilmgandhi | 18:6a4db94011d3 | 231 | * - \ref TK_INT_EN_SCAN_COMPLETE_LEVEL_TH |
sahilmgandhi | 18:6a4db94011d3 | 232 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 233 | * @details This function is used to enable touch key scan interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 234 | * @note It need disable the enabled interrupt type first by TK_DisableInt() before to change enabled interrupt type. |
sahilmgandhi | 18:6a4db94011d3 | 235 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 236 | */ |
sahilmgandhi | 18:6a4db94011d3 | 237 | void TK_EnableInt(uint32_t u32Msk) |
sahilmgandhi | 18:6a4db94011d3 | 238 | { |
sahilmgandhi | 18:6a4db94011d3 | 239 | TK->INTEN |= u32Msk; |
sahilmgandhi | 18:6a4db94011d3 | 240 | } |
sahilmgandhi | 18:6a4db94011d3 | 241 | |
sahilmgandhi | 18:6a4db94011d3 | 242 | /** |
sahilmgandhi | 18:6a4db94011d3 | 243 | * @brief Disable touch key scan interrupt |
sahilmgandhi | 18:6a4db94011d3 | 244 | * @param[in] u32Msk Interrupt type selection. |
sahilmgandhi | 18:6a4db94011d3 | 245 | * - \ref TK_INT_EN_SCAN_COMPLETE |
sahilmgandhi | 18:6a4db94011d3 | 246 | * - \ref TK_INT_EN_SCAN_COMPLETE_EDGE_TH |
sahilmgandhi | 18:6a4db94011d3 | 247 | * - \ref TK_INT_EN_SCAN_COMPLETE_LEVEL_TH |
sahilmgandhi | 18:6a4db94011d3 | 248 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 249 | * @details This function is used to disable touch key scan interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 250 | * @note It need disable the enabled interrupt type first by TK_DisableInt() before to change enabled interrupt type. |
sahilmgandhi | 18:6a4db94011d3 | 251 | * \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 252 | */ |
sahilmgandhi | 18:6a4db94011d3 | 253 | void TK_DisableInt(uint32_t u32Msk) |
sahilmgandhi | 18:6a4db94011d3 | 254 | { |
sahilmgandhi | 18:6a4db94011d3 | 255 | TK->INTEN &= ~u32Msk; |
sahilmgandhi | 18:6a4db94011d3 | 256 | } |
sahilmgandhi | 18:6a4db94011d3 | 257 | |
sahilmgandhi | 18:6a4db94011d3 | 258 | |
sahilmgandhi | 18:6a4db94011d3 | 259 | /*@}*/ /* end of group TK_EXPORTED_FUNCTIONS */ |
sahilmgandhi | 18:6a4db94011d3 | 260 | |
sahilmgandhi | 18:6a4db94011d3 | 261 | /*@}*/ /* end of group TK_Driver */ |
sahilmgandhi | 18:6a4db94011d3 | 262 | |
sahilmgandhi | 18:6a4db94011d3 | 263 | /*@}*/ /* end of group Standard_Driver */ |
sahilmgandhi | 18:6a4db94011d3 | 264 | |
sahilmgandhi | 18:6a4db94011d3 | 265 | /*** (C) COPYRIGHT 2014~2015 Nuvoton Technology Corp. ***/ |