| 
Variables | 
| static UINT16 | mg_u16Value = 0U | 
|  | UINT16 variable to store the latest current ADC value. 
 | 
| static UINT16 | mg_au16Data [SUM_COUNT] | 
|  | UINT16 variable to store the ADC values of motor current for accumulation. 
 | 
| static UINT16 | mg_au16AvgData [AVG_COUNT] | 
|  | UINT16 variable to store the ADC values of motor current for averaging. 
 | 
| static UINT16 | mg_u16Sum = 0U | 
|  | UINT16 variable to store the current sum. 
 | 
| static UINT8 | mg_u8SumIdx = 0U | 
|  | UINT8 index variable for array mg_au16Data. 
 | 
| static UINT8 | mg_u8AvgIdx = 0U | 
|  | UINT8 index variable for array mg_au16AvgData. 
 | 
| static S_MEM_STRUCTRUE | mg_sMemory | 
|  | Variable to keep application settings (wheel size, etc.) 
 | 
| static volatile UINT32 | mg_u32TickTime | 
|  | Variable to keep a timestamp of the last pedal interrupt. 
 | 
| static volatile UINT32 | mg_u32Rpm | 
|  | This variable holds the value of pedal revolutions per minute. 
 | 
| static UINT8 | mg_u8NumMagnetsPedal = DEFAULT_MAGNET_NUMBER_PEDAL | 
|  | UINT8 variable to keep the number of pedal reed switch magnets. 
 | 
| static E_SAFETY_CONDITION | mg_eCondition = COND_OK | 
|  | Variable to hold the current safety status. 
 | 
| static UINT16 | mg_u16MemIdx = 0U | 
|  | Index variable for flash memory testing. Equates a byte address. 
 | 
| static UINT32 | mg_u32CalcCRC = 0xFFFFFFFFUL | 
|  | Variable to hold the calculated memory CRC value. 
 | 
| static UINT32 | mg_u32ApplCRC = 0x00000000UL | 
|  | Variable to hold the stored memory CRC value. Will be set only once in the init function of this module. 
 | 
| static volatile UINT32 | mg_u32TickTime | 
|  | Variable to hold a timestamp of the last tacho interrupt. 
 | 
| static volatile UINT32 | mg_u32Rpm | 
|  | This variable holds the value of wheel revolutions per minute. 
 | 
| static volatile UINT32 | mg_u32Distance | 
|  | This variable holds the value of trip distance im mm. 
 | 
| static UINT16 | mg_u16WheelSize | 
|  | This variable holds a copy value of wheel circumference in mm. 
 | 
| static UINT8 | mg_u8NumMagnetsTacho = DEFAULT_MAGNET_NUMBER_TACHO | 
|  | UINT8 variable to keep the number of tacho reed switch magnets. 
 | 
| static UINT16 | mg_au16Data [AVG_COUNT] | 
|  | Variable to keep the last temperature measure values. 
 | 
| static UINT16 | mg_u16Value = 0U | 
|  | Variable to hold the average temperature value. 
 | 
| static UINT8 | mg_u8Idx = 0U | 
|  | Index variable for usae with array mg_au16Data. 
 | 
| static UINT8 | mg_u8WarningCnt = 0U | 
|  | Variable to count temperature exceedance. 
 | 
| static volatile UINT32 | mg_u32SystemTime = 0U | 
|  | Variable to hold the system time in ms. 
 | 
| static volatile UINT8 | mg_u8Ticks = NO_TICK | 
|  | Variable to keep time flags. 
 | 
| static UINT8 | mg_u8TicksOut = NO_TICK | 
|  | Variable used to share time flags with other modules. 
 | 
| static E_BOOL | mg_bIsPedelec = TRUE | 
|  | E_BOOL variable to hold pedelec mode. 
 | 
| static UINT16 | mg_u16SpeedLimitMax = SPEEDLIMIT_MAX | 
|  | UINT16 variable to keep maximum speed limit (for motor enabling) 
 | 
| static UINT16 | mg_u16SpeedLimitMin = SPEEDLIMIT_MIN | 
|  | UINT16 variable to keep minimum speed limit (for motor enabling) 
 | 
| static UINT16 | mg_u16FanTemp = VALUE_TEMP_FAN | 
|  | UINT16 variable to keep fan activation temperature. 
 | 
| static UINT8 | mg_u8NumMagnetsTacho = DEFAULT_MAGNET_NUMBER_TACHO | 
|  | UINT8 variable to keep the number of tacho reed switch magnets. 
 | 
| static UINT8 | mg_u8NumMagnetsPedal = DEFAULT_MAGNET_NUMBER_PEDAL | 
|  | UINT8 variable to keep the number of pedal reed switch magnets. 
 | 
| static UINT16 | mg_u16Ref = 0U | 
|  | UINT16 variable to store the ADC value of reference voltage. 
 | 
| static UINT16 | mg_u16Value = 0U | 
|  | UINT16 variable to store the ADC value of battery voltage. 
 | 
| static UINT16 | mg_au16Data [AVG_COUNT] | 
|  | UINT16 variable to store the ADC values of battery voltage for averaging. 
 | 
| static UINT16 | mg_u16Avg = 0U | 
|  | UINT16 variable to store averaged value of battery voltage. 
 | 
| static UINT8 | mg_u8Idx = 0U | 
|  | UINT8 variable to keep the ring array index position. 
 |