I'm trying to get the Time of when a GPIO interrupt is signaled whenever I use Timer_getCount(); I get an incrementing count of the whole time the Program has ran. Is there a way to reset the time? I have tried closing the timer for each iteration of the loop but it seems that the Time saved on Timer_getCount(); stays. The Reference files have not said anything that I can find about resetting the overall timer count This is the Code I have so far:
Using LP-CC2652R7
void timerCallback(Timer_Handle myHandle, int_fast16_t status)
{
GPIO_disableInt(PORT5_RX16);
Display_printf(display, 0, 0, "Call Back Ended");
Ended = 2;
Timer_close(timer0);
}
void Rising(uint_least8_t index)
{
Time = Timer_getCount(timer0);
GPIO_disableInt(PORT5_RX16);
Timer_close(timer0);
GPIO_toggle(PORT5_TX17);
Ended = 1;
Display_printf(display, 0, 0, "Rising caught");
}
void *threadFxn0(void *arg0)
{
Display_printf(display, 0, 0, "The Program Has Started In Thread 0");
return (NULL);
}
void *threadFxn1(void *arg0)
{
START:
sleep(SampTime);
Ended = 0;
Display_printf(display, 0, 0, "Inside Rising Edge");
Timer_Params_init(¶ms);
params.period = 5000000;
params.periodUnits = Timer_PERIOD_US;
params.timerMode = Timer_ONESHOT_CALLBACK ;
params.timerCallback = timerCallback;
GPIO_setConfig(PORT5_TX17, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_LOW);
GPIO_setConfig(PORT5_RX16, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
timer0 = Timer_open(TIMER_0, ¶ms);
Timer_start(timer0);
Display_printf(display, 0, 0, "Inter Enabled");
GPIO_enableInt(PORT5_RX16);
GPIO_setCallback(PORT5_RX16, Rising);
Display_printf(display, 0, 0, "CallBakc has been set");
sleep(5);
Display_printf(display, 0, 0, "risingEdge ended in %d ", Ended);
Display_printf(display, 0, 0, "time Stopped %d", Time);
sleep(2);
goto START;
return (NULL);
}