VSF Documented
Macros | Functions
timer_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_TIMER_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_timer_init (vsf_timer_t *timer_ptr, vsf_timer_cfg_t *cfg_ptr)
 initialize a timer instance.
 
void vsf_timer_fini (vsf_timer_t *timer_ptr)
 finalize a timer instance.
 
fsm_rt_t vsf_timer_enable (vsf_timer_t *timer_ptr)
 enable interrupt masks of timer instance.
 
fsm_rt_t vsf_timer_disable (vsf_timer_t *timer_ptr)
 disable interrupt masks of timer instance.
 
void vsf_timer_irq_enable (vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
 enable interrupt masks of timer instance.
 
void vsf_timer_irq_disable (vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
 disable interrupt masks of timer instance.
 
vsf_timer_capability_t vsf_timer_capability (vsf_timer_t *timer_ptr)
 get the capability of timer instance.
 
vsf_err_t vsf_timer_set_period (vsf_timer_t *timer_ptr, uint32_t period)
 timer set period (maximum count)
 
vsf_err_t vsf_timer_pwm_set (vsf_timer_t *timer_ptr, uint8_t channel, uint32_t period, uint32_t pulse)
 timer pwm set the period width and pulse width for a channel
 

Macro Definition Documentation

◆ VSF_TIMER_CFG_FUNCTION_RENAME

#define VSF_TIMER_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_timer_init()

vsf_err_t vsf_timer_init ( vsf_timer_t timer_ptr,
vsf_timer_cfg_t cfg_ptr 
)

initialize a timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]cfg_ptra pointer to structure vsf_timer_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if timer was initialized, or a negative error code
Note
It is not necessary to call vsf_timer_fini() to deinitialization. vsf_timer_init() should be called before any other timer API except vsf_timer_capability().

◆ vsf_timer_fini()

void vsf_timer_fini ( vsf_timer_t timer_ptr)

finalize a timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
none

◆ vsf_timer_enable()

fsm_rt_t vsf_timer_enable ( vsf_timer_t timer_ptr)

enable interrupt masks of timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t
Returns
none.

◆ vsf_timer_disable()

fsm_rt_t vsf_timer_disable ( vsf_timer_t timer_ptr)

disable interrupt masks of timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t, vsf_timer_irq_mask_t
Returns
none.

◆ vsf_timer_irq_enable()

void vsf_timer_irq_enable ( vsf_timer_t timer_ptr,
vsf_timer_irq_mask_t  irq_mask 
)

enable interrupt masks of timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t
Returns
none.
Note
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_timer_irq_disable()

void vsf_timer_irq_disable ( vsf_timer_t timer_ptr,
vsf_timer_irq_mask_t  irq_mask 
)

disable interrupt masks of timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]irq_maskone or more value of enum vsf_timer_irq_mask_t, vsf_timer_irq_mask_t
Returns
none.

◆ vsf_timer_capability()

vsf_timer_capability_t vsf_timer_capability ( vsf_timer_t timer_ptr)

get the capability of timer instance.

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
Returns
vsf_timer_capability_t: return all capability of current timer vsf_timer_capability_t

◆ vsf_timer_set_period()

vsf_err_t vsf_timer_set_period ( vsf_timer_t timer_ptr,
uint32_t  period 
)

timer set period (maximum count)

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]periodtimer period width (in clock counter)
Returns
vsf_err_t: VSF_ERR_NONE if the timer set period was successfully, or a negative error code

◆ vsf_timer_pwm_set()

vsf_err_t vsf_timer_pwm_set ( vsf_timer_t timer_ptr,
uint8_t  channel,
uint32_t  period,
uint32_t  pulse 
)

timer pwm set the period width and pulse width for a channel

Parameters
[in]timer_ptra pointer to structure vsf_timer_t
[in]channeltimer pwm channel
[in]periodtimer pwm period width (in clock counter)
[in]pulsetimer pwm pulse width (in clock counter)
Returns
vsf_err_t: VSF_ERR_NONE if the timer pwm set was successfully, or a negative error code