From 74036bad070eef9a3313f4b4f105e57b65861bc6 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Sat, 17 Aug 2024 00:46:23 +0200 Subject: [PATCH] try to build less to reduce firmware sizes --- src/CMakeLists.txt | 2 +- src/knx/bau07B0.cpp | 2 + src/knx/bau091A.cpp | 2 + src/knx/bau27B0.cpp | 2 + src/knx/bau2920.cpp | 2 + src/knx/bau57B0.cpp | 2 + src/knx/bau_systemB_coupler.cpp | 2 + src/knx/bau_systemB_device.cpp | 2 + src/knx/bits.h | 12 +++-- src/knx/cemi_server.h | 4 -- src/knx/config.h | 51 ++++++++++++++++--- src/knx/ip/ip_data_link_layer.cpp | 4 ++ .../ip_host_protocol_address_information.cpp | 3 ++ src/knx/ip/ip_parameter_object.cpp | 3 ++ src/knx/ip/knx_ip_ch.cpp | 3 ++ src/knx/ip/knx_ip_config_dib.cpp | 3 ++ src/knx/ip/knx_ip_config_request.cpp | 3 ++ src/knx/ip/knx_ip_connect_request.cpp | 3 ++ src/knx/ip/knx_ip_connect_response.cpp | 3 ++ src/knx/ip/knx_ip_crd.cpp | 3 ++ src/knx/ip/knx_ip_cri.cpp | 3 ++ src/knx/ip/knx_ip_description_request.cpp | 3 ++ src/knx/ip/knx_ip_description_response.cpp | 3 ++ src/knx/ip/knx_ip_device_information_dib.cpp | 5 +- src/knx/ip/knx_ip_dib.cpp | 3 ++ src/knx/ip/knx_ip_disconnect_request.cpp | 3 ++ src/knx/ip/knx_ip_disconnect_response.cpp | 3 ++ ...knx_ip_extended_device_information_dib.cpp | 3 ++ src/knx/ip/knx_ip_frame.cpp | 3 ++ src/knx/ip/knx_ip_knx_addresses_dib.cpp | 3 ++ src/knx/ip/knx_ip_routing_indication.cpp | 3 ++ src/knx/ip/knx_ip_search_request.cpp | 3 ++ src/knx/ip/knx_ip_search_request_extended.cpp | 3 ++ src/knx/ip/knx_ip_search_response.cpp | 3 ++ .../ip/knx_ip_search_response_extended.cpp | 3 ++ src/knx/ip/knx_ip_state_request.cpp | 5 +- src/knx/ip/knx_ip_state_response.cpp | 3 ++ src/knx/ip/knx_ip_supported_service_dib.cpp | 3 ++ src/knx/ip/knx_ip_tunnel_connection.cpp | 3 ++ src/knx/ip/knx_ip_tunneling_ack.cpp | 3 ++ src/knx/ip/knx_ip_tunneling_info_dib.cpp | 3 ++ src/knx/ip/knx_ip_tunneling_request.cpp | 3 ++ src/knx/network_layer_coupler.cpp | 2 + src/knx/network_layer_device.cpp | 2 + src/knx/platform/esp32_platform.cpp | 2 +- src/knx/platform/esp_platform.cpp | 3 +- src/knx/platform/linux_platform.cpp | 3 +- src/knx/platform/rp2040_arduino_platform.cpp | 3 +- src/knx/platform/samd_platform.cpp | 2 +- src/knx/platform/stm32_platform.cpp | 2 +- src/knx/rf/rf_data_link_layer.cpp | 2 + src/knx/rf/rf_medium_object.cpp | 2 + src/knx/rf/rf_physical_layer_cc1101.cpp | 5 +- src/knx/rf/rf_physical_layer_cc1101.h | 2 +- src/knx/rf/rf_physical_layer_cc1310.cpp | 3 ++ src/knx/router_object.cpp | 2 + src/knx/secure_application_layer.cpp | 2 +- src/knx/tpuart_data_link_layer.cpp | 1 - 58 files changed, 190 insertions(+), 29 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9b10e84..902a33c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,4 +187,4 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas - add_library(knx ${SOURCES}) target_include_directories(knx PUBLIC .) set_property(TARGET knx PROPERTY CXX_STANDARD 11) -target_compile_definitions(knx PUBLIC -DUSE_RF -DUSE_USB -DUSE_CEMI_SERVER -DKNX_TUNNELING=1) +target_compile_definitions(knx PUBLIC -DUSE_RF -DUSE_USB -DUSE_TP -D_USE_IP -DUSE_CEMI_SERVER -DKNX_TUNNELING=1 -DUSE_DATASECURE -DALL_MASKS) diff --git a/src/knx/bau07B0.cpp b/src/knx/bau07B0.cpp index db6b85e..24145ba 100644 --- a/src/knx/bau07B0.cpp +++ b/src/knx/bau07B0.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if (MASK_VERSION == 0x07B0) || defined(ALL_MASKS) #include "bau07B0.h" #include "bits.h" @@ -174,3 +175,4 @@ TpUartDataLinkLayer* Bau07B0::getDataLinkLayer() { return (TpUartDataLinkLayer*)&_dlLayer; } +#endif \ No newline at end of file diff --git a/src/knx/bau091A.cpp b/src/knx/bau091A.cpp index 7847225..43aa91e 100644 --- a/src/knx/bau091A.cpp +++ b/src/knx/bau091A.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if MASK_VERSION == 0x091A || defined(ALL_MASKS) #include "bau091A.h" #include "bits.h" @@ -253,3 +254,4 @@ TpUartDataLinkLayer* Bau091A::getSecondaryDataLinkLayer() { return (TpUartDataLinkLayer*)&_dlLayerSecondary; } +#endif \ No newline at end of file diff --git a/src/knx/bau27B0.cpp b/src/knx/bau27B0.cpp index 769cc78..b2253da 100644 --- a/src/knx/bau27B0.cpp +++ b/src/knx/bau27B0.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if MASK_VERSION == 0x27B0 || defined(ALL_MASKS) #include "bau27B0.h" #include "bits.h" @@ -203,3 +204,4 @@ RfDataLinkLayer* Bau27B0::getDataLinkLayer() { return (RfDataLinkLayer*)&_dlLayer; } +#endif \ No newline at end of file diff --git a/src/knx/bau2920.cpp b/src/knx/bau2920.cpp index 6162480..e844ab4 100644 --- a/src/knx/bau2920.cpp +++ b/src/knx/bau2920.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if MASK_VERSION == 0x2920 || defined(ALL_MASKS) #include "bau2920.h" #include "bits.h" @@ -177,3 +178,4 @@ RfDataLinkLayer* Bau2920::getSecondaryDataLinkLayer() { return (RfDataLinkLayer*)&_dlLayerSecondary; } +#endif \ No newline at end of file diff --git a/src/knx/bau57B0.cpp b/src/knx/bau57B0.cpp index 145dc5d..609e503 100644 --- a/src/knx/bau57B0.cpp +++ b/src/knx/bau57B0.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if MASK_VERSION == 0x57B0 || defined(ALL_MASKS) #include "bau57B0.h" #include "bits.h" @@ -165,3 +166,4 @@ IpDataLinkLayer* Bau57B0::getDataLinkLayer() { return (IpDataLinkLayer*)&_dlLayer; } +#endif \ No newline at end of file diff --git a/src/knx/bau_systemB_coupler.cpp b/src/knx/bau_systemB_coupler.cpp index e71164f..2adfe0d 100644 --- a/src/knx/bau_systemB_coupler.cpp +++ b/src/knx/bau_systemB_coupler.cpp @@ -1,3 +1,4 @@ +#if ((MASK_VERSION != 0x07B0) && (MASK_VERSION != 0x27B0) && (MASK_VERSION != 0x57B0)) || defined(ALL_MASKS) #include "bau_systemB_coupler.h" #include "bits.h" #include @@ -58,3 +59,4 @@ void BauSystemBCoupler::doMasterReset(EraseCode eraseCode, uint8_t channel) _secIfObj.masterReset(eraseCode, channel); #endif } +#endif \ No newline at end of file diff --git a/src/knx/bau_systemB_device.cpp b/src/knx/bau_systemB_device.cpp index 872d677..3121543 100644 --- a/src/knx/bau_systemB_device.cpp +++ b/src/knx/bau_systemB_device.cpp @@ -1,3 +1,4 @@ +#if (MASK_VERSION == 0x07B0) || (MASK_VERSION == 0x27B0) || (MASK_VERSION == 0x57B0) || defined(ALL_MASKS) #include "bau_systemB_device.h" #include "bits.h" #include @@ -259,3 +260,4 @@ void BauSystemBDevice::groupValueWriteIndication(uint16_t asap, Priority priorit updateGroupObject(go, data, dataLength); } +#endif \ No newline at end of file diff --git a/src/knx/bits.h b/src/knx/bits.h index 3df8189..28d31e9 100644 --- a/src/knx/bits.h +++ b/src/knx/bits.h @@ -6,9 +6,15 @@ #if defined(__linux__) #include #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32) || defined (DeviceFamily_CC13X0) - #define getbyte(x,n) (*(((uint8_t*)&(x))+n)) - #define htons(x) ( (getbyte(x,0)<<8) | getbyte(x,1) ) - #define htonl(x) ( (getbyte(x,0)<<24) | (getbyte(x,1)<<16) | (getbyte(x,2)<<8) | getbyte(x,3) ) + #define htons(x) ( ((x)<< 8 & 0xFF00) | \ + ((x)>> 8 & 0x00FF) ) + #define ntohs(x) htons(x) + + #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \ + ((x)<< 8 & 0x00FF0000UL) | \ + ((x)>> 8 & 0x0000FF00UL) | \ + ((x)>>24 & 0x000000FFUL) ) + #define ntohl(x) htonl(x) #define ntohs(x) htons(x) #define ntohl(x) htonl(x) #endif diff --git a/src/knx/cemi_server.h b/src/knx/cemi_server.h index 2aac12b..2d2dd2d 100644 --- a/src/knx/cemi_server.h +++ b/src/knx/cemi_server.h @@ -29,9 +29,7 @@ class CemiServer CemiServer(BauSystemB& bau); void dataLinkLayer(DataLinkLayer& layer); -#ifdef KNX_TUNNELING void dataLinkLayerPrimary(DataLinkLayer& layer); -#endif // from data link layer // Only L_Data service @@ -56,9 +54,7 @@ class CemiServer void handleMReset(CemiFrame& frame); DataLinkLayer* _dataLinkLayer = nullptr; -#ifdef KNX_TUNNELING DataLinkLayer* _dataLinkLayerPrimary = nullptr; -#endif BauSystemB& _bau; #ifdef USE_USB UsbTunnelInterface _usbTunnelInterface; diff --git a/src/knx/config.h b/src/knx/config.h index cfeda57..83b6ae1 100644 --- a/src/knx/config.h +++ b/src/knx/config.h @@ -27,20 +27,55 @@ //#define MASK_VERSION 0x2920 // Data Linklayer Driver Options - - #if MASK_VERSION == 0x27B0 && !defined(USE_RF) - #define USE_RF + #if MASK_VERSION == 0x07B0 + #ifndef USE_IP + #define USE_IP + #endif #endif - #if MASK_VERSION == 0x2920 && !defined(USE_RF) - #define USE_RF + #if MASK_VERSION == 0x27B0 + #ifndef USE_RF + #define USE_RF + #endif + #endif + + #if MASK_VERSION == 0x57B0 + #ifndef USE_IP + #define USE_IP + #endif + #endif + + #if MASK_VERSION == 0x091A + #ifndef USE_TP + #define USE_TP + #endif + #ifndef USE_IP + #define USE_IP + #endif + #endif + + #if MASK_VERSION == 0x2920 + #ifndef USE_TP + #define USE_TP + #endif + #ifndef USE_RF + #define USE_RF + #endif #endif // cEMI options //#define USE_USB //#define USE_CEMI_SERVER - #if (defined(USE_USB) || defined(KNX_TUNNELING)) && !defined(USE_CEMI_SERVER) - #define USE_CEMI_SERVER + #if defined(USE_USB) || defined(KNX_TUNNELING) + #ifndef USE_CEMI_SERVER + #define USE_CEMI_SERVER + #endif + #endif + + #if defined(KNX_TUNNELING) + #ifndef USE_IP + #define USE_IP + #endif #endif // KNX Data Secure Options @@ -63,4 +98,4 @@ // (combined with other flags (HWSERIAL_NONE for stm32) - avoid allocation of RX/TX buffers for all serial lines) //#define KNX_NO_DEFAULT_UART -#endif +#endif \ No newline at end of file diff --git a/src/knx/ip/ip_data_link_layer.cpp b/src/knx/ip/ip_data_link_layer.cpp index 8b27ddd..92a91b6 100644 --- a/src/knx/ip/ip_data_link_layer.cpp +++ b/src/knx/ip/ip_data_link_layer.cpp @@ -1,3 +1,6 @@ +#include "../config.h" +#ifdef USE_IP + #include "ip_data_link_layer.h" #include "../bits.h" @@ -1184,3 +1187,4 @@ bool IpDataLinkLayer::isSendLimitReached() return false; } } +#endif \ No newline at end of file diff --git a/src/knx/ip/ip_host_protocol_address_information.cpp b/src/knx/ip/ip_host_protocol_address_information.cpp index 67c930f..4ae42e4 100644 --- a/src/knx/ip/ip_host_protocol_address_information.cpp +++ b/src/knx/ip/ip_host_protocol_address_information.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "ip_host_protocol_address_information.h" #include "../bits.h" @@ -45,3 +47,4 @@ void IpHostProtocolAddressInformation::ipPortNumber(uint16_t value) { pushWord(value, _data + 6); } +#endif \ No newline at end of file diff --git a/src/knx/ip/ip_parameter_object.cpp b/src/knx/ip/ip_parameter_object.cpp index 885adc8..0a112cb 100644 --- a/src/knx/ip/ip_parameter_object.cpp +++ b/src/knx/ip/ip_parameter_object.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "ip_parameter_object.h" #include "../bits.h" @@ -137,3 +139,4 @@ uint16_t* IpParameterObject::additionalIndivualAddresses(uint8_t& numAddresses) #endif return (uint16_t*) propertyData(PID_ADDITIONAL_INDIVIDUAL_ADDRESSES); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_ch.cpp b/src/knx/ip/knx_ip_ch.cpp index 29dd932..cd3b604 100644 --- a/src/knx/ip/knx_ip_ch.cpp +++ b/src/knx/ip/knx_ip_ch.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_ch.h" KnxIpCH::KnxIpCH(uint8_t* data) : _data(data) @@ -45,3 +47,4 @@ uint8_t KnxIpCH::status() const { return _data[3]; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_config_dib.cpp b/src/knx/ip/knx_ip_config_dib.cpp index 0a56f06..bda9ecf 100644 --- a/src/knx/ip/knx_ip_config_dib.cpp +++ b/src/knx/ip/knx_ip_config_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_config_dib.h" KnxIpConfigDIB::KnxIpConfigDIB(uint8_t* data, bool isCurrent) : KnxIpDIB(data) @@ -90,3 +92,4 @@ void KnxIpConfigDIB::info2(uint8_t addr) else _data[19] = addr; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_config_request.cpp b/src/knx/ip/knx_ip_config_request.cpp index eb9651e..727ee68 100644 --- a/src/knx/ip/knx_ip_config_request.cpp +++ b/src/knx/ip/knx_ip_config_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_config_request.h" KnxIpConfigRequest::KnxIpConfigRequest(uint8_t* data, uint16_t length) @@ -14,3 +16,4 @@ KnxIpCH& KnxIpConfigRequest::connectionHeader() { return _ch; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_connect_request.cpp b/src/knx/ip/knx_ip_connect_request.cpp index 9bfa436..9068149 100644 --- a/src/knx/ip/knx_ip_connect_request.cpp +++ b/src/knx/ip/knx_ip_connect_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_connect_request.h" KnxIpConnectRequest::KnxIpConnectRequest(uint8_t* data, uint16_t length) @@ -18,3 +20,4 @@ KnxIpCRI& KnxIpConnectRequest::cri() { return _cri; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_connect_response.cpp b/src/knx/ip/knx_ip_connect_response.cpp index 6d59480..cbaefdb 100644 --- a/src/knx/ip/knx_ip_connect_response.cpp +++ b/src/knx/ip/knx_ip_connect_response.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_connect_response.h" KnxIpConnectResponse::KnxIpConnectResponse(IpParameterObject& parameters, uint16_t address, uint16_t port, uint8_t channel, uint8_t type) @@ -40,3 +42,4 @@ KnxIpCRD& KnxIpConnectResponse::crd() { return _crd; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_crd.cpp b/src/knx/ip/knx_ip_crd.cpp index 044a6ad..f4157df 100644 --- a/src/knx/ip/knx_ip_crd.cpp +++ b/src/knx/ip/knx_ip_crd.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_crd.h" KnxIpCRD::KnxIpCRD(uint8_t* data) : _data(data) @@ -38,3 +40,4 @@ void KnxIpCRD::address(uint16_t value) _data[2] = value >> 8; _data[3] = value & 0xFF; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_cri.cpp b/src/knx/ip/knx_ip_cri.cpp index 6f2903e..7cb287f 100644 --- a/src/knx/ip/knx_ip_cri.cpp +++ b/src/knx/ip/knx_ip_cri.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_cri.h" KnxIpCRI::KnxIpCRI(uint8_t* data) : _data(data) @@ -35,3 +37,4 @@ void KnxIpCRI::layer(uint8_t value) { _data[2] = value; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_description_request.cpp b/src/knx/ip/knx_ip_description_request.cpp index 69d79eb..eb22ea3 100644 --- a/src/knx/ip/knx_ip_description_request.cpp +++ b/src/knx/ip/knx_ip_description_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_description_request.h" KnxIpDescriptionRequest::KnxIpDescriptionRequest(uint8_t* data, uint16_t length) @@ -10,3 +12,4 @@ IpHostProtocolAddressInformation& KnxIpDescriptionRequest::hpaiCtrl() { return _hpaiCtrl; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_description_response.cpp b/src/knx/ip/knx_ip_description_response.cpp index a59041d..473d1b5 100644 --- a/src/knx/ip/knx_ip_description_response.cpp +++ b/src/knx/ip/knx_ip_description_response.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_description_response.h" #define LEN_SERVICE_FAMILIES 2 @@ -68,3 +70,4 @@ KnxIpSupportedServiceDIB& KnxIpDescriptionResponse::supportedServices() { return _supportedServices; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_device_information_dib.cpp b/src/knx/ip/knx_ip_device_information_dib.cpp index 559c990..ccabf42 100644 --- a/src/knx/ip/knx_ip_device_information_dib.cpp +++ b/src/knx/ip/knx_ip_device_information_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_device_information_dib.h" #include "../bits.h" @@ -97,4 +99,5 @@ const uint8_t* KnxIpDeviceInformationDIB::friendlyName() const void KnxIpDeviceInformationDIB::friendlyName(const uint8_t* value) { pushByteArray(value, LEN_FRIENDLY_NAME, _data + 24); -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_dib.cpp b/src/knx/ip/knx_ip_dib.cpp index e469e2b..cd33567 100644 --- a/src/knx/ip/knx_ip_dib.cpp +++ b/src/knx/ip/knx_ip_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_dib.h" KnxIpDIB::KnxIpDIB(uint8_t* data) : _data(data) @@ -25,3 +27,4 @@ void KnxIpDIB::code(DescriptionTypeCode value) { _data[1] = value; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_disconnect_request.cpp b/src/knx/ip/knx_ip_disconnect_request.cpp index c990830..b59c5bd 100644 --- a/src/knx/ip/knx_ip_disconnect_request.cpp +++ b/src/knx/ip/knx_ip_disconnect_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_disconnect_request.h" KnxIpDisconnectRequest::KnxIpDisconnectRequest(uint8_t* data, uint16_t length) @@ -23,3 +25,4 @@ void KnxIpDisconnectRequest::channelId(uint8_t channelId) { _data[LEN_KNXIP_HEADER] = channelId; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_disconnect_response.cpp b/src/knx/ip/knx_ip_disconnect_response.cpp index 6121c7d..858f907 100644 --- a/src/knx/ip/knx_ip_disconnect_response.cpp +++ b/src/knx/ip/knx_ip_disconnect_response.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_disconnect_response.h" KnxIpDisconnectResponse::KnxIpDisconnectResponse(uint8_t channel, uint8_t status) @@ -8,3 +10,4 @@ KnxIpDisconnectResponse::KnxIpDisconnectResponse(uint8_t channel, uint8_t status _data[LEN_KNXIP_HEADER] = channel; _data[LEN_KNXIP_HEADER + 1] = status; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_extended_device_information_dib.cpp b/src/knx/ip/knx_ip_extended_device_information_dib.cpp index 40de5a7..50bcd4e 100644 --- a/src/knx/ip/knx_ip_extended_device_information_dib.cpp +++ b/src/knx/ip/knx_ip_extended_device_information_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_extended_device_information_dib.h" #include "../bits.h" @@ -38,3 +40,4 @@ void KnxIpExtendedDeviceInformationDIB::deviceDescriptor(uint16_t value) { pushWord(value, _data + 6); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_frame.cpp b/src/knx/ip/knx_ip_frame.cpp index 352901f..09643f1 100644 --- a/src/knx/ip/knx_ip_frame.cpp +++ b/src/knx/ip/knx_ip_frame.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_frame.h" #include @@ -76,3 +78,4 @@ KnxIpFrame::KnxIpFrame(uint16_t length) protocolVersion(KnxIp1_0); totalLength(length); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_knx_addresses_dib.cpp b/src/knx/ip/knx_ip_knx_addresses_dib.cpp index 8e55394..fb1c32e 100644 --- a/src/knx/ip/knx_ip_knx_addresses_dib.cpp +++ b/src/knx/ip/knx_ip_knx_addresses_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_knx_addresses_dib.h" KnxIpKnxAddressesDIB::KnxIpKnxAddressesDIB(uint8_t* data) : KnxIpDIB(data) @@ -23,3 +25,4 @@ void KnxIpKnxAddressesDIB::additional(uint16_t addr) currentPos += 2; length(currentPos - _data); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_routing_indication.cpp b/src/knx/ip/knx_ip_routing_indication.cpp index f9d2776..3c0666b 100644 --- a/src/knx/ip/knx_ip_routing_indication.cpp +++ b/src/knx/ip/knx_ip_routing_indication.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_routing_indication.h" #include @@ -18,3 +20,4 @@ KnxIpRoutingIndication::KnxIpRoutingIndication(CemiFrame frame) serviceTypeIdentifier(RoutingIndication); memcpy(_data + LEN_KNXIP_HEADER, frame.data(), frame.totalLenght()); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_search_request.cpp b/src/knx/ip/knx_ip_search_request.cpp index 7478c92..9f5b5a9 100644 --- a/src/knx/ip/knx_ip_search_request.cpp +++ b/src/knx/ip/knx_ip_search_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_search_request.h" KnxIpSearchRequest::KnxIpSearchRequest(uint8_t* data, uint16_t length) @@ -10,3 +12,4 @@ IpHostProtocolAddressInformation& KnxIpSearchRequest::hpai() { return _hpai; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_search_request_extended.cpp b/src/knx/ip/knx_ip_search_request_extended.cpp index 7c7e80b..35a037c 100644 --- a/src/knx/ip/knx_ip_search_request_extended.cpp +++ b/src/knx/ip/knx_ip_search_request_extended.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_search_request_extended.h" #include "../bits.h" #include "service_families.h" @@ -64,3 +66,4 @@ bool KnxIpSearchRequestExtended::requestedDIB(uint8_t code) return requestedDIBs[code]; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_search_response.cpp b/src/knx/ip/knx_ip_search_response.cpp index 6d91460..5f24cb8 100644 --- a/src/knx/ip/knx_ip_search_response.cpp +++ b/src/knx/ip/knx_ip_search_response.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_search_response.h" #define LEN_SERVICE_FAMILIES 2 @@ -80,3 +82,4 @@ KnxIpSupportedServiceDIB& KnxIpSearchResponse::supportedServices() { return _supportedServices; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_search_response_extended.cpp b/src/knx/ip/knx_ip_search_response_extended.cpp index db83559..878cd6e 100644 --- a/src/knx/ip/knx_ip_search_response_extended.cpp +++ b/src/knx/ip/knx_ip_search_response_extended.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_search_response_extended.h" #include "service_families.h" @@ -224,3 +226,4 @@ uint8_t* KnxIpSearchResponseExtended::DIBs() { return _data + LEN_KNXIP_HEADER + LEN_IPHPAI; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_state_request.cpp b/src/knx/ip/knx_ip_state_request.cpp index d162213..6ed6302 100644 --- a/src/knx/ip/knx_ip_state_request.cpp +++ b/src/knx/ip/knx_ip_state_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_state_request.h" KnxIpStateRequest::KnxIpStateRequest(uint8_t* data, uint16_t length) @@ -12,4 +14,5 @@ IpHostProtocolAddressInformation& KnxIpStateRequest::hpaiCtrl() uint8_t KnxIpStateRequest::channelId() { return _data[LEN_KNXIP_HEADER]; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_state_response.cpp b/src/knx/ip/knx_ip_state_response.cpp index 1006880..cacae34 100644 --- a/src/knx/ip/knx_ip_state_response.cpp +++ b/src/knx/ip/knx_ip_state_response.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_state_response.h" #define LEN_SERVICE_FAMILIES 2 @@ -22,3 +24,4 @@ KnxIpStateResponse::KnxIpStateResponse(uint8_t channelId, uint8_t errorCode) _data[LEN_KNXIP_HEADER] = channelId; _data[LEN_KNXIP_HEADER + 1] = errorCode; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_supported_service_dib.cpp b/src/knx/ip/knx_ip_supported_service_dib.cpp index 901964b..8c1e165 100644 --- a/src/knx/ip/knx_ip_supported_service_dib.cpp +++ b/src/knx/ip/knx_ip_supported_service_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_supported_service_dib.h" KnxIpSupportedServiceDIB::KnxIpSupportedServiceDIB(uint8_t* data) : KnxIpDIB(data) @@ -40,3 +42,4 @@ void KnxIpSupportedServiceDIB::serviceVersion(ServiceFamily family, uint8_t ver } } } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_tunnel_connection.cpp b/src/knx/ip/knx_ip_tunnel_connection.cpp index 9d4fe2a..fb9f342 100644 --- a/src/knx/ip/knx_ip_tunnel_connection.cpp +++ b/src/knx/ip/knx_ip_tunnel_connection.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_tunnel_connection.h" KnxIpTunnelConnection::KnxIpTunnelConnection() @@ -17,3 +19,4 @@ void KnxIpTunnelConnection::Reset() IndividualAddress = 0; IsConfig = false; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_tunneling_ack.cpp b/src/knx/ip/knx_ip_tunneling_ack.cpp index f29add1..31c67d4 100644 --- a/src/knx/ip/knx_ip_tunneling_ack.cpp +++ b/src/knx/ip/knx_ip_tunneling_ack.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_tunneling_ack.h" #include @@ -16,3 +18,4 @@ KnxIpCH& KnxIpTunnelingAck::connectionHeader() { return _ch; } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_tunneling_info_dib.cpp b/src/knx/ip/knx_ip_tunneling_info_dib.cpp index 9b0197a..e824db3 100644 --- a/src/knx/ip/knx_ip_tunneling_info_dib.cpp +++ b/src/knx/ip/knx_ip_tunneling_info_dib.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_tunneling_info_dib.h" #include "service_families.h" @@ -25,3 +27,4 @@ void KnxIpTunnelingInfoDIB::tunnelingSlot(uint16_t addr, uint16_t state) currentPos += 4; length(currentPos - _data); } +#endif \ No newline at end of file diff --git a/src/knx/ip/knx_ip_tunneling_request.cpp b/src/knx/ip/knx_ip_tunneling_request.cpp index 8beb249..31ed692 100644 --- a/src/knx/ip/knx_ip_tunneling_request.cpp +++ b/src/knx/ip/knx_ip_tunneling_request.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_IP #include "knx_ip_tunneling_request.h" #include @@ -22,3 +24,4 @@ KnxIpCH& KnxIpTunnelingRequest::connectionHeader() { return _ch; } +#endif \ No newline at end of file diff --git a/src/knx/network_layer_coupler.cpp b/src/knx/network_layer_coupler.cpp index 6583e83..1a9727a 100644 --- a/src/knx/network_layer_coupler.cpp +++ b/src/knx/network_layer_coupler.cpp @@ -1,3 +1,4 @@ +#if ((MASK_VERSION != 0x07B0) && (MASK_VERSION != 0x27B0) && (MASK_VERSION != 0x57B0)) || defined(ALL_MASKS) #include "network_layer_coupler.h" #include "data_link_layer.h" #include "device_object.h" @@ -653,4 +654,5 @@ bool NetworkLayerCoupler::isTunnelAddress(uint16_t destination) // tunnels are managed within the IpDataLinkLayer - kPrimaryIfIndex return _netLayerEntities[kPrimaryIfIndex].dataLinkLayer().isTunnelAddress(destination); } +#endif #endif \ No newline at end of file diff --git a/src/knx/network_layer_device.cpp b/src/knx/network_layer_device.cpp index 105003e..a24316f 100644 --- a/src/knx/network_layer_device.cpp +++ b/src/knx/network_layer_device.cpp @@ -1,3 +1,4 @@ +#if (MASK_VERSION == 0x07B0) || (MASK_VERSION == 0x27B0) || (MASK_VERSION == 0x57B0) || defined(ALL_MASKS) #include "network_layer_device.h" #include "device_object.h" #include "tpdu.h" @@ -148,3 +149,4 @@ void NetworkLayerDevice::systemBroadcastConfirm(AckType ack, FrameFormat format, HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter; _transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status); } +#endif \ No newline at end of file diff --git a/src/knx/platform/esp32_platform.cpp b/src/knx/platform/esp32_platform.cpp index d3e0620..63be3a7 100644 --- a/src/knx/platform/esp32_platform.cpp +++ b/src/knx/platform/esp32_platform.cpp @@ -1,6 +1,6 @@ +#ifdef ARDUINO_ARCH_ESP32 #include "esp32_platform.h" -#ifdef ARDUINO_ARCH_ESP32 #include #include diff --git a/src/knx/platform/esp_platform.cpp b/src/knx/platform/esp_platform.cpp index 504ccbd..83a3586 100644 --- a/src/knx/platform/esp_platform.cpp +++ b/src/knx/platform/esp_platform.cpp @@ -1,6 +1,7 @@ +#ifdef ARDUINO_ARCH_ESP8266 #include "esp_platform.h" -#ifdef ARDUINO_ARCH_ESP8266 + #include #include #include diff --git a/src/knx/platform/linux_platform.cpp b/src/knx/platform/linux_platform.cpp index ad8213f..2ba4866 100644 --- a/src/knx/platform/linux_platform.cpp +++ b/src/knx/platform/linux_platform.cpp @@ -1,5 +1,6 @@ -#include "linux_platform.h" #ifdef __linux__ +#include "linux_platform.h" + #include #include #include diff --git a/src/knx/platform/rp2040_arduino_platform.cpp b/src/knx/platform/rp2040_arduino_platform.cpp index 44ae730..95016c2 100644 --- a/src/knx/platform/rp2040_arduino_platform.cpp +++ b/src/knx/platform/rp2040_arduino_platform.cpp @@ -22,10 +22,9 @@ For usage of KNX-IP you have to define either - KNX_IP_WIFI (use the arduino-pico core's PiPicoW lwip stack) ----------------------------------------------------*/ - +#ifdef ARDUINO_ARCH_RP2040 #include "rp2040_arduino_platform.h" -#ifdef ARDUINO_ARCH_RP2040 #include "knx/bits.h" #include diff --git a/src/knx/platform/samd_platform.cpp b/src/knx/platform/samd_platform.cpp index ce26b84..8223745 100644 --- a/src/knx/platform/samd_platform.cpp +++ b/src/knx/platform/samd_platform.cpp @@ -1,6 +1,6 @@ +#ifdef ARDUINO_ARCH_SAMD #include "samd_platform.h" -#ifdef ARDUINO_ARCH_SAMD #include #include diff --git a/src/knx/platform/stm32_platform.cpp b/src/knx/platform/stm32_platform.cpp index 6e55ea4..aae418a 100644 --- a/src/knx/platform/stm32_platform.cpp +++ b/src/knx/platform/stm32_platform.cpp @@ -1,6 +1,6 @@ +#ifdef ARDUINO_ARCH_STM32 #include "stm32_platform.h" -#ifdef ARDUINO_ARCH_STM32 #include #include "knx/bits.h" diff --git a/src/knx/rf/rf_data_link_layer.cpp b/src/knx/rf/rf_data_link_layer.cpp index 33a1e27..22c0c9f 100644 --- a/src/knx/rf/rf_data_link_layer.cpp +++ b/src/knx/rf/rf_data_link_layer.cpp @@ -1,4 +1,5 @@ #include "../config.h" +#ifdef USE_RF #if defined(DeviceFamily_CC13X0) #include "rf_physical_layer_cc1310.h" @@ -380,3 +381,4 @@ void RfDataLinkLayer::loadNextTxFrame(uint8_t** sendBuffer, uint16_t* sendBuffer delete tx_frame; } +#endif \ No newline at end of file diff --git a/src/knx/rf/rf_medium_object.cpp b/src/knx/rf/rf_medium_object.cpp index 3ea8c4e..94c5cde 100644 --- a/src/knx/rf/rf_medium_object.cpp +++ b/src/knx/rf/rf_medium_object.cpp @@ -1,4 +1,5 @@ #include "../config.h" +#ifdef USE_RF #include #include "rf_medium_object.h" @@ -56,3 +57,4 @@ void RfMediumObject::rfDomainAddress(const uint8_t* value) Property* prop = property(PID_RF_DOMAIN_ADDRESS); prop->write(value); } +#endif \ No newline at end of file diff --git a/src/knx/rf/rf_physical_layer_cc1101.cpp b/src/knx/rf/rf_physical_layer_cc1101.cpp index 381adc0..94608ba 100644 --- a/src/knx/rf/rf_physical_layer_cc1101.cpp +++ b/src/knx/rf/rf_physical_layer_cc1101.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_RF #ifndef DeviceFamily_CC13X0 #include "rf_physical_layer_cc1101.h" @@ -777,4 +779,5 @@ void RfPhysicalLayerCC1101::loop() } } -#endif // DeviceFamily_CC13X0 \ No newline at end of file +#endif // DeviceFamily_CC13X0 +#endif \ No newline at end of file diff --git a/src/knx/rf/rf_physical_layer_cc1101.h b/src/knx/rf/rf_physical_layer_cc1101.h index 43adf11..c8679a4 100644 --- a/src/knx/rf/rf_physical_layer_cc1101.h +++ b/src/knx/rf/rf_physical_layer_cc1101.h @@ -122,7 +122,7 @@ #define VERSION 0xF1 // Current version number #define FREQEST 0xF2 // Frequency offset estimate #define LQI 0xF3 // Demodulator estimate for link quality -#define RSSI 0xF4 // Received signal strength indication +#define RF_RSSI 0xF4 // Received signal strength indication #define MARCSTATE 0xF5 // Control state machine state #define WORTIME1 0xF6 // High byte of WOR timer #define WORTIME0 0xF7 // Low byte of WOR timer diff --git a/src/knx/rf/rf_physical_layer_cc1310.cpp b/src/knx/rf/rf_physical_layer_cc1310.cpp index 3f8f82c..f52e33a 100644 --- a/src/knx/rf/rf_physical_layer_cc1310.cpp +++ b/src/knx/rf/rf_physical_layer_cc1310.cpp @@ -1,3 +1,5 @@ +#include "../config.h" +#ifdef USE_RF #ifdef DeviceFamily_CC13X0 @@ -371,3 +373,4 @@ void RfPhysicalLayerCC1310::loop() } #endif // DeviceFamily_CC13X0 +#endif \ No newline at end of file diff --git a/src/knx/router_object.cpp b/src/knx/router_object.cpp index 36ebb3a..00e46c6 100644 --- a/src/knx/router_object.cpp +++ b/src/knx/router_object.cpp @@ -1,4 +1,5 @@ #include "config.h" +#if ((MASK_VERSION != 0x07B0) && (MASK_VERSION != 0x27B0) && (MASK_VERSION != 0x57B0)) || defined(ALL_MASKS) #include #include "router_object.h" @@ -601,3 +602,4 @@ bool RouterObject::isGroupAddressInFilterTable(uint16_t groupAddress) return false; } +#endif \ No newline at end of file diff --git a/src/knx/secure_application_layer.cpp b/src/knx/secure_application_layer.cpp index 315f5cc..99388d1 100644 --- a/src/knx/secure_application_layer.cpp +++ b/src/knx/secure_application_layer.cpp @@ -17,7 +17,7 @@ #define CBC 1 #define CTR 1 #define ECB 0 -#include "aes.hpp" +#include "util/aes.hpp" static constexpr uint8_t kSecureDataPdu = 0; static constexpr uint8_t kSecureSyncRequest = 2; diff --git a/src/knx/tpuart_data_link_layer.cpp b/src/knx/tpuart_data_link_layer.cpp index b0a8925..c96e9e8 100644 --- a/src/knx/tpuart_data_link_layer.cpp +++ b/src/knx/tpuart_data_link_layer.cpp @@ -1,4 +1,3 @@ -#include "config.h" #pragma GCC optimize("O3") #include "address_table_object.h"