#include <libpropeller/libpropeller/pwm32/pwm32.h>
|
void | Start (void) |
|
void | Stop (void) |
|
void | Duty (int pin, int duty_cycle, int period) |
|
void | Servo (int pin, int pulse_width) |
|
void | PWM (int pin, int on_time, int off_time) |
|
|
static const int | Resolution = 8200 |
|
Run up to 32 channels of low speed PWM (up to ~10kHz@80MHz clock).
No external hardware beyond the PWM devices is needed. Works with H bridges, LEDs, servos, and anything else that takes a repeating PWM signal.
Copyright (c) 2013 Kenneth Bedolla (libpr.nosp@m.opel.nosp@m.ler@k.nosp@m.enne.nosp@m.thbed.nosp@m.olla.nosp@m..com)
- Examples
- PWM32_Demo.cpp.
Definition at line 30 of file pwm32.h.
◆ Duty()
void libpropeller::PWM32::Duty |
( |
int |
pin, |
|
|
int |
duty_cycle, |
|
|
int |
period |
|
) |
| |
Output a PWM wave with a calculated duty.
- Parameters
-
pin | The I/O pin to use (0..31) |
duty_cycle | The duty cycle (0..100) to use. 0 is off, 100 is full on. |
period | The period (in uS) of the cycle. |
Definition at line 74 of file pwm32.h.
◆ PWM()
void libpropeller::PWM32::PWM |
( |
int |
pin, |
|
|
int |
on_time, |
|
|
int |
off_time |
|
) |
| |
Output a series of square waves with a high time of on_time microseconds, and a period of (on_time + low_time) microseconds.
- Parameters
-
pin | The I/O pin to use (0..31) |
on_time | The duration of the high time, in uS. |
off_time | The duration of the low time, in uS. |
Definition at line 131 of file pwm32.h.
◆ Servo()
void libpropeller::PWM32::Servo |
( |
int |
pin, |
|
|
int |
pulse_width |
|
) |
| |
Output a servo compatible pulse with a period of 20ms.
- Parameters
-
pin | The I/O pin to use (0..31) |
pulse_width | The width of the servo pulse in uS. Can be any value, but most servos require a range (1000..2000) |
Definition at line 113 of file pwm32.h.
◆ Start()
void libpropeller::PWM32::Start |
( |
void |
| ) |
|
Start a cog with the PWM runner.
Definition at line 44 of file pwm32.h.
◆ Stop()
void libpropeller::PWM32::Stop |
( |
void |
| ) |
|
Stop the cog, if running.
Definition at line 60 of file pwm32.h.
The documentation for this class was generated from the following file:
- libpropeller/libpropeller/pwm32/pwm32.h