|
LightHub 4.6.0
Open-source smart home controller firmware
|
Hardware PWM output driver (config channel type CH_PWM = 3). More...
#include <out_pwm.h>
Public Member Functions | |
| int | Setup () override |
| Configure pin directions and (on Mega2560) the 4000 Hz PWM timers. | |
| int | Stop () override |
| Release the pins back to INPUT and mark the driver uninitialized. | |
| int | getChanType () override |
| Channel type derived from the number of configured pins (RGB/RGBW/RGBWW) or the raw item type. | |
| int | PixelCtrl (itemCmd cmd, char *subItem=NULL, bool show=true, bool authorized=false) override |
| Apply the command to the PWM pins (single percent or R/G/B/(W) values). | |
| Public Member Functions inherited from colorChannel | |
| colorChannel () | |
| Default constructor. | |
| void | link (Item *_item) |
| Attach to an item; retrieve and store the base address and the number of channel addresses. | |
| int | Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override |
| Dispatch /set, /HSV and /cmd ON/OFF commands to PixelCtrl. | |
| short | getChannelAddr (short n=0) |
| Get the pin address of the n-th channel (n=0 - base address). | |
| Public Member Functions inherited from abstractOut | |
| abstractOut () | |
| virtual int | isActive () |
| virtual bool | isAllowed (itemCmd cmd) |
| virtual itemCmd | getDefaultOnVal () |
| virtual int | Status () override |
| virtual void | setStatus (uint8_t status) override |
| Item * | getItem () |
| Public Member Functions inherited from abstractCh | |
| abstractCh () | |
| virtual | ~abstractCh () |
| virtual int | Poll (short cause) |
Additional Inherited Members | |
| Protected Member Functions inherited from abstractOut | |
| int | pubAction (bool state) |
| Protected Member Functions inherited from abstractCh | |
| int | publishTopic (const char *topic, long value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, float value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, const char *value, const char *subtopic=NULL, const char *suffix=NULL) |
| Protected Attributes inherited from colorChannel | |
| short | iaddr |
| short | numArgs |
| Protected Attributes inherited from abstractOut | |
| Item * | item |
| Item currently linked to this driver. | |
Hardware PWM output driver (config channel type CH_PWM = 3).
Drives one or more pins with analogWrite() PWM. The number of configured pins defines the color channel type:
JSON config (item argument array):
On Mega2560 the hardware PWM of timers 3 and 4 is reconfigured to a 4000 Hz frequency (prescaler = 2) so the white channels stay in sync with the RGB ones. On ESP32 the driver is a stub (no PWM yet).
Accepts the standard colorChannel control suffixes: /set (percent or color value), /HSV, /cmd ON/OFF.
|
overridevirtual |
Channel type derived from the number of configured pins (RGB/RGBW/RGBWW) or the raw item type.
Reimplemented from abstractOut.
|
overridevirtual |
Apply the command to the PWM pins (single percent or R/G/B/(W) values).
Implements colorChannel.
|
overridevirtual |
Configure pin directions and (on Mega2560) the 4000 Hz PWM timers.
Reimplemented from abstractOut.
|
overridevirtual |
Release the pins back to INPUT and mark the driver uninitialized.
Reimplemented from abstractCh.