Exemplo n.º 1
0
__interrupt void TIMERA0_ISR (void) {
   debugpins_isr_set();
   if (bsp_timer_isr()==KICK_SCHEDULER) {        // timer: 0
      __bic_SR_register_on_exit(CPUOFF);
   }
   debugpins_isr_clr();
}
Exemplo n.º 2
0
void timer_compare_isr_2(uint8_t reg){
	if (reg==TIMER_COMPARE_REG0){
		bsp_timer_isr();
	}else{
		//error!
		while(1);
	}
}
Exemplo n.º 3
0
static PyObject* OpenMote_bsp_timer_isr(OpenMote* self) {
   
   // no arguments
   
   // call the callback
   bsp_timer_isr(self);
   
   // return successfully
   Py_RETURN_NONE;
}
Exemplo n.º 4
0
/*******************************************************************************
* Function Name  : TIM2_IRQHandler
* Description    : This function handles TIM2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM2_IRQHandler(void)
{
  debugpins_isr_set();
  if(TIM_GetFlagStatus(TIM2,TIM_FLAG_CC1) != RESET)
  {
    TIM_ClearFlag(TIM2,TIM_FLAG_CC1);
    //leds_error_toggle();
    bsp_timer_isr();
  }
  debugpins_isr_clr();
}
Exemplo n.º 5
0
/**
\brief Schedule the callback to be called in some specified time.

The delay is expressed relative to the last compare event. It doesn't matter
how long it took to call this function after the last compare, the timer will
expire precisely delayTicks after the last one.

The only possible problem is that it took so long to call this function that
the delay specified is shorter than the time already elapsed since the last
compare. In that case, this function triggers the interrupt to fire right away.

This means that the interrupt may fire a bit off, but this inaccuracy does not
propagate to subsequent timers.

\param delayTicks Number of ticks before the timer expired, relative to the
                  last compare event.
*/
void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {
   PORT_TIMER_WIDTH newCompareValue;
   PORT_TIMER_WIDTH temp_last_compare_value;
   PORT_TIMER_WIDTH current_value;
   
   temp_last_compare_value = bsp_timer_vars.last_compare_value;
   
   newCompareValue      =  bsp_timer_vars.last_compare_value+delayTicks;
   bsp_timer_vars.last_compare_value   =  newCompareValue;
   
   current_value = bsp_timer_get_currentValue();
   if (current_value > temp_last_compare_value && delayTicks<current_value-temp_last_compare_value) {
      // we're already too late, schedule the ISR right now manually
      bsp_timer_isr();
   } else {
      // this is the normal case, have timer expire at newCompareValue
      SCOCR1HH  =  (uint8_t)(newCompareValue>>24);
	  SCOCR1HL  =  (uint8_t)(newCompareValue>>16);
	  SCOCR1LH  =  (uint8_t)(newCompareValue>>8);
	  SCOCR1LL  =  (uint8_t)(newCompareValue);
	  // enable interrupts
	  SCIRQM |= 0x01;
   }
}
Exemplo n.º 6
0
void bsp_timer_isr_private(void) {
	debugpins_isr_set();
	IntPendClear(INT_SMTIM);
	bsp_timer_isr();
	debugpins_isr_clr();
}