work on doku

interrupts
polymurph 3 years ago
parent b77aa12d5b
commit 0947787bf2

@ -60,28 +60,75 @@ typedef enum {
};
/*!
* Reset the timer to its default state.
* @brief Reset the timer to its default state
* @param timer The handle of the desired timer
*/
void timerReset(timerNo_t timer);
/*!
* @brief Activate the bus on which the desired timer is connected to
* @param timer The handle of the desired timer
*/
void timerActivateBus(timerNo_t timer);
/*!
* @brief Enable the timer
* @param timer The handle of the desired timer
*/
void timerEnable(timerNo_t timer);
/*!
* @brief Disable the timer
* @param timer The handle of the desired timer
*/
void timerDisable(timerNo_t timer);
void timerSetMode(timerNo_t timer, timerMode_t mode);
/*!
* @brief Set the operation mode of the timer
* @param timer The handle of the desired timer
* @param mode The desired operation mode
*/
void timerSetMode(timerNo_t timer, timerMode_t mode);
/*!
* @brief Set the timer conting direction
* @param timer The handle of the desired timer
* @param direction Counting direction
*/
void timerSetCountDirection(timerNo_t timer, timerCountDirection_t direction);
/*!
* Sets the given timer's prescaler value.
* @brief Sets the given timer's prescaler value.
*
* This fucntion will also check if the entered prascaler value exeeds the register size.
* If violated the prescalerOutOfRange Error will be generated.
*
* @param timer The handle of the desired timer
* @param prescaler The prescaler value for the timer
*/
void timerSetPrescaler(timerNo_t timer, uint32_t prescaler);
/*!
* @brief Set the postscaler of the timer
*
* This function will throw an error when the postscaler value exceeds the hardware register
* size.
*
* @param timer The handle of the desired timer
* @param postscaler The postscaler value
*/
void timerSetPostscaler(timerNo_t timer, uint32_t postscaler);
/*!
* @brief Set the outoreload value of the timer
* @param timer The handle of the desired timer
* @param reload The reload value
*/
void timerSetPrescaler(timerNo_t timer, uint32_t prescaler);
void timerSetPostscaler(timerNo_t timer, uint32_t postscaler);
void timerSetAutoReload(timerNo_t timer, uint32_t reload);
uint8_t timerGetUpdateInterrupt(timerNo_t timer);
void timerClearUpdateInterrupt(timerNo_t timer);
void timerClearCounter(timerNo_t timer);
/* Second stage configuration */
void timerInitCounter( timerNo_t timer,
uint32_t prescaler,
uint32_t period,
@ -92,6 +139,19 @@ void timerInitPwm( timerNo_t timer,
uint32_t period,
timerCountDirection_t direction);
/*!
* @brief Set the outoreload value of the timer
*
* The following calculation is performed.
*
* \f$ f_{timer} = \frac{ BusClock }{ (Prescaler - 1 ) \cdot ( Period - 1 )} \f$
*
* The values of \f$ Period \f$ (Reload Value) and \f$ Prescaler \f$ will be calculated to match
* or come close to the desired timer frequency \f$ f_{timer} \f$.
*
* @param timer The handle of the desired timer
* @param hz The desired frequency in Hz
*/
void timerSetHz(timerNo_t timer, uint16_t hz);
void timerSetMs(timerNo_t timer, uint16_t ms);
void timerSetNs(timerNo_t timer, uint16_t ns);

@ -69,6 +69,7 @@ void timerSetPostscaler(timerNo_t timer, uint32_t postscaler)
void timerSetAutoReload(timerNo_t timer, uint32_t reload)
{
// TODO: implement error wen reload value exceeds the hardware register size (e.g. value > 16bit)
BASE->ARR = reload;
}

Loading…
Cancel
Save