drivers/periph/timer: add timer_set_periodic()
This commit is contained in:
parent
7c11ae9dcc
commit
cd107be976
@ -1050,6 +1050,10 @@ ifneq (,$(filter periph_gpio_irq,$(USEMODULE)))
|
|||||||
FEATURES_REQUIRED += periph_gpio
|
FEATURES_REQUIRED += periph_gpio
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter periph_timer_periodic,$(USEMODULE)))
|
||||||
|
FEATURES_REQUIRED += periph_timer
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter devfs_hwrng,$(USEMODULE)))
|
ifneq (,$(filter devfs_hwrng,$(USEMODULE)))
|
||||||
FEATURES_REQUIRED += periph_hwrng
|
FEATURES_REQUIRED += periph_hwrng
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
#define PERIPH_TIMER_H
|
#define PERIPH_TIMER_H
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
/** @todo remove dev_enums.h include once all platforms are ported to the updated periph interface */
|
/** @todo remove dev_enums.h include once all platforms are ported to the updated periph interface */
|
||||||
@ -69,6 +70,26 @@ extern "C" {
|
|||||||
typedef unsigned int tim_t;
|
typedef unsigned int tim_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset the timer when the set() function is called
|
||||||
|
*
|
||||||
|
* When set, calling the timer_set_periodic() function resets the timer count value.
|
||||||
|
*/
|
||||||
|
#ifndef TIM_FLAG_RESET_ON_SET
|
||||||
|
#define TIM_FLAG_RESET_ON_SET (0x01)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset the timer on match
|
||||||
|
*
|
||||||
|
* When set, a match on this channel will reset the timer count value.
|
||||||
|
* When set on multiple channels, only the channel with the lowest match value
|
||||||
|
* will be reached.
|
||||||
|
*/
|
||||||
|
#ifndef TIM_FLAG_RESET_ON_MATCH
|
||||||
|
#define TIM_FLAG_RESET_ON_MATCH (0x02)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Signature of event callback functions triggered from interrupts
|
* @brief Signature of event callback functions triggered from interrupts
|
||||||
*
|
*
|
||||||
@ -138,6 +159,21 @@ int timer_set(tim_t dev, int channel, unsigned int timeout);
|
|||||||
*/
|
*/
|
||||||
int timer_set_absolute(tim_t dev, int channel, unsigned int value);
|
int timer_set_absolute(tim_t dev, int channel, unsigned int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set an absolute timeout value for the given channel of the given timer
|
||||||
|
* The timeout will be called periodically for each iteration
|
||||||
|
*
|
||||||
|
* @param[in] dev the timer device to set
|
||||||
|
* @param[in] channel the channel to set
|
||||||
|
* @param[in] value the absolute compare value when the callback will be
|
||||||
|
* triggered
|
||||||
|
* @param[in] flags options
|
||||||
|
*
|
||||||
|
* @return 0 on success
|
||||||
|
* @return -1 on error
|
||||||
|
*/
|
||||||
|
int timer_set_periodic(tim_t dev, int channel, unsigned int value, uint8_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clear the given channel of the given timer device
|
* @brief Clear the given channel of the given timer device
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user