Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_pwm_v1.h File Reference
#include "bflb_core.h"
Include dependency graph for bflb_pwm_v1.h:

Go to the source code of this file.

Data Structures

struct  bflb_pwm_v1_channel_config_s
 PWM configuration structure. More...
 

Macros

#define PWM_CH0   0
 
#define PWM_CH1   1
 
#define PWM_CH2   2
 
#define PWM_CH3   3
 
#define PWM_CH4   4
 
#define PWM_V1_CH_MAX   5
 
#define PWM_INTSTS_REPT_CH0   (1 << 0)
 
#define PWM_INTSTS_REPT_CH1   (1 << 1)
 
#define PWM_INTSTS_REPT_CH2   (1 << 2)
 
#define PWM_INTSTS_REPT_CH3   (1 << 3)
 
#define PWM_INTSTS_REPT_CH4   (1 << 4)
 
#define PWM_INTCLR_REPT_CH0   (1 << 8)
 
#define PWM_INTCLR_REPT_CH1   (1 << 9)
 
#define PWM_INTCLR_REPT_CH2   (1 << 10)
 
#define PWM_INTCLR_REPT_CH3   (1 << 11)
 
#define PWM_INTCLR_REPT_CH4   (1 << 12)
 
#define PWM_CMD_SET_STOP_MODE   (0x01)
 
#define PWM_CMD_SET_OUT_INVERT   (0x02)
 
#define PWM_CMD_SET_SW_MODE   (0x03)
 
#define PWM_CMD_SET_SW_FORCE_VALUE   (0x04)
 
#define PWM_CMD_SET_REPT_COUNT   (0x05)
 
#define PWM_STOP_MODE_ABRUPT   0
 
#define PWM_STOP_MODE_GRACEFUL   1
 

Functions

void bflb_pwm_v1_channel_init (struct bflb_device_s *dev, uint8_t ch, const struct bflb_pwm_v1_channel_config_s *config)
 Initialize pwm channel. More...
 
void bflb_pwm_v1_channel_deinit (struct bflb_device_s *dev, uint8_t ch)
 Deinitialize pwm channel. More...
 
void bflb_pwm_v1_start (struct bflb_device_s *dev, uint8_t ch)
 Start pwm channel output. More...
 
void bflb_pwm_v1_stop (struct bflb_device_s *dev, uint8_t ch)
 Stop pwm channel output. More...
 
void bflb_pwm_v1_set_period (struct bflb_device_s *dev, uint8_t ch, uint16_t period)
 Set pwm channel period to change pwm frequence. Frequcence(hz) = pwm source clock /div/period. More...
 
void bflb_pwm_v1_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_v1_int_enable (struct bflb_device_s *dev, uint8_t ch, bool enable)
 Enable pwm interrupt. More...
 
uint32_t bflb_pwm_v1_get_intstatus (struct bflb_device_s *dev)
 Get pwm interrupt status. More...
 
void bflb_pwm_v1_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear pwm interrupt status. More...
 
int bflb_pwm_v1_feature_control (struct bflb_device_s *dev, uint8_t ch, int cmd, size_t arg)