8 #ifndef COMPONENTS_CPP_UTILS_PWM_H_
9 #define COMPONENTS_CPP_UTILS_PWM_H_
10 #include <driver/ledc.h>
25 uint32_t frequency = 100,
26 ledc_timer_bit_t bitSize = LEDC_TIMER_10_BIT,
27 ledc_timer_t timer = LEDC_TIMER_0,
28 ledc_channel_t channel = LEDC_CHANNEL_0);
35 void stop(
bool idleLevel=
false);
37 ledc_channel_t channel;
39 ledc_timer_bit_t bitSize;
void setFrequency(uint32_t freq)
Set the frequency/period in Hz.
Definition: PWM.cpp:141
A wrapper for ESP32 PWM control.
Definition: PWM.h:21
PWM(int gpioNum, uint32_t frequency=100, ledc_timer_bit_t bitSize=LEDC_TIMER_10_BIT, ledc_timer_t timer=LEDC_TIMER_0, ledc_channel_t channel=LEDC_CHANNEL_0)
Construct an instance.
Definition: PWM.cpp:34
uint32_t getDuty()
Get the duty cycle value.
Definition: PWM.cpp:62
uint32_t getFrequency()
Get the frequency/period in Hz.
Definition: PWM.cpp:72
void setDutyPercentage(uint8_t percent)
Set the duty cycle as a percentage value.
Definition: PWM.cpp:98
void stop(bool idleLevel=false)
Stop the PWM.
Definition: PWM.cpp:152
void setDuty(uint32_t duty)
Set the duty cycle value.
Definition: PWM.cpp:86