|
|
|
@ -23,12 +23,13 @@ extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "hardwareDescription.h"
|
|
|
|
|
|
|
|
|
|
#include "pin.h"
|
|
|
|
|
|
|
|
|
|
/*! Emun of possible Timer Errors */
|
|
|
|
|
typedef enum {
|
|
|
|
|
functionNotSupported, /*!< This Funtion is not awailable on this **HARDWARE** */
|
|
|
|
|
prescalerOutOfRange /*!< Set prescaler value exeeds the Register's **HARDWARE** size */
|
|
|
|
|
prescalerOutOfRange, /*!< Set prescaler value exeeds the Register's **HARDWARE** size */
|
|
|
|
|
ccChannelNoOutOfRange /*!< The Selecter internal Capture/Compare timer cahnnel is not given by the **HARDWARE** size */
|
|
|
|
|
} timerError_t;
|
|
|
|
|
|
|
|
|
|
/*! Enum of possible counting modes */
|
|
|
|
@ -57,7 +58,7 @@ typedef enum {
|
|
|
|
|
inactive_force_low, /*!< Pin if forced **low** */
|
|
|
|
|
pwm_normal, /*!< Standart PWM mode */
|
|
|
|
|
pwm_inverted /*!< Inverted PWM mode */
|
|
|
|
|
};
|
|
|
|
|
} timerOutputCompareMode_t ;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Reset the timer to its default state
|
|
|
|
@ -131,14 +132,36 @@ void timerClearCounter(timerNo_t timer);
|
|
|
|
|
|
|
|
|
|
void timerInitCounter( timerNo_t timer,
|
|
|
|
|
uint32_t prescaler,
|
|
|
|
|
uint32_t period,
|
|
|
|
|
uint32_t autoReload,
|
|
|
|
|
timerCountDirection_t direction);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* This funtion is not implemented yet. Will be used to implment pwm functionality of the timer.
|
|
|
|
|
*/
|
|
|
|
|
void timerInitPwm( timerNo_t timer,
|
|
|
|
|
uint32_t prescaler,
|
|
|
|
|
uint32_t period,
|
|
|
|
|
timerCountDirection_t direction);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Sets the Timer to the desired compare mode The function timerInitCounter(); Should be
|
|
|
|
|
* called before to init the Timer.
|
|
|
|
|
* Calling this function will stop the timer and clear the counter.
|
|
|
|
|
*
|
|
|
|
|
* @param timer The desired timer number
|
|
|
|
|
* @param mode The desired output compare mode
|
|
|
|
|
* @param timerIoChannel The internal Timer Capture compare channel to be used.
|
|
|
|
|
* @param pinNo The desired Pin Number to be used as outpujt
|
|
|
|
|
* @param alternate The Alternate funtion No for the given Pin
|
|
|
|
|
* @param polarity Sets the <F2> the given Pin
|
|
|
|
|
*/
|
|
|
|
|
void timerInitOutputCompare( timerNo_t timer,
|
|
|
|
|
timerOutputCompareMode_t mode,
|
|
|
|
|
uint8_t timerIoChannel,
|
|
|
|
|
pinNo_t pinNo,
|
|
|
|
|
uint16_t alternate,
|
|
|
|
|
uint8_t polarity);
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Set the outoreload value of the timer
|
|
|
|
|
*
|
|
|
|
@ -157,9 +180,24 @@ void timerSetMs(timerNo_t timer, uint16_t ms);
|
|
|
|
|
void timerSetNs(timerNo_t timer, uint16_t ns);
|
|
|
|
|
void timerSetPs(timerNo_t timer, uint16_t ps);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Enables the timer
|
|
|
|
|
* @param timer The desired timer number
|
|
|
|
|
*/
|
|
|
|
|
void timerSart(timerNo_t timer);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Disables the timer
|
|
|
|
|
* @param timer The desired timer number
|
|
|
|
|
*/
|
|
|
|
|
void timerHalt(timerNo_t timer);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Halts the timer and then clears the counter.
|
|
|
|
|
* @param timer The desired timer number
|
|
|
|
|
*/
|
|
|
|
|
void timerStop(timerNo_t timer);
|
|
|
|
|
|
|
|
|
|
uint32_t timerGetCount(timerNo_t timer);
|
|
|
|
|
|
|
|
|
|
void timerThrowError(timerError_t error);
|
|
|
|
|