PWM
PWM API Reference
Functions
-
OSStatus bk_pwm_initialize(bk_pwm_t pwm, uint32_t frequency, uint32_t duty_cycle)
Initialises a PWM.
备注
Prepares a Pulse-Width Modulation pin for use.
- 参数
pwm – : the PWM interface which should be initialised
frequency – : Output signal frequency in Hertz
duty_cycle – : Set pwm first level reversal time
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_start(bk_pwm_t pwm)
Starts PWM output on a PWM interface.
备注
Starts Pulse-Width Modulation signal output on a PWM pin
- 参数
pwm – : the PWM interface which should be started
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_update_param(bk_pwm_t pwm, uint32_t frequency, uint32_t duty_cycle)
updat PWM
备注
Update pwm cycle and duty_cycle when pwm working.
- 参数
pwm – : the PWM interface which should be started
frequency – : pwm frequency
duty_cycle – : set first level change time
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_stop(bk_pwm_t pwm)
Stops output on a PWM pin.
备注
Stops Pulse-Width Modulation signal output on a PWM pin
- 参数
pwm – : the PWM interface which should be stopped
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_capture_initialize(bk_pwm_t pwm, uint8_t cap_mode)
Initialises capture PWM.
备注
Initialises pwm as capture mode
- 参数
pwm – : the PWM interface which should be initialised
cap_mode – : capture mode: 4:posedge, 5:negedge, 6:both
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_capture_start(bk_pwm_t pwm)
Start capture PWM.
备注
start pwm as capture
- 参数
pwm – : the PWM interface which should be started
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_capture_stop(bk_pwm_t pwm)
Stop capture PWM.
备注
stop pwm as capture
- 参数
pwm – : the PWM interface which should be stopped
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
UINT32 bk_pwm_get_capvalue(bk_pwm_t pwm)
Get capture PWM value.
备注
get pwm captured value
- 参数
pwm – : the PWM interface which should be get
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_cw_initialize(bk_pwm_t pwm1, bk_pwm_t pwm2, uint32_t frequency, uint32_t duty_cycle1, uint32_t duty_cycle2, uint32_t dead_band)
Initialises two PWMs with group mode.
备注
Initialises pwm-group mode
- 参数
pwm1 – : the PWM1 interface which should be initialised low level first on pin
pwm2 – : the PWM2 interface which should be initialised, high level first on pin
frequency – : Output signal frequency in Hertz
duty_cycle1 – : Set pwm1 first level reversal time
duty_cycle2 – : Set pwm2 first level reversal time
dead_band – : Set reversal time between two pwms high level
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_cw_start(bk_pwm_t pwm1, bk_pwm_t pwm2)
Start two PWMs with group mode.
备注
Start pwm group mode
- 参数
pwm1 – : the PWM1 interface which should be started
pwm2 – : the PWM2 interface which should be started
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step
-
OSStatus bk_pwm_cw_update_param(bk_pwm_t pwm1, bk_pwm_t pwm2, uint32_t frequency, uint32_t duty_cycle1, uint32_t duty_cycle, uint32_t dead_band)
Updata two PWMs with group mode.
备注
Updata param pwm-group mode
- 参数
pwm1 – : the PWM1 interface which should be updata, low level first on pin
pwm2 – : the PWM2 interface which should be updata, high level first on pin
frequency – : Output signal frequency in Hertz
duty_cycle1 – : Set pwm1 first level reversal time
duty_cycle2 – : Set pwm2 first level reversal time
dead_band – : Set reversal time between two pwms high level
- 返回
kNoErr : on success.
kGeneralErr : if an error occurred with any step