Speed sensor ISR and methods to get tacho information. More...
#include <avr/io.h>
#include <avr/interrupt.h>
#include "xtypes.h"
#include "global.h"
#include "timer.h"
#include "memory.h"
#include "speed.h"
Go to the source code of this file.
Defines | |
#define | EXPORT |
#define | MAX_RELIABLE_SPEED 70U |
This value defines the maximum reliable speed. Used to detect false tacho ticks. | |
#define | SPEED_INT_ENABLE() EIMSK |= (1<<INT0); |
This macro enables the tacho interrupt. | |
#define | SPEED_INT_DISABLE() EIMSK &= ~(1<<INT0); |
This macro disables the tacho interrupt. | |
Functions | |
ISR (SIG_INTERRUPT0) | |
Service routine for tacho sensor interrupt. | |
void | speed_Init (void) |
Init function for this module. | |
UINT32 | speed_GetRpm (void) |
Get method for mg_u32Rpm. | |
UINT32 | speed_GetDistance (void) |
Get method for mg_u32Distance. | |
void | speed_CheckTimeout (UINT32 u32SystemTime) |
Check and get method for tacho timeout. | |
Variables | |
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. |
This module contains an interrupt service routine for the tacho sensor signal and methods to calculate speed and trip distance.
Definition in file speed.c.