From 16cf7655f02fc5622f4bf7422d2ee31f56e9d76d Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Sun, 28 Nov 2021 18:51:05 +0100 Subject: [PATCH] simplify example task --- lib/exampletask/GwExampleHardware.h | 25 ------------------------- lib/exampletask/GwExampleTask.h | 26 ++++++++++++++++++++++---- lib/exampletask/Readme.md | 1 - 3 files changed, 22 insertions(+), 30 deletions(-) delete mode 100644 lib/exampletask/GwExampleHardware.h diff --git a/lib/exampletask/GwExampleHardware.h b/lib/exampletask/GwExampleHardware.h deleted file mode 100644 index e2d646e..0000000 --- a/lib/exampletask/GwExampleHardware.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _GWEXAMPLEHARDWARE_H -#define _GWEXAMPLEHARDWARE_H - -#ifdef BOARD_TEST -#define ESP32_CAN_TX_PIN GPIO_NUM_22 -#define ESP32_CAN_RX_PIN GPIO_NUM_19 -//if using tail485 -#define GWSERIAL_TX 26 -#define GWSERIAL_RX 32 -#define GWSERIAL_MODE "UNI" -#define GWBUTTON_PIN GPIO_NUM_39 -#define GWBUTTON_ACTIVE LOW -//if GWBUTTON_PULLUPDOWN we enable a pulup/pulldown -#define GWBUTTON_PULLUPDOWN -//led handling -//if we define GWLED_FASTNET the arduino fastnet lib is used -#define GWLED_FASTLED -#define GWLED_TYPE SK6812 -//color schema for fastled -#define GWLED_SCHEMA GRB -#define GWLED_PIN GPIO_NUM_27 -//brightness 0...255 -#define GWLED_BRIGHTNESS 64 -#endif -#endif \ No newline at end of file diff --git a/lib/exampletask/GwExampleTask.h b/lib/exampletask/GwExampleTask.h index 267e0e2..f503085 100644 --- a/lib/exampletask/GwExampleTask.h +++ b/lib/exampletask/GwExampleTask.h @@ -1,9 +1,28 @@ -#ifndef _GWEXAMPLETASK_H -#define _GWEXAMPLETASK_H -#include "GwExampleHardware.h" +#pragma once #include "GwApi.h" //we only compile for some boards #ifdef BOARD_TEST + +#define ESP32_CAN_TX_PIN GPIO_NUM_22 +#define ESP32_CAN_RX_PIN GPIO_NUM_19 +//if using tail485 +#define GWSERIAL_TX 26 +#define GWSERIAL_RX 32 +#define GWSERIAL_MODE "UNI" +#define GWBUTTON_PIN GPIO_NUM_39 +#define GWBUTTON_ACTIVE LOW +//if GWBUTTON_PULLUPDOWN we enable a pulup/pulldown +#define GWBUTTON_PULLUPDOWN +//led handling +//if we define GWLED_FASTNET the arduino fastnet lib is used +#define GWLED_FASTLED +#define GWLED_TYPE SK6812 +//color schema for fastled +#define GWLED_SCHEMA GRB +#define GWLED_PIN GPIO_NUM_27 +//brightness 0...255 +#define GWLED_BRIGHTNESS 64 + void exampleTask(void *param); //make the task known to the core DECLARE_USERTASK(exampleTask); @@ -11,5 +30,4 @@ DECLARE_USERTASK(exampleTask); //use in config.json to only show some //elements when this capability is set correctly DECLARE_CAPABILITY(testboard,true); -#endif #endif \ No newline at end of file diff --git a/lib/exampletask/Readme.md b/lib/exampletask/Readme.md index d9c3abf..4538a95 100644 --- a/lib/exampletask/Readme.md +++ b/lib/exampletask/Readme.md @@ -19,7 +19,6 @@ Files Avoid including headers from other libraries in this file as this could interfere with the main code. Just only include them in your .cpp files (or in other headers). * [GwExampleTaks.cpp](GwExampleTask.cpp) includes the implementation of our task. This tasks runs in an own thread - see the comments in the code. We can have as many cpp (and header files) as we need to structure our code. - * [GwExampleHardware.h](GwExampleHardware.h) includes our pin definitions for the board. * [config.json](config.json)
This file allows to add some config definitions that are needed for our task. For the possible options have a look at the global [config.json](../../web/config.json). Be careful not to overwrite config defitions from the global file. A good practice wood be to prefix the names of definitions with parts of the library name. Always put them in a separate category so that they do not interfere with the system ones. The defined config items can later be accessed in the code (see the example in [GwExampleTask.cpp](GwExampleTask.cpp)).