Interface for WipperSnapper PWM.
More...
#include <ws_pwm.h>
Interface for WipperSnapper PWM.
◆ ws_pwm()
| ws_pwm::ws_pwm |
( |
ws_ledc * |
ledcManager | ) |
|
Constructor for ESP32 platforms.
- Parameters
-
| ledcManager | Pointer to LEDC driver. |
◆ attach()
| bool ws_pwm::attach |
( |
uint8_t |
pin, |
|
|
double |
freq, |
|
|
uint8_t |
resolution |
|
) |
| |
Attaches a PWM pin.
- Parameters
-
| pin | GPIO pin. |
| freq | PWM frequency, in Hz. |
| resolution | PWM resolution, in bytes. |
- Returns
- True if PWM pin is successfully attached to a timer, otherwise False.
◆ detach()
| void ws_pwm::detach |
( |
uint8_t |
pin | ) |
|
Detaches a PWM pin.
- Parameters
-
◆ writeDutyCycle()
| void ws_pwm::writeDutyCycle |
( |
uint8_t |
pin, |
|
|
int |
dutyCycle |
|
) |
| |
Writes a duty cycle to a pin with a fixed freq of 5kHz.
- Parameters
-
| pin | GPIO pin to write to. |
| dutyCycle | Desired duty cycle to write to a pin. |
◆ writeTone()
| void ws_pwm::writeTone |
( |
uint8_t |
pin, |
|
|
uint32_t |
freq |
|
) |
| |
Writes a frequency to a pin with a fixed duty cycle.
- Parameters
-
| pin | GPIO pin to write to. |
| freq | Desired frequency to write to a pin, in Hz. |
◆ noTone()
| void ws_pwm::noTone |
( |
uint8_t |
pin | ) |
|
Stops a square wave generated by writeTone().
- Parameters
-
| pin | GPIO pin to stop generating the tone on. |
The documentation for this class was generated from the following files: