I am trying to get a wide timer to count up and trigger an interrupt when the desired value is met. Is TimerMatchSet() the function to use to set the value?
My ISR is not being triggered.
Here is what I have tried:
void
Timer1IntHandler(void)
{
static bool toggle = 1;
MAP_TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
if (toggle)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
}
toggle = !toggle;
TimerEnable(TIMER0_BASE, TIMER_A);
}
int
main(void)
{
volatile uint64_t vg = 0;
volatile uint64_t vg1 = 1000000LLU;
MAP_FPULazyStackingEnable();
MAP_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
//LED setup
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF));
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER1);
MAP_TimerConfigure(WTIMER1_BASE, TIMER_CFG_ONE_SHOT_UP);
//TimerLoadSet(TIMER1_BASE, TIMER_A, 0);
TimerIntRegister(WTIMER1_BASE, TIMER_A, Timer1IntHandler);
IntMasterEnable();
TimerIntEnable(WTIMER1_BASE, TIMER_TIMA_TIMEOUT);
IntEnable(INT_WTIMER1A);
TimerMatchSet64(WTIMER1_BASE, 80000);
TimerEnable(WTIMER1_BASE, TIMER_A);
while(1)
{
vg = TimerValueGet(WTIMER1_BASE, TIMER_A);
SysCtlDelay(100000);
}
}