Last active
April 16, 2016 08:41
-
-
Save SaheblalBagwan/53d0477123d605ea6819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int getPrescalarForUs(uint8_t timerPclkBit) | |
{ | |
unsigned int pclk,prescalarForUs; | |
pclk = (LPC_SC->PCLKSEL0 >> timerPclkBit) & 0x03; /* get the pclk info for required timer */ | |
switch ( pclk ) /* Decode the bits to determine the pclk*/ | |
{ | |
case 0x00: | |
pclk = SystemCoreClock/4; | |
break; | |
case 0x01: | |
pclk = SystemCoreClock; | |
break; | |
case 0x02: | |
pclk = SystemCoreClock/2; | |
break; | |
case 0x03: | |
pclk = SystemCoreClock/8; | |
break; | |
} | |
prescalarForUs =pclk/1000000 - 1; /* Prescalar for 1us (1000000Counts/sec) */ | |
return prescalarForUs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment