Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_timer.h File Reference
#include "bflb_core.h"
Include dependency graph for bflb_timer.h:

Go to the source code of this file.

Data Structures

struct  bflb_timer_config_s
 TIMER configuration structure. More...
 
struct  bflb_timer_capture_config_s
 TIMER capture configuration structure. More...
 

Macros

#define TIMER_CLKSRC_BCLK   0
 
#define TIMER_CLKSRC_32K   1
 
#define TIMER_CLKSRC_1K   2
 
#define TIMER_CLKSRC_XTAL   3
 
#define TIMER_CLKSRC_GPIO   4
 
#define TIMER_CLKSRC_NO   5
 
#define TIMER_COUNTER_MODE_PROLOAD   0
 
#define TIMER_COUNTER_MODE_UP   1
 
#define TIMER_COMP_ID_0   0
 
#define TIMER_COMP_ID_1   1
 
#define TIMER_COMP_ID_2   2
 
#define TIMER_COMP_NONE   3
 
#define TIMER_CAPTURE_POLARITY_POSITIVE   0
 
#define TIMER_CAPTURE_POLARITY_NEGATIVE   1
 

Functions

void bflb_timer_init (struct bflb_device_s *dev, const struct bflb_timer_config_s *config)
 Initialize timer. More...
 
void bflb_timer_deinit (struct bflb_device_s *dev)
 Deinitialize timer. More...
 
void bflb_timer_start (struct bflb_device_s *dev)
 Start timer. More...
 
void bflb_timer_stop (struct bflb_device_s *dev)
 Stop timer. More...
 
void bflb_timer_set_preloadvalue (struct bflb_device_s *dev, uint32_t val)
 Set timer preload value. More...
 
void bflb_timer_set_compvalue (struct bflb_device_s *dev, uint8_t cmp_no, uint32_t val)
 Set compare value of corresponding compare id. More...
 
uint32_t bflb_timer_get_compvalue (struct bflb_device_s *dev, uint8_t cmp_no)
 Get compare value of corresponding compare id. More...
 
uint32_t bflb_timer_get_countervalue (struct bflb_device_s *dev)
 Get timer counter value. More...
 
void bflb_timer_compint_mask (struct bflb_device_s *dev, uint8_t cmp_no, bool mask)
 Enable or disable timer interrupt of corresponding compare id. More...
 
bool bflb_timer_get_compint_status (struct bflb_device_s *dev, uint8_t cmp_no)
 Get timer interrupt status of corresponding compare id. More...
 
void bflb_timer_compint_clear (struct bflb_device_s *dev, uint8_t cmp_no)
 Clear timer interrupt status of corresponding compare id. More...
 
void bflb_timer_capture_init (struct bflb_device_s *dev, const struct bflb_timer_capture_config_s *config)
 
uint32_t bflb_timer_capture_get_pulsewidth (struct bflb_device_s *dev)