Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_pwm

Driver for PWM generation. More...

Enumerations

enum  bc_pwm_channel_t {
  BC_PWM_P0 = BC_GPIO_P0,
  BC_PWM_P1 = BC_GPIO_P1,
  BC_PWM_P2 = BC_GPIO_P2,
  BC_PWM_P3 = BC_GPIO_P3,
  BC_PWM_P6 = BC_GPIO_P6,
  BC_PWM_P7 = BC_GPIO_P7,
  BC_PWM_P8 = BC_GPIO_P8,
  BC_PWM_P12 = BC_GPIO_P12,
  BC_PWM_P14 = BC_GPIO_P14
}
 PWM channels.
 
enum  bc_pwm_tim_t {
  BC_PWM_TIM2_P0_P1_P2_P3,
  BC_PWM_TIM3_P6_P7_P8,
  BC_PWM_TIM21_P12_P14
}
 PWM timers. More...
 

Functions

void bc_pwm_init (bc_pwm_channel_t channel)
 Initialize PWM timers based on GPIO pin. More...
 
void bc_pwm_enable (bc_pwm_channel_t channel)
 Enable PWM output on GPIO pin. More...
 
void bc_pwm_disable (bc_pwm_channel_t channel)
 Disable PWM output on GPIO pin. More...
 
void bc_pwm_set (bc_pwm_channel_t channel, uint16_t pwm_value)
 Set PWM value for GPIO pin. More...
 
void bc_pwm_tim_configure (bc_pwm_tim_t tim, uint32_t resolution_us, uint32_t period_cycles)
 Reconfigure TIM3. More...
 

Detailed Description

Driver for PWM generation.

Enumeration Type Documentation

PWM timers.

Each timer controls a group of output PWM channels. The change of the specific timer affects also the other related PWM channels.

Definition at line 33 of file bc_pwm.h.

Function Documentation

void bc_pwm_disable ( bc_pwm_channel_t  channel)

Disable PWM output on GPIO pin.

Parameters
channel]channel GPIO channel

Definition at line 188 of file bc_pwm.c.

Here is the call graph for this function:

void bc_pwm_enable ( bc_pwm_channel_t  channel)

Enable PWM output on GPIO pin.

Parameters
channel]channel GPIO channel

Definition at line 174 of file bc_pwm.c.

Referenced by bc_servo_set_angle(), and bc_servo_set_microseconds().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_pwm_init ( bc_pwm_channel_t  channel)

Initialize PWM timers based on GPIO pin.

Parameters
[in]channelGPIO channel

Definition at line 141 of file bc_pwm.c.

Referenced by bc_servo_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_pwm_set ( bc_pwm_channel_t  channel,
uint16_t  pwm_value 
)

Set PWM value for GPIO pin.

Parameters
channel]channel GPIO channel
pwm_value]PWM duty value 0-255 in default configuration

Definition at line 193 of file bc_pwm.c.

Referenced by bc_servo_set_angle(), and bc_servo_set_microseconds().

Here is the caller graph for this function:

void bc_pwm_tim_configure ( bc_pwm_tim_t  tim,
uint32_t  resolution_us,
uint32_t  period_cycles 
)

Reconfigure TIM3.

Parameters
resolution_us]Set resolution of the timer in microseconds
period_cycles]Set number of periods of one cycle

Definition at line 115 of file bc_pwm.c.

Referenced by bc_pwm_init(), and bc_servo_init().

Here is the caller graph for this function: