Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**************************************************************************//**
sahilmgandhi 18:6a4db94011d3 2 * @file timer.c
sahilmgandhi 18:6a4db94011d3 3 * @version V3.00
sahilmgandhi 18:6a4db94011d3 4 * $Revision: 6 $
sahilmgandhi 18:6a4db94011d3 5 * $Date: 15/08/11 10:26a $
sahilmgandhi 18:6a4db94011d3 6 * @brief M451 series Timer driver source file
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * @note
sahilmgandhi 18:6a4db94011d3 9 * Copyright (C) 2013~2015 Nuvoton Technology Corp. All rights reserved.
sahilmgandhi 18:6a4db94011d3 10 *****************************************************************************/
sahilmgandhi 18:6a4db94011d3 11 #include "M451Series.h"
sahilmgandhi 18:6a4db94011d3 12
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 TIMER_Driver TIMER Driver
sahilmgandhi 18:6a4db94011d3 19 @{
sahilmgandhi 18:6a4db94011d3 20 */
sahilmgandhi 18:6a4db94011d3 21
sahilmgandhi 18:6a4db94011d3 22 /** @addtogroup TIMER_EXPORTED_FUNCTIONS TIMER Exported Functions
sahilmgandhi 18:6a4db94011d3 23 @{
sahilmgandhi 18:6a4db94011d3 24 */
sahilmgandhi 18:6a4db94011d3 25
sahilmgandhi 18:6a4db94011d3 26 /**
sahilmgandhi 18:6a4db94011d3 27 * @brief Open Timer with Operate Mode and Frequency
sahilmgandhi 18:6a4db94011d3 28 *
sahilmgandhi 18:6a4db94011d3 29 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 30 * @param[in] u32Mode Operation mode. Possible options are
sahilmgandhi 18:6a4db94011d3 31 * - \ref TIMER_ONESHOT_MODE
sahilmgandhi 18:6a4db94011d3 32 * - \ref TIMER_PERIODIC_MODE
sahilmgandhi 18:6a4db94011d3 33 * - \ref TIMER_TOGGLE_MODE
sahilmgandhi 18:6a4db94011d3 34 * - \ref TIMER_CONTINUOUS_MODE
sahilmgandhi 18:6a4db94011d3 35 * @param[in] u32Freq Target working frequency
sahilmgandhi 18:6a4db94011d3 36 *
sahilmgandhi 18:6a4db94011d3 37 * @return Real timer working frequency
sahilmgandhi 18:6a4db94011d3 38 *
sahilmgandhi 18:6a4db94011d3 39 * @details This API is used to configure timer to operate in specified mode and frequency.
sahilmgandhi 18:6a4db94011d3 40 * If timer cannot work in target frequency, a closest frequency will be chose and returned.
sahilmgandhi 18:6a4db94011d3 41 * @note After calling this API, Timer is \b NOT running yet. But could start timer running be calling
sahilmgandhi 18:6a4db94011d3 42 * \ref TIMER_Start macro or program registers directly.
sahilmgandhi 18:6a4db94011d3 43 */
sahilmgandhi 18:6a4db94011d3 44 uint32_t TIMER_Open(TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq)
sahilmgandhi 18:6a4db94011d3 45 {
sahilmgandhi 18:6a4db94011d3 46 uint32_t u32Clk = TIMER_GetModuleClock(timer);
sahilmgandhi 18:6a4db94011d3 47 uint32_t u32Cmpr = 0, u32Prescale = 0;
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 // Fastest possible timer working freq is (u32Clk / 2). While cmpr = 2, pre-scale = 0.
sahilmgandhi 18:6a4db94011d3 50 if(u32Freq > (u32Clk / 2))
sahilmgandhi 18:6a4db94011d3 51 {
sahilmgandhi 18:6a4db94011d3 52 u32Cmpr = 2;
sahilmgandhi 18:6a4db94011d3 53 }
sahilmgandhi 18:6a4db94011d3 54 else
sahilmgandhi 18:6a4db94011d3 55 {
sahilmgandhi 18:6a4db94011d3 56 if(u32Clk > 64000000)
sahilmgandhi 18:6a4db94011d3 57 {
sahilmgandhi 18:6a4db94011d3 58 u32Prescale = 7; // real prescaler value is 8
sahilmgandhi 18:6a4db94011d3 59 u32Clk >>= 3;
sahilmgandhi 18:6a4db94011d3 60 }
sahilmgandhi 18:6a4db94011d3 61 else if(u32Clk > 32000000)
sahilmgandhi 18:6a4db94011d3 62 {
sahilmgandhi 18:6a4db94011d3 63 u32Prescale = 3; // real prescaler value is 4
sahilmgandhi 18:6a4db94011d3 64 u32Clk >>= 2;
sahilmgandhi 18:6a4db94011d3 65 }
sahilmgandhi 18:6a4db94011d3 66 else if(u32Clk > 16000000)
sahilmgandhi 18:6a4db94011d3 67 {
sahilmgandhi 18:6a4db94011d3 68 u32Prescale = 1; // real prescaler value is 2
sahilmgandhi 18:6a4db94011d3 69 u32Clk >>= 1;
sahilmgandhi 18:6a4db94011d3 70 }
sahilmgandhi 18:6a4db94011d3 71
sahilmgandhi 18:6a4db94011d3 72 u32Cmpr = u32Clk / u32Freq;
sahilmgandhi 18:6a4db94011d3 73 }
sahilmgandhi 18:6a4db94011d3 74
sahilmgandhi 18:6a4db94011d3 75 timer->CTL = u32Mode | u32Prescale;
sahilmgandhi 18:6a4db94011d3 76 timer->CMP = u32Cmpr;
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 return(u32Clk / (u32Cmpr * (u32Prescale + 1)));
sahilmgandhi 18:6a4db94011d3 79 }
sahilmgandhi 18:6a4db94011d3 80
sahilmgandhi 18:6a4db94011d3 81 /**
sahilmgandhi 18:6a4db94011d3 82 * @brief Stop Timer Counting
sahilmgandhi 18:6a4db94011d3 83 *
sahilmgandhi 18:6a4db94011d3 84 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 85 *
sahilmgandhi 18:6a4db94011d3 86 * @return None
sahilmgandhi 18:6a4db94011d3 87 *
sahilmgandhi 18:6a4db94011d3 88 * @details This API stops timer counting and disable all timer interrupt function.
sahilmgandhi 18:6a4db94011d3 89 */
sahilmgandhi 18:6a4db94011d3 90 void TIMER_Close(TIMER_T *timer)
sahilmgandhi 18:6a4db94011d3 91 {
sahilmgandhi 18:6a4db94011d3 92 timer->CTL = 0;
sahilmgandhi 18:6a4db94011d3 93 timer->EXTCTL = 0;
sahilmgandhi 18:6a4db94011d3 94 }
sahilmgandhi 18:6a4db94011d3 95
sahilmgandhi 18:6a4db94011d3 96 /**
sahilmgandhi 18:6a4db94011d3 97 * @brief Create a specify Delay Time
sahilmgandhi 18:6a4db94011d3 98 *
sahilmgandhi 18:6a4db94011d3 99 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 100 * @param[in] u32Usec Delay period in micro seconds. Valid values are between 100~1000000 (100 micro second ~ 1 second).
sahilmgandhi 18:6a4db94011d3 101 *
sahilmgandhi 18:6a4db94011d3 102 * @return None
sahilmgandhi 18:6a4db94011d3 103 *
sahilmgandhi 18:6a4db94011d3 104 * @details This API is used to create a delay loop for u32usec micro seconds by using timer one-shot mode.
sahilmgandhi 18:6a4db94011d3 105 * @note This API overwrites the register setting of the timer used to count the delay time.
sahilmgandhi 18:6a4db94011d3 106 * @note This API use polling mode. So there is no need to enable interrupt for the timer module used to generate delay.
sahilmgandhi 18:6a4db94011d3 107 */
sahilmgandhi 18:6a4db94011d3 108 void TIMER_Delay(TIMER_T *timer, uint32_t u32Usec)
sahilmgandhi 18:6a4db94011d3 109 {
sahilmgandhi 18:6a4db94011d3 110 uint32_t u32Clk = TIMER_GetModuleClock(timer);
sahilmgandhi 18:6a4db94011d3 111 uint32_t u32Prescale = 0, delay = (SystemCoreClock / u32Clk) + 1;
sahilmgandhi 18:6a4db94011d3 112 uint32_t u32Cmpr, u32NsecPerTick;
sahilmgandhi 18:6a4db94011d3 113
sahilmgandhi 18:6a4db94011d3 114 // Clear current timer configuration/
sahilmgandhi 18:6a4db94011d3 115 timer->CTL = 0;
sahilmgandhi 18:6a4db94011d3 116 timer->EXTCTL = 0;
sahilmgandhi 18:6a4db94011d3 117
sahilmgandhi 18:6a4db94011d3 118 if(u32Clk <= 1000000) // min delay is 1000 us if timer clock source is <= 1 MHz
sahilmgandhi 18:6a4db94011d3 119 {
sahilmgandhi 18:6a4db94011d3 120 if(u32Usec < 1000)
sahilmgandhi 18:6a4db94011d3 121 u32Usec = 1000;
sahilmgandhi 18:6a4db94011d3 122 if(u32Usec > 1000000)
sahilmgandhi 18:6a4db94011d3 123 u32Usec = 1000000;
sahilmgandhi 18:6a4db94011d3 124 }
sahilmgandhi 18:6a4db94011d3 125 else
sahilmgandhi 18:6a4db94011d3 126 {
sahilmgandhi 18:6a4db94011d3 127 if(u32Usec < 100)
sahilmgandhi 18:6a4db94011d3 128 u32Usec = 100;
sahilmgandhi 18:6a4db94011d3 129 if(u32Usec > 1000000)
sahilmgandhi 18:6a4db94011d3 130 u32Usec = 1000000;
sahilmgandhi 18:6a4db94011d3 131 }
sahilmgandhi 18:6a4db94011d3 132
sahilmgandhi 18:6a4db94011d3 133 if(u32Clk <= 1000000)
sahilmgandhi 18:6a4db94011d3 134 {
sahilmgandhi 18:6a4db94011d3 135 u32Prescale = 0;
sahilmgandhi 18:6a4db94011d3 136 u32NsecPerTick = 1000000000 / u32Clk;
sahilmgandhi 18:6a4db94011d3 137 u32Cmpr = (u32Usec * 1000) / u32NsecPerTick;
sahilmgandhi 18:6a4db94011d3 138 }
sahilmgandhi 18:6a4db94011d3 139 else
sahilmgandhi 18:6a4db94011d3 140 {
sahilmgandhi 18:6a4db94011d3 141 if(u32Clk > 64000000)
sahilmgandhi 18:6a4db94011d3 142 {
sahilmgandhi 18:6a4db94011d3 143 u32Prescale = 7; // real prescaler value is 8
sahilmgandhi 18:6a4db94011d3 144 u32Clk >>= 3;
sahilmgandhi 18:6a4db94011d3 145 }
sahilmgandhi 18:6a4db94011d3 146 else if(u32Clk > 32000000)
sahilmgandhi 18:6a4db94011d3 147 {
sahilmgandhi 18:6a4db94011d3 148 u32Prescale = 3; // real prescaler value is 4
sahilmgandhi 18:6a4db94011d3 149 u32Clk >>= 2;
sahilmgandhi 18:6a4db94011d3 150 }
sahilmgandhi 18:6a4db94011d3 151 else if(u32Clk > 16000000)
sahilmgandhi 18:6a4db94011d3 152 {
sahilmgandhi 18:6a4db94011d3 153 u32Prescale = 1; // real prescaler value is 2
sahilmgandhi 18:6a4db94011d3 154 u32Clk >>= 1;
sahilmgandhi 18:6a4db94011d3 155 }
sahilmgandhi 18:6a4db94011d3 156
sahilmgandhi 18:6a4db94011d3 157 if(u32Usec < 250)
sahilmgandhi 18:6a4db94011d3 158 {
sahilmgandhi 18:6a4db94011d3 159 u32Cmpr = (u32Usec * u32Clk) / 1000000;
sahilmgandhi 18:6a4db94011d3 160 }
sahilmgandhi 18:6a4db94011d3 161 else
sahilmgandhi 18:6a4db94011d3 162 {
sahilmgandhi 18:6a4db94011d3 163 u32NsecPerTick = 1000000000 / u32Clk;
sahilmgandhi 18:6a4db94011d3 164 u32Cmpr = (u32Usec * 1000) / u32NsecPerTick;
sahilmgandhi 18:6a4db94011d3 165 }
sahilmgandhi 18:6a4db94011d3 166 }
sahilmgandhi 18:6a4db94011d3 167
sahilmgandhi 18:6a4db94011d3 168 timer->CMP = u32Cmpr;
sahilmgandhi 18:6a4db94011d3 169 timer->CTL = TIMER_CTL_CNTEN_Msk | TIMER_ONESHOT_MODE | u32Prescale;
sahilmgandhi 18:6a4db94011d3 170
sahilmgandhi 18:6a4db94011d3 171 // When system clock is faster than timer clock, it is possible timer active bit cannot set in time while we check it.
sahilmgandhi 18:6a4db94011d3 172 // And the while loop below return immediately, so put a tiny delay here allowing timer start counting and raise active flag.
sahilmgandhi 18:6a4db94011d3 173 for(; delay > 0; delay--)
sahilmgandhi 18:6a4db94011d3 174 {
sahilmgandhi 18:6a4db94011d3 175 __NOP();
sahilmgandhi 18:6a4db94011d3 176 }
sahilmgandhi 18:6a4db94011d3 177
sahilmgandhi 18:6a4db94011d3 178 while(timer->CTL & TIMER_CTL_ACTSTS_Msk);
sahilmgandhi 18:6a4db94011d3 179 }
sahilmgandhi 18:6a4db94011d3 180
sahilmgandhi 18:6a4db94011d3 181 /**
sahilmgandhi 18:6a4db94011d3 182 * @brief Enable Timer Capture Function
sahilmgandhi 18:6a4db94011d3 183 *
sahilmgandhi 18:6a4db94011d3 184 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 185 * @param[in] u32CapMode Timer capture mode. Could be
sahilmgandhi 18:6a4db94011d3 186 * - \ref TIMER_CAPTURE_FREE_COUNTING_MODE
sahilmgandhi 18:6a4db94011d3 187 * - \ref TIMER_CAPTURE_COUNTER_RESET_MODE
sahilmgandhi 18:6a4db94011d3 188 * @param[in] u32Edge Timer capture trigger edge. Possible values are
sahilmgandhi 18:6a4db94011d3 189 * - \ref TIMER_CAPTURE_FALLING_EDGE
sahilmgandhi 18:6a4db94011d3 190 * - \ref TIMER_CAPTURE_RISING_EDGE
sahilmgandhi 18:6a4db94011d3 191 * - \ref TIMER_CAPTURE_FALLING_AND_RISING_EDGE
sahilmgandhi 18:6a4db94011d3 192 *
sahilmgandhi 18:6a4db94011d3 193 * @return None
sahilmgandhi 18:6a4db94011d3 194 *
sahilmgandhi 18:6a4db94011d3 195 * @details This API is used to enable timer capture function with specify capture trigger edge \n
sahilmgandhi 18:6a4db94011d3 196 * to get current counter value or reset counter value to 0.
sahilmgandhi 18:6a4db94011d3 197 * @note Timer frequency should be configured separately by using \ref TIMER_Open API, or program registers directly.
sahilmgandhi 18:6a4db94011d3 198 */
sahilmgandhi 18:6a4db94011d3 199 void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge)
sahilmgandhi 18:6a4db94011d3 200 {
sahilmgandhi 18:6a4db94011d3 201
sahilmgandhi 18:6a4db94011d3 202 timer->EXTCTL = (timer->EXTCTL & ~(TIMER_EXTCTL_CAPFUNCS_Msk | TIMER_EXTCTL_CAPEDGE_Msk)) |
sahilmgandhi 18:6a4db94011d3 203 u32CapMode | u32Edge | TIMER_EXTCTL_CAPEN_Msk;
sahilmgandhi 18:6a4db94011d3 204 }
sahilmgandhi 18:6a4db94011d3 205
sahilmgandhi 18:6a4db94011d3 206 /**
sahilmgandhi 18:6a4db94011d3 207 * @brief Disable Timer Capture Function
sahilmgandhi 18:6a4db94011d3 208 *
sahilmgandhi 18:6a4db94011d3 209 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 210 *
sahilmgandhi 18:6a4db94011d3 211 * @return None
sahilmgandhi 18:6a4db94011d3 212 *
sahilmgandhi 18:6a4db94011d3 213 * @details This API is used to disable the timer capture function.
sahilmgandhi 18:6a4db94011d3 214 */
sahilmgandhi 18:6a4db94011d3 215 void TIMER_DisableCapture(TIMER_T *timer)
sahilmgandhi 18:6a4db94011d3 216 {
sahilmgandhi 18:6a4db94011d3 217 timer->EXTCTL &= ~TIMER_EXTCTL_CAPEN_Msk;
sahilmgandhi 18:6a4db94011d3 218 }
sahilmgandhi 18:6a4db94011d3 219
sahilmgandhi 18:6a4db94011d3 220 /**
sahilmgandhi 18:6a4db94011d3 221 * @brief Enable Timer Counter Function
sahilmgandhi 18:6a4db94011d3 222 *
sahilmgandhi 18:6a4db94011d3 223 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 224 * @param[in] u32Edge Detection edge of counter pin. Could be ether
sahilmgandhi 18:6a4db94011d3 225 * - \ref TIMER_COUNTER_FALLING_EDGE, or
sahilmgandhi 18:6a4db94011d3 226 * - \ref TIMER_COUNTER_RISING_EDGE
sahilmgandhi 18:6a4db94011d3 227 *
sahilmgandhi 18:6a4db94011d3 228 * @return None
sahilmgandhi 18:6a4db94011d3 229 *
sahilmgandhi 18:6a4db94011d3 230 * @details This function is used to enable the timer counter function with specify detection edge.
sahilmgandhi 18:6a4db94011d3 231 * @note Timer compare value should be configured separately by using \ref TIMER_SET_CMP_VALUE macro or program registers directly.
sahilmgandhi 18:6a4db94011d3 232 * @note While using event counter function, \ref TIMER_TOGGLE_MODE cannot set as timer operation mode.
sahilmgandhi 18:6a4db94011d3 233 */
sahilmgandhi 18:6a4db94011d3 234 void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge)
sahilmgandhi 18:6a4db94011d3 235 {
sahilmgandhi 18:6a4db94011d3 236 timer->EXTCTL = (timer->EXTCTL & ~TIMER_EXTCTL_CNTPHASE_Msk) | u32Edge;
sahilmgandhi 18:6a4db94011d3 237 timer->CTL |= TIMER_CTL_EXTCNTEN_Msk;
sahilmgandhi 18:6a4db94011d3 238 }
sahilmgandhi 18:6a4db94011d3 239
sahilmgandhi 18:6a4db94011d3 240 /**
sahilmgandhi 18:6a4db94011d3 241 * @brief Disable Timer Counter Function
sahilmgandhi 18:6a4db94011d3 242 *
sahilmgandhi 18:6a4db94011d3 243 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 244 *
sahilmgandhi 18:6a4db94011d3 245 * @return None
sahilmgandhi 18:6a4db94011d3 246 *
sahilmgandhi 18:6a4db94011d3 247 * @details This API is used to disable the timer event counter function.
sahilmgandhi 18:6a4db94011d3 248 */
sahilmgandhi 18:6a4db94011d3 249 void TIMER_DisableEventCounter(TIMER_T *timer)
sahilmgandhi 18:6a4db94011d3 250 {
sahilmgandhi 18:6a4db94011d3 251 timer->CTL &= ~TIMER_CTL_EXTCNTEN_Msk;
sahilmgandhi 18:6a4db94011d3 252 }
sahilmgandhi 18:6a4db94011d3 253
sahilmgandhi 18:6a4db94011d3 254 /**
sahilmgandhi 18:6a4db94011d3 255 * @brief Get Timer Clock Frequency
sahilmgandhi 18:6a4db94011d3 256 *
sahilmgandhi 18:6a4db94011d3 257 * @param[in] timer The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
sahilmgandhi 18:6a4db94011d3 258 *
sahilmgandhi 18:6a4db94011d3 259 * @return Timer clock frequency
sahilmgandhi 18:6a4db94011d3 260 *
sahilmgandhi 18:6a4db94011d3 261 * @details This API is used to get the timer clock frequency.
sahilmgandhi 18:6a4db94011d3 262 * @note This API cannot return correct clock rate if timer source is from external clock input.
sahilmgandhi 18:6a4db94011d3 263 */
sahilmgandhi 18:6a4db94011d3 264 uint32_t TIMER_GetModuleClock(TIMER_T *timer)
sahilmgandhi 18:6a4db94011d3 265 {
sahilmgandhi 18:6a4db94011d3 266 uint32_t u32Src;
sahilmgandhi 18:6a4db94011d3 267 const uint32_t au32Clk[] = {__HXT, __LXT, 0, 0, 0, __LIRC, 0, __HIRC};
sahilmgandhi 18:6a4db94011d3 268
sahilmgandhi 18:6a4db94011d3 269 if(timer == TIMER0)
sahilmgandhi 18:6a4db94011d3 270 u32Src = (CLK->CLKSEL1 & CLK_CLKSEL1_TMR0SEL_Msk) >> CLK_CLKSEL1_TMR0SEL_Pos;
sahilmgandhi 18:6a4db94011d3 271 else if(timer == TIMER1)
sahilmgandhi 18:6a4db94011d3 272 u32Src = (CLK->CLKSEL1 & CLK_CLKSEL1_TMR1SEL_Msk) >> CLK_CLKSEL1_TMR1SEL_Pos;
sahilmgandhi 18:6a4db94011d3 273 else if(timer == TIMER2)
sahilmgandhi 18:6a4db94011d3 274 u32Src = (CLK->CLKSEL1 & CLK_CLKSEL1_TMR2SEL_Msk) >> CLK_CLKSEL1_TMR2SEL_Pos;
sahilmgandhi 18:6a4db94011d3 275 else // Timer 3
sahilmgandhi 18:6a4db94011d3 276 u32Src = (CLK->CLKSEL1 & CLK_CLKSEL1_TMR3SEL_Msk) >> CLK_CLKSEL1_TMR3SEL_Pos;
sahilmgandhi 18:6a4db94011d3 277
sahilmgandhi 18:6a4db94011d3 278 if(u32Src == 2)
sahilmgandhi 18:6a4db94011d3 279 {
sahilmgandhi 18:6a4db94011d3 280 return (SystemCoreClock);
sahilmgandhi 18:6a4db94011d3 281 }
sahilmgandhi 18:6a4db94011d3 282
sahilmgandhi 18:6a4db94011d3 283 return (au32Clk[u32Src]);
sahilmgandhi 18:6a4db94011d3 284 }
sahilmgandhi 18:6a4db94011d3 285
sahilmgandhi 18:6a4db94011d3 286 /*@}*/ /* end of group TIMER_EXPORTED_FUNCTIONS */
sahilmgandhi 18:6a4db94011d3 287
sahilmgandhi 18:6a4db94011d3 288 /*@}*/ /* end of group TIMER_Driver */
sahilmgandhi 18:6a4db94011d3 289
sahilmgandhi 18:6a4db94011d3 290 /*@}*/ /* end of group Standard_Driver */
sahilmgandhi 18:6a4db94011d3 291
sahilmgandhi 18:6a4db94011d3 292 /*** (C) COPYRIGHT 2013~2015 Nuvoton Technology Corp. ***/