ISR ( SIG_INTERRUPT1   )

Every time this function is called, a timestamp will be stored and compared with the last timestamp. The difference between now and the last timestamp is used to calculate the pedal revolutions per minute.

See also:
mg_u32TickTime
mg_u32Rpm
Returns:
void

Definition at line 99 of file pedal.c.

References LOCAL_STATIC, mg_u32Rpm, mg_u32TickTime, mg_u8NumMagnetsPedal, ONE_MINUTE_MS, PEDAL_INT_DISABLE, PEDAL_INT_ENABLE, and timer_GetSystemTime().

{
  LOCAL_STATIC  UINT32  u32CurrentTime;
                UINT32  u32DiffTime;
  
  PEDAL_INT_DISABLE();
  
  u32CurrentTime = timer_GetSystemTime();
  u32DiffTime = u32CurrentTime - mg_u32TickTime;
  if(0UL != u32DiffTime)
  {
    mg_u32TickTime = u32CurrentTime;
    mg_u32Rpm = ONE_MINUTE_MS / u32DiffTime / mg_u8NumMagnetsPedal;
  }
  
  PEDAL_INT_ENABLE();
}

Here is the call graph for this function: