You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.7 KiB
61 lines
1.7 KiB
/**
|
|
**************************************************************************************************
|
|
* @file timer.h
|
|
* @author Kerem Yollu & Edwin Koch
|
|
* @date 19.12.2021
|
|
* @version 1.0
|
|
**************************************************************************************************
|
|
* @brief This is the genral interface for timers.
|
|
*
|
|
* **Detailed Description :**
|
|
* This the timer interface and belongs to the interface layer
|
|
*
|
|
* @todo
|
|
* - 19.12.2021 : Should we check for a 32 to 16 bit overflow situation.
|
|
**************************************************************************************************
|
|
*/
|
|
|
|
#include "hardwareDescription.h"
|
|
|
|
typedef enum {
|
|
functionNotSupported,
|
|
prescalerOutOfRange
|
|
} timerError_t;
|
|
|
|
typedef enum {
|
|
upCounting,
|
|
downCounting,
|
|
centerAligned
|
|
} timerCountDirection_t;
|
|
|
|
typedef enum {
|
|
inputCapture,
|
|
outputCompare,
|
|
pwm,
|
|
onePulse
|
|
} timerMode_t;
|
|
|
|
void timerActivateBus(timerNo_t timer);
|
|
void timerEnableTimer(timerNo_t timer);
|
|
void timerSetClkSource(timerNo_t timer, clkSources_t clk);
|
|
void timerSetMode(timerNo_t timer, timerMode_t mode);
|
|
void timerSetCountDirection(timerNo_t timer, timerCountDirection_t direction);
|
|
void timerSetPrescaler(timerNo_t timer, uint32_t prescaler);
|
|
void timerSetPostscaler(timerNo_t timer, uint32_t postscaler);
|
|
void timerSetAutoReload(timerNo_t timer, uint32_t reload);
|
|
void timerClearCounter(timerNo_t timer);
|
|
|
|
|
|
/* Second stage configuration */
|
|
void timerSetHz(timerNo_t timer, uint16_t hz);
|
|
void timerSetMs(timerNo_t timer, uint16_t ms);
|
|
void timerSetNs(timerNo_t timer, uint16_t ns);
|
|
void timerSetPs(timerNo_t timer, uint16_t ps);
|
|
|
|
void timerSart(timerNo_t timer);
|
|
void timerStop(timerNo_t timer);
|
|
uint32_t timerGetCount(timerNo_t timer);
|
|
|
|
void timerThrowError(timerError_t error);
|
|
|