Skip to content

Instantly share code, notes, and snippets.

@patrickelectric
Created July 26, 2014 01:49
Show Gist options
  • Save patrickelectric/015fc641f5bed6a9d402 to your computer and use it in GitHub Desktop.
Save patrickelectric/015fc641f5bed6a9d402 to your computer and use it in GitHub Desktop.
void EXTI9_5_IRQHandler()
{
EXTI_ClearITPendingBit(EXTI_LINE); // clear interrupt
int pulse_width = TIM_GetCounter(TIM2) - PULSE_INTERVAL;
if(pulse_width > SYNC_WIDTH) //sync pulse
channel_index = 0;
else {
if(channel_index < NUM_OF_CHANNELS) {
channels[channel_index] = pulse_width;
channel_index++;
}
}
TIM_SetCounter(TIM2, 0);
/*
char str[64]={};
sprintf(str, "INT--------------------------------%d,%d,%d,%d\n\r",channels[0],channels[1],channels[2],channels[3] );
c_common_usart_puts(USART2, str);
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment