Skip to content

Instantly share code, notes, and snippets.

@SergNikitin
Created April 5, 2014 17:39
Show Gist options
  • Save SergNikitin/9995241 to your computer and use it in GitHub Desktop.
Save SergNikitin/9995241 to your computer and use it in GitHub Desktop.
static inline void setTimerSettingsToDefaultByNum(uint_fast8_t timerNum) {
// enable timer interrupt
CpuTimer0Regs.TCR.bit.TIE = 1;
// free run mode switch on
CpuTimer0Regs.TCR.bit.FREE = 1;
CpuTimer0Regs.TCR.bit.SOFT = 0;
// set preload value and timer prescaler
CpuTimer0Regs.PRD.all = 0xFFFF;
CpuTimer1Regs.TPR.bit.TDDR = 0xFF;
CpuTimer1Regs.TPRH.bit.TDDRH = 0xFF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment