static void gpt_lld_serve_interrupt(GPTDriver *gptp) { gptp->counter++; if (gptp->counter == gptp->period) { gptp->counter = 0; if (gptp->state == GPT_ONESHOT) { gptp->state = GPT_READY; /* Back in GPT_READY state. */ gpt_lld_stop_timer(gptp); /* Timer automatically stopped. */ } gptp->callback(gptp); } }