/**
 * \file
 * \brief Timer driver interface.
 * \author Erich Styger, erich.styger@hslu.ch
 * \license SPDX-License-Identifier: BSD-3-Clause
 * This module implements the driver for the timers used in the system.
 */

#ifndef TIMER_H_
#define TIMER_H_

#include <stdint.h>

#define TMR_TICK_MS  1
  /*!< we get called every TMR_TICK_MS ms */

/*! \brief Function called from timer interrupt every TMR_TICK_MS. */
void TMR_OnInterrupt(void);

/* Reflectance timer: */
void TMR_StartReflectanceTimer(void);
void TMR_StopReflectanceTimer(void);
void TMR_ResetReflectanceTimerCounter(void);
uint32_t TMR_GetReflectanceTimerCounter(void);
uint32_t TMR_GetRefelectanceTimerFrequencyHz(void);

/* Motor timer: */
void TMR_SetLeftMotorPWMDutyPercent(uint8_t percent);
void TMR_SetRightMotorPWMDutyPercent(uint8_t percent);
void TMR_SetLeftMotorPWMRatio(uint16_t val);
void TMR_SetRightMotorPWMRatio(uint16_t val);
void TMR_MotorPWMStart(void);
void TMR_MotorPWMStop(void);

/*! \brief Timer driver initialization */
void TMR_Init(void);

/*! \brief Timer driver de-initialization */
void TMR_Deinit(void);

#endif /* TIMER_H_ */
