mirror of
https://github.com/thelsing/knx.git
synced 2025-08-17 13:47:28 +02:00
Use MASK_VERSION to conditionally compile code.
This commit is contained in:
parent
7b82948736
commit
fd46e0daea
@ -1,10 +1,11 @@
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x07B0
|
||||
|
||||
#include "bau07B0.h"
|
||||
#include "bits.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_TP
|
||||
|
||||
using namespace std;
|
||||
|
||||
Bau07B0::Bau07B0(Platform& platform)
|
||||
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x07B0
|
||||
|
||||
#include "bau_systemB_device.h"
|
||||
#include "tpuart_data_link_layer.h"
|
||||
#include "cemi_server.h"
|
||||
#include "cemi_server_object.h"
|
||||
|
||||
#ifdef USE_TP
|
||||
|
||||
class Bau07B0 : public BauSystemBDevice, public ITpUartCallBacks
|
||||
{
|
||||
public:
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x091A
|
||||
|
||||
#include "bau091A.h"
|
||||
#include "bits.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(USE_IP) && defined (USE_TP)
|
||||
|
||||
using namespace std;
|
||||
|
||||
Bau091A::Bau091A(Platform& platform)
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#if defined(USE_IP) && defined (USE_TP)
|
||||
#if MASK_VERSION == 0x091A
|
||||
|
||||
#include "bau_systemB_coupler.h"
|
||||
#include "router_object.h"
|
||||
#include "ip_parameter_object.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x27B0
|
||||
|
||||
#include "bau27B0.h"
|
||||
#ifdef USE_RF
|
||||
#include "bits.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_RF
|
||||
#if MASK_VERSION == 0x27B0
|
||||
|
||||
#include "bau_systemB_device.h"
|
||||
#include "rf_medium_object.h"
|
||||
#include "rf_physical_layer.h"
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x2920
|
||||
|
||||
#include "bau2920.h"
|
||||
#include "bits.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(USE_TP) && defined (USE_RF)
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Mask 0x2920 uses coupler model 2.0
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#if defined(USE_TP) && defined (USE_RF)
|
||||
#if MASK_VERSION == 0x2920
|
||||
|
||||
#include "bau_systemB_coupler.h"
|
||||
#include "tpuart_data_link_layer.h"
|
||||
#include "rf_physical_layer.h"
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
#if MASK_VERSION == 0x57B0
|
||||
|
||||
#include "bau57B0.h"
|
||||
#include "bits.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_IP
|
||||
|
||||
using namespace std;
|
||||
|
||||
Bau57B0::Bau57B0(Platform& platform)
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_IP
|
||||
#if MASK_VERSION == 0x57B0
|
||||
|
||||
#include "bau_systemB_device.h"
|
||||
#include "ip_parameter_object.h"
|
||||
#include "ip_data_link_layer.h"
|
||||
|
@ -13,25 +13,55 @@
|
||||
#endif
|
||||
|
||||
// Normal devices
|
||||
// TP1: 0x07B0
|
||||
// RF: 0x27B0
|
||||
// IP: 0x57B0
|
||||
//#define MASK_VERSION 0x07B0
|
||||
//#define MASK_VERSION 0x27B0
|
||||
//#define MASK_VERSION 0x57B0
|
||||
|
||||
// Couplers
|
||||
// 0x091A: IP/TP1
|
||||
// 0x2920: TP1/RF
|
||||
// IP/TP1: 0x091A
|
||||
// TP1/RF: 0x2920
|
||||
//#define MASK_VERSION 0x091A
|
||||
//#define MASK_VERSION 0x2920
|
||||
|
||||
// Data Linklayer Driver Options
|
||||
#if MASK_VERSION == 0x07B0
|
||||
#define USE_TP
|
||||
#endif
|
||||
|
||||
#if MASK_VERSION == 0x27B0
|
||||
#define USE_RF
|
||||
#endif
|
||||
|
||||
#if MASK_VERSION == 0x57B0
|
||||
#define USE_IP
|
||||
#endif
|
||||
|
||||
#if MASK_VERSION == 0x091A
|
||||
#define USE_TP
|
||||
#define USE_IP
|
||||
#endif
|
||||
|
||||
#if MASK_VERSION == 0x2920
|
||||
#define USE_TP
|
||||
#define USE_RF
|
||||
#endif
|
||||
|
||||
// cEMI options
|
||||
//#define USE_USB
|
||||
//#define USE_CEMI_SERVER
|
||||
#ifdef USE_USB
|
||||
#define USE_CEMI_SERVER
|
||||
#endif
|
||||
|
||||
// KNX Data Secure Options
|
||||
#define USE_DATASECURE
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(MASK_VERSION)
|
||||
#error MASK_VERSION must be defined! See config.j for possible values!
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "ip_data_link_layer.h"
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_IP
|
||||
|
||||
#include "ip_data_link_layer.h"
|
||||
|
||||
#include "bits.h"
|
||||
#include "platform.h"
|
||||
#include "device_object.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_IP
|
||||
|
||||
#include <stdint.h>
|
||||
#include "data_link_layer.h"
|
||||
#include "ip_parameter_object.h"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "config.h"
|
||||
#ifdef USE_RF
|
||||
|
||||
#include <cstring>
|
||||
#include "rf_medium_object.h"
|
||||
#include "bits.h"
|
||||
#include "data_property.h"
|
||||
#include "function_property.h"
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_RF
|
||||
|
||||
RfMediumObject::RfMediumObject()
|
||||
{
|
||||
uint8_t rfDomainAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // see KNX RF S-Mode AN160 p.11
|
||||
@ -57,4 +57,4 @@ void RfMediumObject::rfDomainAddress(const uint8_t* value)
|
||||
Property* prop = property(PID_RF_DOMAIN_ADDRESS);
|
||||
prop->write(value);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#ifdef USE_RF
|
||||
|
||||
#include "interface_object.h"
|
||||
|
||||
class RfMediumObject: public InterfaceObject
|
||||
@ -15,4 +16,4 @@ private:
|
||||
uint8_t _rfDiagSourceAddressFilterTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
|
||||
uint8_t _rfDiagLinkBudgetTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "tpuart_data_link_layer.h"
|
||||
#include "config.h"
|
||||
#ifdef USE_TP
|
||||
|
||||
#include "tpuart_data_link_layer.h"
|
||||
#include "bits.h"
|
||||
#include "platform.h"
|
||||
#include "device_object.h"
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_TP
|
||||
|
||||
#include <stdint.h>
|
||||
#include "data_link_layer.h"
|
||||
|
||||
|
@ -3,11 +3,13 @@
|
||||
#include "knx/bits.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAMD
|
||||
// predefined global instance for TP or RF
|
||||
// predefined global instance for TP or RF or TP/RF coupler
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<SamdPlatform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x27B0
|
||||
KnxFacade<SamdPlatform, Bau27B0> knx;
|
||||
#elif MASK_VERSION == 0x2920
|
||||
KnxFacade<SamdPlatform, Bau2920> knx;
|
||||
#else
|
||||
#error Mask version not supported on ARDUINO_ARCH_SAMD
|
||||
#endif
|
||||
@ -21,11 +23,13 @@
|
||||
#endif
|
||||
|
||||
#elif ARDUINO_ARCH_ESP32
|
||||
// predefined global instance for TP or IP
|
||||
// predefined global instance for TP or IP or TP/IP coupler
|
||||
#if MASK_VERSION == 0x07B0
|
||||
KnxFacade<Esp32Platform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x57B0
|
||||
KnxFacade<Esp32Platform, Bau57B0> knx;
|
||||
#elif MASK_VERSION == 0x091A
|
||||
KnxFacade<Esp32Platform, Bau091A> knx;
|
||||
#else
|
||||
#error Mask version not supported on ARDUINO_ARCH_ESP8266
|
||||
#endif
|
||||
|
@ -318,11 +318,13 @@ template <class P, class B> class KnxFacade : private SaveRestore
|
||||
};
|
||||
|
||||
#ifdef ARDUINO_ARCH_SAMD
|
||||
// predefined global instance for TP or RF
|
||||
// predefined global instance for TP or RF or TP/RF coupler
|
||||
#if MASK_VERSION == 0x07B0
|
||||
extern KnxFacade<SamdPlatform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x27B0
|
||||
extern KnxFacade<SamdPlatform, Bau27B0> knx;
|
||||
#elif MASK_VERSION == 0x2920
|
||||
extern KnxFacade<SamdPlatform, Bau2920> knx;
|
||||
#else
|
||||
#error "Mask version not supported on ARDUINO_ARCH_SAMD"
|
||||
#endif
|
||||
@ -334,11 +336,13 @@ template <class P, class B> class KnxFacade : private SaveRestore
|
||||
#error "Mask version not supported on ARDUINO_ARCH_ESP8266"
|
||||
#endif
|
||||
#elif ARDUINO_ARCH_ESP32
|
||||
// predefined global instance for TP or IP
|
||||
// predefined global instance for TP or IP or TP/IP coupler
|
||||
#if MASK_VERSION == 0x07B0
|
||||
extern KnxFacade<Esp32Platform, Bau07B0> knx;
|
||||
#elif MASK_VERSION == 0x57B0
|
||||
extern KnxFacade<Esp32Platform, Bau57B0> knx;
|
||||
#elif MASK_VERSION == 0x091A
|
||||
extern KnxFacade<Esp32Platform, Bau091A> knx;
|
||||
#else
|
||||
#error "Mask version not supported on ARDUINO_ARCH_ESP32"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user