TIMER API 参考
TIMER
-
struct wm_drv_timer_cfg_t
TIMER configuration.
Public Members
-
wm_drv_timer_unit unit
timer accuracy
-
uint32_t period
timeout period
-
bool auto_reload
auto reload
-
wm_drv_timer_unit unit
-
typedef wm_hal_timer_unit_t wm_drv_timer_unit
TIMER unit type.
-
typedef void (*wm_drv_timer_callback_t)(void *arg)
TIMER callback type.
-
wm_device_t *wm_drv_timer_init(char *dev_name)
Init timer.
- 参数:
dev_name – [in] device name, like “timer0”,”timer1”…
- 返回:
device handle, use
wm_device_t
NULL: failed
-
int wm_drv_timer_deinit(wm_device_t *dev)
Deinit timer.
- 参数:
dev – [in] device handle, use
wm_device_t
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_start(wm_device_t *dev, wm_drv_timer_cfg_t timer_cfg)
Start timer.
- 参数:
dev – [in] device handle, use
wm_device_t
timer_cfg – [in] timer cfg, use
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_stop(wm_device_t *dev)
Stop timer.
- 参数:
dev – [in] device handle, use
wm_device_t
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_set_period(wm_device_t *dev, uint32_t period)
Set timer period. Timer will restart for this.
- 参数:
dev – [in] device handle, use
wm_device_t
period – [in] timer period
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_set_auto_reload(wm_device_t *dev, bool auto_reload)
Set timer autoreload. Timer will restart for this.
- 参数:
dev – [in] device handle, use
wm_device_t
auto_reload – [in] timer autoreload
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_get_counter(wm_device_t *dev, uint32_t *counter)
Get timer counter.
- 参数:
dev – [in] device handle, use
wm_device_t
counter – [out] timer counter
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_register_callback(wm_device_t *dev, wm_drv_timer_callback_t timer_callback, void *arg)
Register timer isr.
- 参数:
dev – [in] device handle, use
wm_device_t
timer_callback – [in] timer isr handle, use
wm_drv_timer_callback_t
arg – [in] private data
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_timer_unregister_callback(wm_device_t *dev)
Unregister timer isr.
- 参数:
dev – [in] device handle, use
wm_device_t
- 返回:
WM_ERR_SUCCESS: succeed
others: failed