Bouffalo SDK  1.0
Bouffalolab Software Development Kit
PWM_V2
Collaboration diagram for PWM_V2:

Modules

 pwm channel definition
 
 pwm polarity definition
 
 pwm state definition
 
 pwm trigger adc source definition
 
 pwm interrupt enable definition
 
 pwm interrupt status definition
 
 pwm interrupt clear definition
 
 pwm feature control cmd definition
 

Data Structures

struct  bflb_pwm_v2_channel_config_s
 PWM channel configuration structure. More...
 
struct  bflb_pwm_v2_config_s
 PWM configuration structure. More...
 

Functions

void bflb_pwm_v2_init (struct bflb_device_s *dev, const struct bflb_pwm_v2_config_s *config)
 Initialize pwm. More...
 
void bflb_pwm_v2_deinit (struct bflb_device_s *dev)
 Deinitialize pwm. More...
 
void bflb_pwm_v2_start (struct bflb_device_s *dev)
 Start pwm output. More...
 
void bflb_pwm_v2_stop (struct bflb_device_s *dev)
 Stop pwm output. More...
 
void bflb_pwm_v2_set_period (struct bflb_device_s *dev, uint16_t period)
 Set pwm period to change pwm frequence. Frequcence(hz) = pwm source clock /div/period. More...
 
float bflb_pwm_v2_get_frequency (struct bflb_device_s *dev)
 Get pwm frequcency. More...
 
void bflb_pwm_v2_channel_init (struct bflb_device_s *dev, uint8_t ch, struct bflb_pwm_v2_channel_config_s *config)
 Config pwm channel. More...
 
void bflb_pwm_v2_channel_set_threshold (struct bflb_device_s *dev, uint8_t ch, uint16_t low_threhold, uint16_t high_threhold)
 Set pwm dutycycle. Dutycycle(%) = (high_threhold - low_threhold)/period * 100%. More...
 
void bflb_pwm_v2_channel_positive_start (struct bflb_device_s *dev, uint8_t ch)
 Start pwm positive output. More...
 
void bflb_pwm_v2_channel_negative_start (struct bflb_device_s *dev, uint8_t ch)
 Start pwm negative output. More...
 
void bflb_pwm_v2_channel_positive_stop (struct bflb_device_s *dev, uint8_t ch)
 Stop pwm positive output. More...
 
void bflb_pwm_v2_channel_negative_stop (struct bflb_device_s *dev, uint8_t ch)
 Stop pwm negative output. More...
 
void bflb_pwm_v2_int_enable (struct bflb_device_s *dev, uint32_t int_en, bool enable)
 Enable pwm interrupt. More...
 
uint32_t bflb_pwm_v2_get_intstatus (struct bflb_device_s *dev)
 Get pwm interrupt status. More...
 
void bflb_pwm_v2_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear pwm interrupt status. More...
 
int bflb_pwm_v2_feature_control (struct bflb_device_s *dev, int cmd, size_t arg)
 Control pwm feature. More...
 

Detailed Description

Function Documentation

◆ bflb_pwm_v2_channel_init()

void bflb_pwm_v2_channel_init ( struct bflb_device_s dev,
uint8_t  ch,
struct bflb_pwm_v2_channel_config_s config 
)

Config pwm channel.

Parameters
[in]devdevice handle
[in]chchannel number
[in]configpointer to save pwm channel config

◆ bflb_pwm_v2_channel_negative_start()

void bflb_pwm_v2_channel_negative_start ( struct bflb_device_s dev,
uint8_t  ch 
)

Start pwm negative output.

Parameters
[in]devdevice handle
[in]chchannel number

◆ bflb_pwm_v2_channel_negative_stop()

void bflb_pwm_v2_channel_negative_stop ( struct bflb_device_s dev,
uint8_t  ch 
)

Stop pwm negative output.

Parameters
[in]devdevice handle
[in]chchannel number

◆ bflb_pwm_v2_channel_positive_start()

void bflb_pwm_v2_channel_positive_start ( struct bflb_device_s dev,
uint8_t  ch 
)

Start pwm positive output.

Parameters
[in]devdevice handle
[in]chchannel number

◆ bflb_pwm_v2_channel_positive_stop()

void bflb_pwm_v2_channel_positive_stop ( struct bflb_device_s dev,
uint8_t  ch 
)

Stop pwm positive output.

Parameters
[in]devdevice handle
[in]chchannel number

◆ bflb_pwm_v2_channel_set_threshold()

void bflb_pwm_v2_channel_set_threshold ( struct bflb_device_s dev,
uint8_t  ch,
uint16_t  low_threhold,
uint16_t  high_threhold 
)

Set pwm dutycycle. Dutycycle(%) = (high_threhold - low_threhold)/period * 100%.

Parameters
[in]devdevice handle
[in]chchannel number
[in]low_threholdpwm low threhold
[in]high_threholdpwm high threhold

◆ bflb_pwm_v2_deinit()

void bflb_pwm_v2_deinit ( struct bflb_device_s dev)

Deinitialize pwm.

Parameters
[in]devdevice handle

◆ bflb_pwm_v2_feature_control()

int bflb_pwm_v2_feature_control ( struct bflb_device_s dev,
int  cmd,
size_t  arg 
)

Control pwm feature.

Parameters
[in]devdevice handle
[in]cmdfeature command, use pwm feature control cmd definition
[in]arguser data
Returns
A negated errno value on failure.

◆ bflb_pwm_v2_get_frequency()

float bflb_pwm_v2_get_frequency ( struct bflb_device_s dev)

Get pwm frequcency.

Parameters
[in]devdevice handle
Returns
frequcency

◆ bflb_pwm_v2_get_intstatus()

uint32_t bflb_pwm_v2_get_intstatus ( struct bflb_device_s dev)

Get pwm interrupt status.

Parameters
[in]devdevice handle
Returns
interrupt status, use pwm interrupt status definition

◆ bflb_pwm_v2_init()

void bflb_pwm_v2_init ( struct bflb_device_s dev,
const struct bflb_pwm_v2_config_s config 
)

Initialize pwm.

Parameters
[in]devdevice handle
[in]configpointer to save pwm config

◆ bflb_pwm_v2_int_clear()

void bflb_pwm_v2_int_clear ( struct bflb_device_s dev,
uint32_t  int_clear 
)

Clear pwm interrupt status.

Parameters
[in]devdevice handle
[in]int_clearclear value, use pwm interrupt clear definition

◆ bflb_pwm_v2_int_enable()

void bflb_pwm_v2_int_enable ( struct bflb_device_s dev,
uint32_t  int_en,
bool  enable 
)

Enable pwm interrupt.

Parameters
[in]devdevice handle
[in]int_eninterrupt type
[in]enabletrue means enable, otherwise disable

◆ bflb_pwm_v2_set_period()

void bflb_pwm_v2_set_period ( struct bflb_device_s dev,
uint16_t  period 
)

Set pwm period to change pwm frequence. Frequcence(hz) = pwm source clock /div/period.

Parameters
[in]devdevice handle
[in]periodpwm period

◆ bflb_pwm_v2_start()

void bflb_pwm_v2_start ( struct bflb_device_s dev)

Start pwm output.

Parameters
[in]devdevice handle

◆ bflb_pwm_v2_stop()

void bflb_pwm_v2_stop ( struct bflb_device_s dev)

Stop pwm output.

Parameters
[in]devdevice handle