Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Hardware pulse width modulation. More...
#include <HardwarePWM.h>
Public Member Functions | |
HardwarePWM (uint8 *pins, uint8 no_of_pins) | |
Instantiate hardware PWM object. More... | |
bool | analogWrite (uint8 pin, uint32 duty) |
Set PWM duty cycle. More... | |
bool | setDutyChan (uint8 chan, uint32 duty, bool update=true) |
Set PWM duty cycle for a channel. More... | |
bool | setDuty (uint8 pin, uint32 duty, bool update=true) |
Set PWM duty cycle. More... | |
uint32 | getDutyChan (uint8 chan) |
Get PWM duty cycle. More... | |
uint32 | getDuty (uint8 pin) |
Get PWM duty cycle. More... | |
void | setPeriod (uint32 period) |
Set PWM period. More... | |
uint32 | getPeriod (void) |
Get PWM period. More... | |
uint8 | getChannel (uint8 pin) |
Get channel number for a pin. More... | |
uint32 | getMaxDuty () |
Get the maximum duty cycle value. More... | |
void | update () |
This function is used to actually update the PWM. More... | |
Hardware pulse width modulation.
HardwarePWM::HardwarePWM | ( | uint8 * | pins, |
uint8 | no_of_pins | ||
) |
Instantiate hardware PWM object.
pins | Pointer to array of pins to control |
no_of_pins | Quantity of elements in array of pins |
|
inline |
Set PWM duty cycle.
pin | GPIO to set |
duty | Value of duty cycle to set pin to |
bool | True on success |
uint8 HardwarePWM::getChannel | ( | uint8 | pin | ) |
Get channel number for a pin.
pin | GPIO to interrogate |
uint8 | Channel of GPIO |
|
inline |
Get PWM duty cycle.
pin | GPIO to get duty cycle for |
uint32 | Value of PWM duty cycle |
uint32 HardwarePWM::getDutyChan | ( | uint8 | chan | ) |
Get PWM duty cycle.
chan | Channel to get duty cycle for |
uint32 | Value of PWM duty cycle |
|
inline |
Get the maximum duty cycle value.
uint32 | Maximum permissible duty cycle |
uint32 HardwarePWM::getPeriod | ( | void | ) |
Get PWM period.
uint32 | Value of PWM period |
|
inline |
Set PWM duty cycle.
pin | GPIO to set |
duty | Value of duty cycle to set pin to |
update | Update PWM output |
bool | True on success |
bool HardwarePWM::setDutyChan | ( | uint8 | chan, |
uint32 | duty, | ||
bool | update = true |
||
) |
Set PWM duty cycle for a channel.
channel | Channel to set |
duty | Value of duty cycle to set channel to |
update | Update PWM output |
bool | True on success |
void HardwarePWM::setPeriod | ( | uint32 | period | ) |
Set PWM period.
period | PWM period |
void HardwarePWM::update | ( | ) |
This function is used to actually update the PWM.