![]() |
MSPM0_ValvanoWare
1.0
ECE445L starter code
|
Hardware timers. More...
Files | |
| file | InputCapture.h |
| Software driver functions for input capture. | |
| file | Timer.h |
| Initialize Periodic interrupt timers. | |
Macros | |
| #define | INPUTCAPTUREUSELFCLK 2 |
| use INPUTCAPTUREUSELFCLK to select 32768 Hz LFCLK | |
| #define | INPUTCAPTUREUSEMFCLK 4 |
| use INPUTCAPTUREUSEMFCLK to select MFCLK (not tested) | |
| #define | INPUTCAPTUREUSEBUSCLK 8 |
| use INPUTCAPTUREUSEBUSCLK to select BUSCLK | |
Functions | |
| void | InputCapture_Init (uint32_t timerClkSrc, uint32_t timerClkPrescale, uint32_t priority) |
| Initialize input capture. More... | |
| void | InputCapture_InitDual (uint32_t timerClkSrc, uint32_t timerClkPrescale, uint32_t priority) |
| void | TimerG0_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer G0 interrupt. More... | |
| void | TimerG8_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer G8 interrupt. More... | |
| void | TimerA0_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer A0 interrupt. More... | |
| void | TimerA1_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer A1 interrupt. More... | |
| void | TimerG7_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer G7 interrupt. More... | |
| void | TimerG6_IntArm (uint16_t period, uint32_t prescale, uint32_t priority) |
| Initialize Timer G6 interrupt. More... | |
| void | TimerG12_IntArm (uint32_t period, uint32_t priority) |
| Initialize Timer G12 interrupt. More... | |
| void | TimerG12_Init (void) |
| Initialize Timer G12. More... | |
Hardware timers.
| Pin | Timer | Description |
|---|---|---|
| PA12 | TIMG0 | interrupts on rising edge of PA12 |
| void InputCapture_Init | ( | uint32_t | timerClkSrc, |
| uint32_t | timerClkPrescale, | ||
| uint32_t | priority | ||
| ) |
Initialize input capture.
Arm interrupts on rising edge of PA12
Let P be the period of the selected clock
resolution = P*(timerClkPrescale+1)
precision = 16 bits
range = 65535*resolution (max)
timerClkDivRatio = 1
timerClkFreq = (timerClkSrc / (timerClkDivRatio * (timerClkPrescale + 1)))
resolution = (timerClkDivRatio * (timerClkPrescale + 1)))/timerClkSrc
User defines their own ISR like the following
| timerClkSrc | could be LFCLK, MFCLK, or BUSCLK |
| timerClkPrescale | is prescale divide clock by timerClkPrescale+1, 0 to 255 |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerA0_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer A0 interrupt.
Arm 16-bit periodic interrupts on Timer A0. TimerA0 is on power Domain PD1
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerA1_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer A1 interrupt.
Arm 16-bit periodic interrupts on Timer A1. TimerA1 is on power Domain PD1
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerG0_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer G0 interrupt.
Arm 16-bit periodic interrupts on Timer G0. TimerG0 is on power Domain PD0
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerG12_Init | ( | void | ) |
Initialize Timer G12.
initialize G12 for continuous counting. No prescale
simply read TIMG12->COUNTERREGS.CTR for 32 bit time
TimerG12 is on power Domain PD1
| none |
| void TimerG12_IntArm | ( | uint32_t | period, |
| uint32_t | priority | ||
| ) |
Initialize Timer G12 interrupt.
Arm 32-bit periodic interrupts on Timer G12. No prescale TimerG12 is on power Domain PD1
frequency = TimerClock/period
| period | 32-bit sets the interrupt period |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerG6_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer G6 interrupt.
Arm 16-bit periodic interrupts on Timer G6. TimerG6 is on power Domain PD1
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerG7_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer G7 interrupt.
Arm 16-bit periodic interrupts on Timer G7. TimerG7 is on power Domain PD1
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |
| void TimerG8_IntArm | ( | uint16_t | period, |
| uint32_t | prescale, | ||
| uint32_t | priority | ||
| ) |
Initialize Timer G8 interrupt.
Arm 16-bit periodic interrupts on Timer G8. TimerG8 is on power Domain PD0
frequency = TimerClock/prescale/period
| period | sets the interrupt 16-bit period |
| prescale | sets the timer prescale |
| priority | is 0(highest),1,2 or 3(lowest) |