ESP8266_RTOS_SDK
v1.4.0
|
PWM driver APIs. More...
Data Structures | |
struct | pwm_param |
Macros | |
#define | PWM_DEPTH 1023 |
Functions | |
void | pwm_init (uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_info_list)[3]) |
PWM function initialization, including GPIO, frequency and duty cycle. More... | |
void | pwm_set_duty (uint32 duty, uint8 channel) |
Set the duty cycle of a PWM channel. More... | |
uint32 | pwm_get_duty (uint8 channel) |
Get the duty cycle of a PWM channel. More... | |
void | pwm_set_period (uint32 period) |
Set PWM period, unit : us. More... | |
uint32 | pwm_get_period (void) |
Get PWM period, unit : us. More... | |
void | pwm_start (void) |
Starts PWM. More... | |
PWM driver APIs.
uint32 pwm_get_duty | ( | uint8 | channel | ) |
Get the duty cycle of a PWM channel.
uint8 | channel : PWM channel number |
uint32 pwm_get_period | ( | void | ) |
Get PWM period, unit : us.
null |
void pwm_init | ( | uint32 | period, |
uint32 * | duty, | ||
uint32 | pwm_channel_num, | ||
uint32(*) | pin_info_list[3] | ||
) |
PWM function initialization, including GPIO, frequency and duty cycle.
uint32 | period : pwm frequency |
uint32 | *duty : duty cycle |
uint32 | pwm_channel_num : PWM channel number |
uint32 | (*pin_info_list)[3] : GPIO parameter of PWM channel, it is a pointer of n x 3 array which defines GPIO register, IO reuse of corresponding pin and GPIO number. |
void pwm_set_duty | ( | uint32 | duty, |
uint8 | channel | ||
) |
Set the duty cycle of a PWM channel.
Set the time that high level signal will last, duty depends on period, the maximum value can be 1023.
uint32 | duty : duty cycle |
uint8 | channel : PWM channel number |
void pwm_set_period | ( | uint32 | period | ) |
Set PWM period, unit : us.
For example, for 1KHz PWM, period is 1000 us.
uint32 | period : PWM period, unit : us. |
void pwm_start | ( | void | ) |
Starts PWM.
null |