C:
while(1){
while(detect) // Interrupt on GPIO_D,PIN_3, RISE ONLY
{
delay_ms(10);
status();
detect = FALSE;
break;
}
if(start) //Interrupt on GPIO_D, PIN _4, RISE ONLY
{
start = FALSE;
// do stuff
}
}
interrupt handler - stm8s_it.c:
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
//
if((GPIOD->IDR & GPIO_PIN_4) !=0 ){
start = TRUE;
}
if((GPIOD->IDR & GPIO_PIN_3) != 0 ){
detect = TRUE;
}
}
Last edited: