-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathknx_facade.cpp
85 lines (75 loc) · 3.12 KB
/
knx_facade.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "knx_facade.h"
#include "knx/bits.h"
#ifndef KNX_NO_AUTOMATIC_GLOBAL_INSTANCE
#if (defined(ARDUINO_ARCH_STM32) || \
defined(ARDUINO_ARCH_ESP32) || \
defined(ARDUINO_ARCH_ESP8266) || \
defined(ARDUINO_ARCH_SAMD) || \
defined(ARDUINO_ARCH_RP2040))
// Only ESP8266 and ESP32 have this define. For all other platforms this is just empty.
#ifndef ICACHE_RAM_ATTR
#define ICACHE_RAM_ATTR
#endif
ICACHE_RAM_ATTR void buttonUp()
{
static uint32_t lastpressed=0;
if (millis() - lastpressed > 200){
knx.toggleProgMode();
lastpressed = millis();
}
}
#endif
#ifdef ARDUINO_ARCH_SAMD
// predefined global instance for TP or RF or TP/RF coupler
#if MASK_VERSION == 0x07B0
KnxFacade<SamdPlatform, Bau07B0> knx(buttonUp);
#elif MASK_VERSION == 0x27B0
KnxFacade<SamdPlatform, Bau27B0> knx(buttonUp);
#elif MASK_VERSION == 0x2920
KnxFacade<SamdPlatform, Bau2920> knx(buttonUp);
#else
#error "Mask version not supported on ARDUINO_ARCH_SAMD"
#endif
#elif defined(ARDUINO_ARCH_RP2040)
// predefined global instance for TP or RF or TP/RF coupler
#if MASK_VERSION == 0x07B0
KnxFacade<RP2040ArduinoPlatform, Bau07B0> knx(buttonUp);
#elif MASK_VERSION == 0x27B0
KnxFacade<RP2040ArduinoPlatform, Bau27B0> knx(buttonUp);
#elif MASK_VERSION == 0x2920
KnxFacade<RP2040ArduinoPlatform, Bau2920> knx(buttonUp);
#else
#error "Mask version not supported on ARDUINO_ARCH_RP2040"
#endif
#elif defined(ARDUINO_ARCH_ESP8266)
// predefined global instance for TP or IP or TP/IP coupler
#if MASK_VERSION == 0x07B0
KnxFacade<EspPlatform, Bau07B0> knx(buttonUp);
#elif MASK_VERSION == 0x57B0
KnxFacade<EspPlatform, Bau57B0> knx(buttonUp);
#elif MASK_VERSION == 0x091A
KnxFacade<EspPlatform, Bau091A> knx(buttonUp);
#else
#error "Mask version not supported on ARDUINO_ARCH_ESP8266"
#endif
#elif defined(ARDUINO_ARCH_ESP32)
// predefined global instance for TP or IP or TP/IP coupler
#if MASK_VERSION == 0x07B0
KnxFacade<Esp32Platform, Bau07B0> knx(buttonUp);
#elif MASK_VERSION == 0x57B0
KnxFacade<Esp32Platform, Bau57B0> knx(buttonUp);
#elif MASK_VERSION == 0x091A
KnxFacade<Esp32Platform, Bau091A> knx(buttonUp);
#else
#error "Mask version not supported on ARDUINO_ARCH_ESP32"
#endif
#elif defined(ARDUINO_ARCH_STM32)
#if MASK_VERSION == 0x07B0
KnxFacade<Stm32Platform, Bau07B0> knx(buttonUp);
#else
#error "Mask version not supported on ARDUINO_ARCH_STM32"
#endif
#else // Non-Arduino platforms and Linux platform
// no predefined global instance
#endif
#endif // KNX_NO_AUTOMATIC_GLOBAL_INSTANCE