static uint32_t ulClbkCalls = 0;
void timerClbk(void* pvDriverHandle, void* pvUserHandle)
{
ulClbkCalls++;
DRV_DIO_ChannelOutToggle(DRV_DIO_ID_MMIO_6);
/** check user parameter */
if(*(uint32_t*)pvUserHandle != 1234)
Error_Handler();
}
uint32_t g_eventCnt=0;
uint32_t g_ulCapture=0;
uint32_t g_ulCapture2=0;
void getResult(void* pvDriverHandle, void* pvUserHandle)
{
DRV_DIO_ChannelOutToggle(DRV_DIO_ID_MMIO_7);
/* 1st option: direct access to the capture register */
gpio_app_Type* ptGpioPeripheral=(gpio_app_Type*)gpio_app_BASE; //0xFF801400
g_ulCapture=ptGpioPeripheral->gpio_app_tc[2];
/* 2nd option: using the driver function (timer handle required, which is not passed to the callback function) */
DRV_TIM_ChannelGetCapture(&g_tTimer1, DRV_DIO_ID_GPIO_2, &g_ulCapture2);
g_eventCnt++;
}
|