Defines | Functions | Variables

temp.c File Reference

Functions to meassure the motor temperature. More...

#include <avr/io.h>
#include "xtypes.h"
#include "global.h"
#include "adc.h"
#include "safety.h"
#include "temp.h"
Include dependency graph for temp.c:

Go to the source code of this file.

Defines

#define EXPORT
#define AVG_COUNT   10U
 Array size of mg_au16Data.
#define WARNING_COUNT   20U
 This value defines how many temperature warnings will be accepted before setting the temperature error flag.

Functions

void temp_Init (void)
 Init function for the temperature module.
void temp_Update (void)
 Function to read the current motor temperature.
void temp_Check (void)
 Function to check the motor temperature for overheating.
UINT16 temp_GetAvg (void)
 Get method for mg_u16Value.
UINT16 temp_GetCelsius (UINT16 adc_val)
 A helper method to convert ADC value to temperature.

Variables

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.

Detailed Description

Author:
Philipp Bank
Copyright:
Creative Commons by-nc-sa 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)

This module provides service-level functions to get the averaged motor temperature and to set a warning condition in case of overheating.

Definition in file temp.c.