Enable TP medium for ESP32

This commit is contained in:
etrinh 2020-04-07 18:24:28 +02:00
parent 0f99a4c969
commit d789fb1459
2 changed files with 31 additions and 11 deletions

View File

@ -15,28 +15,37 @@
#else #else
#error "No medium type specified for platform Arduino_SAMD! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)" #error "No medium type specified for platform Arduino_SAMD! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
#endif #endif
#define ICACHE_RAM_ATTR
#elif ARDUINO_ARCH_ESP8266 #elif ARDUINO_ARCH_ESP8266
// predefined global instance for IP only // predefined global instance for IP only
KnxFacade<EspPlatform, Bau57B0> knx; KnxFacade<EspPlatform, Bau57B0> knx;
#elif ARDUINO_ARCH_ESP32 #elif ARDUINO_ARCH_ESP32
// predefined global instance for IP only // predefined global instance for TP or IP
KnxFacade<Esp32Platform, Bau57B0> knx; #ifdef MEDIUM_TYPE
#if MEDIUM_TYPE == 0
KnxFacade<Esp32Platform, Bau07B0> knx;
#elif MEDIUM_TYPE == 5
KnxFacade<Esp32Platform, Bau57B0> knx;
#else
#error "Only TP and IP supported for Arduino ESP32 platform!"
#endif
#else
// Compatibility
KnxFacade<Esp32Platform, Bau57B0> knx;
//#error "No medium type specified for platform Arduino ESP32! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
#endif
#elif ARDUINO_ARCH_STM32 #elif ARDUINO_ARCH_STM32
KnxFacade<Stm32Platform, Bau07B0> knx; KnxFacade<Stm32Platform, Bau07B0> knx;
// no predefined global instance
#define ICACHE_RAM_ATTR
#elif __linux__ #elif __linux__
// no predefined global instance // no predefined global instance
#define ICACHE_RAM_ATTR
#endif #endif
#ifndef __linux__ #ifndef ICACHE_RAM_ATTR
uint32_t lastpressed=0; #define ICACHE_RAM_ATTR
#endif #endif
ICACHE_RAM_ATTR void buttonUp() ICACHE_RAM_ATTR void buttonUp()
{ {
#ifndef __linux__ #ifndef __linux__
static uint32_t lastpressed=0;
if (millis() - lastpressed > 200){ if (millis() - lastpressed > 200){
knx._toogleProgMode = true; knx._toogleProgMode = true;
lastpressed = millis(); lastpressed = millis();

View File

@ -17,6 +17,7 @@
#elif ARDUINO_ARCH_ESP32 #elif ARDUINO_ARCH_ESP32
#define LED_BUILTIN 13 #define LED_BUILTIN 13
#include "esp32_platform.h" #include "esp32_platform.h"
#include "knx/bau07B0.h"
#include "knx/bau57B0.h" #include "knx/bau57B0.h"
#elif ARDUINO_ARCH_STM32 #elif ARDUINO_ARCH_STM32
#include "stm32_platform.h" #include "stm32_platform.h"
@ -334,11 +335,21 @@ template <class P, class B> class KnxFacade : private SaveRestore
// predefined global instance for IP only // predefined global instance for IP only
extern KnxFacade<EspPlatform, Bau57B0> knx; extern KnxFacade<EspPlatform, Bau57B0> knx;
#elif ARDUINO_ARCH_ESP32 #elif ARDUINO_ARCH_ESP32
// predefined global instance for IP only // predefined global instance for TP or IP
extern KnxFacade<Esp32Platform, Bau57B0> knx; #ifdef MEDIUM_TYPE
#if MEDIUM_TYPE == 0
extern KnxFacade<Esp32Platform, Bau07B0> knx;
#elif MEDIUM_TYPE == 5
extern KnxFacade<Esp32Platform, Bau57B0> knx;
#else
#error "Only TP and IP supported for Arduino ESP32 platform!"
#endif
#else
#error "No medium type specified for Arduino ESP32 platform! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
#endif
#elif ARDUINO_ARCH_STM32 #elif ARDUINO_ARCH_STM32
// predefined global instance for TP only // predefined global instance for TP only
extern KnxFacade<Stm32Platform, Bau07B0> knx; extern KnxFacade<Stm32Platform, Bau07B0> knx;
#elif __linux__ #elif __linux__
// no predefined global instance // no predefined global instance
#endif #endif