Removed #include "extras/PwmPin.h" from all Tutorial Examples

Since PwmPin.h is already included in HomeSpan.h, there is no reason to separately include it in user sketches.
This commit is contained in:
Gregg 2024-02-08 07:39:03 -06:00
parent dbb0f6565f
commit c5a0f061ce
14 changed files with 18 additions and 33 deletions

View File

@ -50,12 +50,11 @@ void setup() {
// As usual, all previous comments have been deleted and only new changes from the previous example are shown. // As usual, all previous comments have been deleted and only new changes from the previous example are shown.
// NOTE: The Arduino/ESP32 code base does not include the function analogWrite() which is typically used to create a PWM // NOTE: The Arduino/ESP32 code base does not include the function analogWrite() which is typically used to create a PWM
// output to drive the brightness of an LED. The ESP32 code base itself includes a set of functions to create PWM output // output to drive the brightness of an LED. Instead, the ESP32 code base itself includes a set of functions to create PWM output
// and the ESP32 chip has built-in PWM functionality specifically for this purpose. There are numerous libraries // and the ESP32 chip has built-in PWM functionality specifically for this purpose.
// you can download that mimics or reproduces analogWrite() in some form or another. HomeSpan conveniently comes with
// its own version of a wrapper around the ESP32 PWM classes that make it very easy to define LED pins, and set the // HomeSpan wraps all of this PWM functionality into a single integrated class called LedPin, making it very easy to define
// PWM level (or duty cycle) from 0-100%. These functions are encapsualted in the LedPin class, as defined in // dimmable LED pins and set the PWM level (i.e. duty cycle) from 0-100%. Use of this LedPin class is shown in 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,8 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#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
int ledPin; // pin number defined for this LED int ledPin; // pin number defined for this LED

View File

@ -3,8 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#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
int ledPin; // pin number defined for this LED int ledPin; // pin number defined for this LED

View File

@ -3,8 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "extras/PwmPin.h" // allows PWM control of LED brightness
struct DEV_LED : Service::LightBulb { // ON/OFF LED struct DEV_LED : Service::LightBulb { // ON/OFF LED
int ledPin; // pin number defined for this LED int ledPin; // pin number defined for this LED

View File

@ -3,8 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "extras/PwmPin.h" // allows PWM control of LED brightness
struct DEV_LED : Service::LightBulb { // ON/OFF LED struct DEV_LED : Service::LightBulb { // ON/OFF LED
int ledPin; // pin number defined for this LED int ledPin; // pin number defined for this LED

View File

@ -3,10 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "extras/PwmPin.h" // library of various PWM functions
////////////////////////////////////
struct DEV_LED : Service::LightBulb { // ON/OFF LED struct DEV_LED : Service::LightBulb { // ON/OFF LED
int ledPin; // pin number defined for this LED int ledPin; // pin number defined for this LED

View File

@ -3,10 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "extras/PwmPin.h" // library of various PWM functions
////////////////////////////////////
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
// This version of the Dimmable LED Service is similar to the one last used in Example 11, but now includes support for 3 physical PushButtons // This version of the Dimmable LED Service is similar to the one last used in Example 11, but now includes support for 3 physical PushButtons

View File

@ -3,10 +3,6 @@
// DEVICE-SPECIFIC LED SERVICES // // DEVICE-SPECIFIC LED SERVICES //
//////////////////////////////////// ////////////////////////////////////
#include "extras/PwmPin.h" // library of various PWM functions
////////////////////////////////////
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
// This version of the Dimmable LED Service includes a PushButton that can be used to turn on/off the LED. Status of both the // This version of the Dimmable LED Service includes a PushButton that can be used to turn on/off the LED. Status of both the

View File

@ -45,6 +45,10 @@
#include "extras/Blinker.h" #include "extras/Blinker.h"
#include "extras/Pixel.h" #include "extras/Pixel.h"
#include "extras/RFControl.h"
#include "extras/PwmPin.h"
#include "extras/StepperControl.h"
#include "Settings.h" #include "Settings.h"
#include "Utils.h" #include "Utils.h"
#include "Network.h" #include "Network.h"
@ -52,8 +56,6 @@
#include "HapQR.h" #include "HapQR.h"
#include "Characteristics.h" #include "Characteristics.h"
#include "extras/StepperControl.h"
using std::vector; using std::vector;
using std::unordered_map; using std::unordered_map;
using std::list; using std::list;

View File

@ -106,8 +106,9 @@ class StepperControl {
////////////////////////// //////////////////////////
#include "Stepper_UNIPOLAR.h" #include "Stepper_UNIPOLAR.h"
#include "Stepper_TB6612.h" #include "Stepper_TB6612.h" // https://www.adafruit.com/product/2448
#include "Stepper_A3967.h" #include "Stepper_A3967.h" // https://www.sparkfun.com/products/12779
struct Stepper_UNL2003 : Stepper_UNIPOLAR { struct Stepper_UNL2003 : Stepper_UNIPOLAR {
Stepper_UNL2003(int IN1, int IN2, int IN3, int IN4, std::pair<uint32_t, uint32_t> taskParams = {1,0}) : Stepper_UNIPOLAR(IN1,IN3,IN2,IN4,taskParams){} Stepper_UNL2003(int IN1, int IN2, int IN3, int IN4, std::pair<uint32_t, uint32_t> taskParams = {1,0}) : Stepper_UNIPOLAR(IN1,IN3,IN2,IN4,taskParams){}

View File

@ -25,6 +25,8 @@
* *
********************************************************************************/ ********************************************************************************/
#pragma once
// Implementation of StepperControl for a Sparkfun A3967 EasyDriver Stepper Motor Driver // Implementation of StepperControl for a Sparkfun A3967 EasyDriver Stepper Motor Driver
// Breakout Board (https://www.sparkfun.com/products/12779) // Breakout Board (https://www.sparkfun.com/products/12779)

View File

@ -25,6 +25,8 @@
* *
********************************************************************************/ ********************************************************************************/
#pragma once
// Implementation of StepperControl for an Adafruit TB6612 1.2A DC/Stepper Motor Driver // Implementation of StepperControl for an Adafruit TB6612 1.2A DC/Stepper Motor Driver
// Breakout Board (https://www.adafruit.com/product/2448) // Breakout Board (https://www.adafruit.com/product/2448)

View File

@ -25,6 +25,8 @@
* *
********************************************************************************/ ********************************************************************************/
#pragma once
// Implementation of a basic 4-wire controller for a center-tapped Unipolar Stepper Motor // Implementation of a basic 4-wire controller for a center-tapped Unipolar Stepper Motor
// with two coils (Coil 1 and Coil 2) each having two driving inputs (A and B). // with two coils (Coil 1 and Coil 2) each having two driving inputs (A and B).
// //

View File

@ -28,9 +28,6 @@
// This is a placeholder .ino file that allows you to easily edit the contents of this files using the Arduino IDE, // This is a placeholder .ino file that allows you to easily edit the contents of this files using the Arduino IDE,
// as well as compile and test from this point. This file is ignored when the library is included in other sketches. // as well as compile and test from this point. This file is ignored when the library is included in other sketches.
//#include "Stepper_TB6612.h" // include the driver for a TB6612 chip
//#include "Stepper_A3967.h"
#include "StepperControl.h" #include "StepperControl.h"
StepperControl *bigMotor; StepperControl *bigMotor;