Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_pwm.h
1 #ifndef _BC_PWM_H
2 #define _BC_PWM_H
3 
4 #include <bc_system.h>
5 #include <bc_gpio.h>
6 #include <stm32l0xx.h>
7 
11 
13 
14 typedef enum
15 {
16  BC_PWM_P0 = BC_GPIO_P0,
17  BC_PWM_P1 = BC_GPIO_P1,
18  BC_PWM_P2 = BC_GPIO_P2,
19  BC_PWM_P3 = BC_GPIO_P3,
20 
21  BC_PWM_P6 = BC_GPIO_P6,
22  BC_PWM_P7 = BC_GPIO_P7,
23  BC_PWM_P8 = BC_GPIO_P8,
24 
25  BC_PWM_P12 = BC_GPIO_P12,
26  BC_PWM_P14 = BC_GPIO_P14,
27 
29 
32 
33 typedef enum
34 {
35  BC_PWM_TIM2_P0_P1_P2_P3,
36  BC_PWM_TIM3_P6_P7_P8,
37  BC_PWM_TIM21_P12_P14
38 
39 } bc_pwm_tim_t;
40 
43 
44 void bc_pwm_init(bc_pwm_channel_t channel);
45 
48 
49 void bc_pwm_enable(bc_pwm_channel_t channel);
50 
53 
54 void bc_pwm_disable(bc_pwm_channel_t channel);
55 
59 
60 void bc_pwm_set(bc_pwm_channel_t channel, uint16_t pwm_value);
61 
65 
66 void bc_pwm_tim_configure(bc_pwm_tim_t tim, uint32_t resolution_us, uint32_t period_cycles);
67 
69 
70 #endif // _BC_PWM_H
GPIO channel P14.
Definition: bc_gpio.h:57
bc_pwm_tim_t
PWM timers.
Definition: bc_pwm.h:33
bc_pwm_channel_t
PWM channels.
Definition: bc_pwm.h:14
void bc_pwm_disable(bc_pwm_channel_t channel)
Disable PWM output on GPIO pin.
Definition: bc_pwm.c:188
GPIO channel P2.
Definition: bc_gpio.h:21
GPIO channel P8.
Definition: bc_gpio.h:39
GPIO channel P6.
Definition: bc_gpio.h:33
GPIO channel P1.
Definition: bc_gpio.h:18
void bc_pwm_enable(bc_pwm_channel_t channel)
Enable PWM output on GPIO pin.
Definition: bc_pwm.c:174
GPIO channel P3.
Definition: bc_gpio.h:24
GPIO channel P0.
Definition: bc_gpio.h:15
GPIO channel P12.
Definition: bc_gpio.h:51
void bc_pwm_tim_configure(bc_pwm_tim_t tim, uint32_t resolution_us, uint32_t period_cycles)
Reconfigure TIM3.
Definition: bc_pwm.c:115
GPIO channel P7.
Definition: bc_gpio.h:36
void bc_pwm_init(bc_pwm_channel_t channel)
Initialize PWM timers based on GPIO pin.
Definition: bc_pwm.c:141
void bc_pwm_set(bc_pwm_channel_t channel, uint16_t pwm_value)
Set PWM value for GPIO pin.
Definition: bc_pwm.c:193