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
#error "No medium type specified for platform Arduino_SAMD! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
#endif
#define ICACHE_RAM_ATTR
#elif ARDUINO_ARCH_ESP8266
// predefined global instance for IP only
KnxFacade<EspPlatform, Bau57B0> knx;
#elif ARDUINO_ARCH_ESP32
// predefined global instance for IP only
// predefined global instance for TP or IP
#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
KnxFacade<Stm32Platform, Bau07B0> knx;
// no predefined global instance
#define ICACHE_RAM_ATTR
#elif __linux__
// no predefined global instance
#define ICACHE_RAM_ATTR
#endif
#ifndef __linux__
uint32_t lastpressed=0;
#ifndef ICACHE_RAM_ATTR
#define ICACHE_RAM_ATTR
#endif
ICACHE_RAM_ATTR void buttonUp()
{
#ifndef __linux__
static uint32_t lastpressed=0;
if (millis() - lastpressed > 200){
knx._toogleProgMode = true;
lastpressed = millis();

View File

@ -17,6 +17,7 @@
#elif ARDUINO_ARCH_ESP32
#define LED_BUILTIN 13
#include "esp32_platform.h"
#include "knx/bau07B0.h"
#include "knx/bau57B0.h"
#elif ARDUINO_ARCH_STM32
#include "stm32_platform.h"
@ -334,8 +335,18 @@ template <class P, class B> class KnxFacade : private SaveRestore
// predefined global instance for IP only
extern KnxFacade<EspPlatform, Bau57B0> knx;
#elif ARDUINO_ARCH_ESP32
// predefined global instance for IP only
// predefined global instance for TP or IP
#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
// predefined global instance for TP only
extern KnxFacade<Stm32Platform, Bau07B0> knx;