mirror of
https://github.com/thelsing/knx.git
synced 2025-08-22 13:46:21 +02:00
Remove MEDIUM_TYPE and use MASK_VERSION
This commit is contained in:
parent
dd4bae581f
commit
cd0bce0c20
@ -134,4 +134,3 @@ include_directories(../../src)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -g -O0")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -g -O0")
|
||||
set_property(TARGET knx-linux PROPERTY CXX_STANDARD 11)
|
||||
add_definitions(-DMEDIUM_TYPE=5)
|
||||
|
@ -30,13 +30,9 @@ bool isSendHidReportPossible()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if MEDIUM_TYPE == 5
|
||||
|
||||
KnxFacade<LinuxPlatform, Bau091A> knx;
|
||||
#elif MEDIUM_TYPE == 2
|
||||
KnxFacade<LinuxPlatform, Bau2920> knx;
|
||||
#else
|
||||
#error Only MEDIUM_TYPE IP and RF supported
|
||||
#endif
|
||||
//KnxFacade<LinuxPlatform, Bau2920> knx;
|
||||
|
||||
void appLoop()
|
||||
{
|
||||
|
@ -134,4 +134,4 @@ include_directories(../../src)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -g -O0")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -g -O0")
|
||||
set_property(TARGET knx-linux PROPERTY CXX_STANDARD 11)
|
||||
add_definitions(-DMEDIUM_TYPE=5)
|
||||
|
||||
|
@ -12,7 +12,17 @@
|
||||
#define GPIO_GDO0_PIN 24 // GPIO 24 (GPIO_GEN5) -> WiringPi: 5 -> Pin number on header: 18
|
||||
#endif
|
||||
|
||||
//#define MEDIUM_TYPE 2
|
||||
// Normal devices
|
||||
#define MASK_VERSION 0x07B0
|
||||
//#define MASK_VERSION 0x02B0
|
||||
//#define MASK_VERSION 0x05B0
|
||||
|
||||
// Couplers
|
||||
// 0x091A: IP/TP1
|
||||
// 0x29B0: TP1/RF
|
||||
//#define MASK_VERSION 0x091A
|
||||
//#define MASK_VERSION 0x29B0
|
||||
|
||||
#define USE_RF
|
||||
#define USE_TP
|
||||
#define USE_IP
|
||||
|
@ -128,12 +128,7 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
|
||||
frame.addressType(addrType);
|
||||
frame.priority(priority);
|
||||
frame.repetition(RepititionAllowed);
|
||||
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
|
||||
// Make sure to always send as normal Broadcast on closed media (TP and IP)
|
||||
frame.systemBroadcast(Broadcast);
|
||||
#else
|
||||
frame.systemBroadcast(systemBroadcast);
|
||||
#endif
|
||||
|
||||
if (npdu.octetCount() <= 15)
|
||||
frame.frameType(StandardFrame);
|
||||
|
@ -4,37 +4,38 @@
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAMD
|
||||
// predefined global instance for TP or RF
|
||||
#ifdef MEDIUM_TYPE
|
||||
#if MEDIUM_TYPE == 0
|
||||
KnxFacade<SamdPlatform, Bau07B0> knx;
|
||||
#elif MEDIUM_TYPE == 2
|
||||
KnxFacade<SamdPlatform, Bau27B0> knx;
|
||||
#else
|
||||
#error "Only TP and RF supported for Arduino SAMD platform!"
|
||||
#endif
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<SamdPlatform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x27B0
|
||||
KnxFacade<SamdPlatform, Bau27B0> knx;
|
||||
#else
|
||||
#error "No medium type specified for platform Arduino_SAMD! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
|
||||
#error Mask version not supported on ARDUINO_ARCH_SAMD
|
||||
#endif
|
||||
|
||||
#elif ARDUINO_ARCH_ESP8266
|
||||
// predefined global instance for IP only
|
||||
KnxFacade<EspPlatform, Bau57B0> knx;
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<EspPlatform, Bau57B0> knx;
|
||||
#else
|
||||
#error Mask version not supported on ARDUINO_ARCH_ESP8266
|
||||
#endif
|
||||
|
||||
#elif ARDUINO_ARCH_ESP32
|
||||
// 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
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<Esp32Platform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x57B0
|
||||
KnxFacade<Esp32Platform, Bau57B0> knx;
|
||||
//#error "No medium type specified for platform Arduino ESP32! Please set MEDIUM_TYPE! (TP:0, RF:2, IP:5)"
|
||||
#else
|
||||
#error Mask version not supported on ARDUINO_ARCH_ESP8266
|
||||
#endif
|
||||
|
||||
#elif ARDUINO_ARCH_STM32
|
||||
KnxFacade<Stm32Platform, Bau07B0> knx;
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<Stm32Platform, Bau07B0> knx;
|
||||
#else
|
||||
#error Mask version not supported on ARDUINO_ARCH_STM32
|
||||
#endif
|
||||
#elif __linux__
|
||||
// no predefined global instance
|
||||
#endif
|
||||
|
@ -2,10 +2,6 @@
|
||||
|
||||
#include "knx/bits.h"
|
||||
#include "knx/config.h"
|
||||
// Set default medium type to TP if no external definitions was given
|
||||
#ifndef MEDIUM_TYPE
|
||||
#define MEDIUM_TYPE 0
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAMD
|
||||
#include "samd_platform.h"
|
||||
@ -27,6 +23,7 @@
|
||||
#include "linux_platform.h"
|
||||
#include "knx/bau57B0.h"
|
||||
#include "knx/bau27B0.h"
|
||||
#include "knx/bau07B0.h"
|
||||
#include "knx/bau091A.h"
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user