Hey guys!
I'm trying synchronize both Timer functions - capture time and match set timeout that work both, but im only get timer event capture interrupt.. I'm checking it by TimerIntStatus get value..
What I want to do, is get interrupt then changes Pin status (get edge changed) and then timer time is timeout.. (this case 30 000 ticks) It is possible?
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
int Edge[400];
int Buffer_lenght = 0;
uint32_t z = 0;
void Timer2BIntHandler(void)
{
z = TimerIntStatus(TIMER2_BASE, 1);
TimerIntClear(TIMER2_BASE, z);
Edge[Buffer_lenght] = TimerValueGet(TIMER2_BASE, TIMER_B);
Buffer_lenght++;
}
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_INT);
SysCtlDeepSleepClockSet(SYSCTL_DSLP_PIOSC_PD);
SysCtlPeripheralClockGating(true);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_TIMER2);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB1_T2CCP1);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_1);
TimerConfigure(TIMER2_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_CAP_TIME_UP);
TimerControlEvent(TIMER2_BASE, TIMER_B, TIMER_EVENT_BOTH_EDGES);
TimerPrescaleSet(TIMER2_BASE, TIMER_B, 16);
TimerMatchSet(TIMER2_BASE, TIMER_B, 30000);
IntEnable(INT_TIMER2B);
TimerIntEnable(TIMER2_BASE, TIMER_CAPB_EVENT | TIMER_CAPB_MATCH);
IntMasterEnable();
TimerEnable(TIMER2_BASE, TIMER_B);
while(1)
{
SysCtlDeepSleep();
}
}