void temp_Update ( void   )

The current motor temperature will be read and used to recalculate the average temperature value.

Returns:
void

Definition at line 128 of file temp.c.

References adc_Read(), ADC_TEMPERATURE, AVG_COUNT, mg_au16Data, mg_u16Value, and mg_u8Idx.

Referenced by main().

{
  UINT16 u16Help = adc_Read(ADC_TEMPERATURE);
  
  mg_au16Data[mg_u8Idx] = u16Help;
  mg_u8Idx++;
  if(mg_u8Idx >= AVG_COUNT)
  {
    mg_u8Idx = 0U;
  }
  u16Help = 0U;
  for(UINT8 i=0U; i<AVG_COUNT; i++)
  {
    u16Help += mg_au16Data[i];
  }
  u16Help /= AVG_COUNT;
  mg_u16Value = u16Help;
}

Here is the call graph for this function:

Here is the caller graph for this function: