Create /extras folder

Created /extras folder and moved PwmPin and RFControl files from src into src/extras.
This commit is contained in:
Gregg 2020-07-25 20:47:05 -05:00
parent ff08605b8b
commit 57fef4b496
7 changed files with 8 additions and 3 deletions

View File

@ -29,7 +29,7 @@ void setup() {
// you can download that mimics or reproduces analogWrite() in some form or another. HomeSpan conveniently comes with // you can download that mimics or reproduces analogWrite() in some form or another. HomeSpan conveniently comes with
// it own version of a wrapper around the ESP32 PWM classes that make it very easy to define PWM "channel," attach a pin, // it own version of a wrapper around the ESP32 PWM classes that make it very easy to define PWM "channel," attach a pin,
// and set the PWM level (or duty cycle) from 0-100%. These functions are encapsualted in the PwmPin class, as defined in // and set the PWM level (or duty cycle) from 0-100%. These functions are encapsualted in the PwmPin class, as defined in
// PwmPin.h. We will include this file in our updated DEV_LED.h for use with DEV_DimmableLED. // extras/PwmPin.h. We will include this file in our updated DEV_LED.h for use with DEV_DimmableLED.
Serial.begin(115200); Serial.begin(115200);

View File

@ -3,7 +3,7 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "PwmPin.h" // NEW! Include this HomeSpan "extra" to create LED-compatible PWM signals on one or more pins #include "extras/PwmPin.h" // NEW! Include this HomeSpan "extra" to create LED-compatible PWM signals on one or more pins
struct DEV_LED : Service::LightBulb { // ON/OFF LED struct DEV_LED : Service::LightBulb { // ON/OFF LED
@ -58,7 +58,7 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
// request the LED be turned off, but retain the brightness level so that it does not need to be resent if // request the LED be turned off, but retain the brightness level so that it does not need to be resent if
// the LED is turned back on. Multiplying the newValue of the power Characteristic (as a boolean) with the // the LED is turned back on. Multiplying the newValue of the power Characteristic (as a boolean) with the
// newValue of the Brightness Characteristic (as an int) is a short-hand way of creating the logic to // newValue of the Brightness Characteristic (as an int) is a short-hand way of creating the logic to
// determing the PWM level when the LED is off (always zero) or on (whatever the brightness level is). // set the PWM level when the LED is off (always zero) or on (whatever the brightness level is).
pwmPin->set(channel,power->newValue.BOOL*level->newValue.INT); pwmPin->set(channel,power->newValue.BOOL*level->newValue.INT);

5
src/extras/extras.ino Normal file
View File

@ -0,0 +1,5 @@
#error THIS IS NOT COMPILABLE CODE
This is a dummy .ino file that allows you to easily edit the contents of this library using the Arduino IDE.
The code is NOT designed to be compiled from this point. Compile and test the library using one of the examples.