[update][lhal] update lhal and demos

This commit is contained in:
jzlv 2022-10-29 13:33:23 +08:00
parent 251da8c488
commit 703fb5d8c2
105 changed files with 3765 additions and 558 deletions

View file

@ -4,6 +4,19 @@
#include "bflb_core.h"
#include "bflb_clock.h"
/** @defgroup TIMER_CLK_SOURCE timer clock source definition
* @{
*/
#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
/**
* @}
*/
/** @defgroup TIMER_COUNTER_MODE timer counter mode definition
* @{
*/
@ -24,11 +37,20 @@
* @}
*/
/** @defgroup TIMER_CAPTURE_POLARITY timer capture polarity definition
* @{
*/
#define TIMER_CAPTURE_POLARITY_RISING 0
#define TIMER_CAPTURE_POLARITY_FALLING 1
/**
* @}
*/
/**
* @brief TIMER configuration structure
*
* @param counter_mode Timer counter mode, use @ref TIMER_COUNTER_MODE
* @param clock_source Timer clock source, use BFLB_SYSTEM_* definition
* @param clock_source Timer clock source, use @ref TIMER_CLK_SOURCE
* @param clock_div Timer clock divison value, from 0 to 255
* @param trigger_comp_id Timer count register preload trigger source slelect, use @ref TIMER_COMP_ID
* @param comp0_val Timer compare 0 value
@ -47,6 +69,17 @@ struct bflb_timer_config_s {
uint32_t preload_val;
};
/**
* @brief TIMER capture configuration structure
*
* @param pin Timer capture pin
* @param polarity Timer capture polarity, use @ref TIMER_CAPTURE_POLARITY
*/
struct bflb_timer_capture_config_s {
uint8_t pin;
uint8_t polarity;
};
#ifdef __cplusplus
extern "C" {
#endif
@ -63,8 +96,9 @@ void bflb_timer_compint_mask(struct bflb_device_s *dev, uint8_t cmp_no, bool mas
bool bflb_timer_get_compint_status(struct bflb_device_s *dev, uint8_t cmp_no);
void bflb_timer_compint_clear(struct bflb_device_s *dev, uint8_t cmp_no);
void bflb_timer_capture_init(struct bflb_device_s *dev, const struct bflb_timer_capture_config_s *config);
#ifdef __cplusplus
}
#endif
#endif