void voltage_Init ( void   )

This function reads the battery voltage and reference voltage to set up the according module variables.

See also:
mg_u16Ref
mg_u16Value
mg_u16Avg
Returns:
void

Definition at line 111 of file voltage.c.

References adc_Read(), ADC_VOLTAGE, ADC_VREF, AVG_COUNT, mg_au16Data, mg_u16Avg, mg_u16Ref, mg_u16Value, and mg_u8Idx.

Referenced by init_InitModules().

{
  UINT16 u16Help = adc_Read(ADC_VOLTAGE);
  
  mg_u16Ref   = (adc_Read(ADC_VREF)-695U) * 26/10;
  mg_u16Value = u16Help;
  
  for(UINT8 i=0U; i<AVG_COUNT; i++)
  {
    mg_au16Data[i] = u16Help;
  }
  mg_u16Avg = u16Help;
  mg_u8Idx = 0U;
}

Here is the call graph for this function:

Here is the caller graph for this function: