diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index 91722d72bf96b8..3f4c4f0c458346 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -25,6 +25,8 @@ include(${CHIP_ROOT}/config/nrfconnect/app/app.cmake) project(chip-nrf52840-lighting-example) +zephyr_compile_options(-Werror) + target_include_directories(app PRIVATE main/include ${LIGHTING_COMMON} diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 51682ef7f0cd43..3554526eeac0d7 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -25,6 +25,8 @@ include(${CHIP_ROOT}/config/nrfconnect/app/app.cmake) project(chip-nrf52840-lock-example) +zephyr_compile_options(-Werror) + target_include_directories(app PRIVATE main/include ${LOCK_COMMON} diff --git a/examples/pigweed-app/nrfconnect/CMakeLists.txt b/examples/pigweed-app/nrfconnect/CMakeLists.txt index bc457bf6811b23..84b22eb3f7e379 100644 --- a/examples/pigweed-app/nrfconnect/CMakeLists.txt +++ b/examples/pigweed-app/nrfconnect/CMakeLists.txt @@ -27,6 +27,8 @@ include(${CHIP_ROOT}/config/nrfconnect/app/app.cmake) project(chip-nrf52840-pigweed-example) +zephyr_compile_options(-Werror) + target_include_directories(app PRIVATE main/include ${NRFCONNECT_COMMON}/util/include ${PIGWEED_ROOT}/pw_sys_io/public diff --git a/examples/shell/nrfconnect/CMakeLists.txt b/examples/shell/nrfconnect/CMakeLists.txt index f61689dfe3daa3..780a4c21635b9c 100644 --- a/examples/shell/nrfconnect/CMakeLists.txt +++ b/examples/shell/nrfconnect/CMakeLists.txt @@ -24,6 +24,8 @@ include(${CHIP_ROOT}/config/nrfconnect/app/app.cmake) project(chip-nrf52840-shell-example) +zephyr_compile_options(-Werror) + target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${APP_ROOT}/shell_common/include) diff --git a/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp b/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp index 79bc107008e4d0..ce82441880f95f 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp @@ -158,7 +158,7 @@ bool emberAfDoorLockClusterSetWeekdayScheduleCallback(uint8_t scheduleId, uint16 emberAfReadServerAttribute(DOOR_LOCK_SERVER_ENDPOINT, ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_RF_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID, (uint8_t *) &rfProgrammingEventMask, sizeof(rfProgrammingEventMask)); - if (rfProgrammingEventMask & BIT(0)) + if (rfProgrammingEventMask & EMBER_BIT(0)) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID, "uuvsuuws", 0x01, 0x00, userId, &userPin, 0x00, diff --git a/src/app/clusters/door-lock-server/door-lock-server-user.cpp b/src/app/clusters/door-lock-server/door-lock-server-user.cpp index 2c378ccabfe3eb..6218ab0a740271 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-user.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server-user.cpp @@ -281,7 +281,7 @@ bool emberAfDoorLockClusterSetPinCallback(uint16_t userId, uint8_t userStatus, u uint16_t rfProgrammingEventMask = 0xffff; // send event by default emberAfReadServerAttribute(DOOR_LOCK_SERVER_ENDPOINT, ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_RF_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID, (uint8_t *) &rfProgrammingEventMask, sizeof(rfProgrammingEventMask)); - if ((rfProgrammingEventMask & BIT(2)) && !status && (pin != NULL)) + if ((rfProgrammingEventMask & EMBER_BIT(2)) && !status && (pin != NULL)) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID, "uuvsuuws", EMBER_ZCL_DOOR_LOCK_EVENT_SOURCE_RF, @@ -350,14 +350,14 @@ bool emberAfDoorLockClusterClearPinCallback(uint16_t userId) uint8_t userPin = 0x00; // Zero length Zigbee string emberAfReadServerAttribute(DOOR_LOCK_SERVER_ENDPOINT, ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_RF_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID, (uint8_t *) &rfProgrammingEventMask, sizeof(rfProgrammingEventMask)); - if ((rfProgrammingEventMask & BIT(2)) && !status) + if ((rfProgrammingEventMask & EMBER_BIT(2)) && !status) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID, "uuvsuuws", 0x01, 0x03, userId, &userPin, 0x00, 0x00, 0x00, &userPin); SEND_COMMAND_UNICAST_TO_BINDINGS(); } - else if ((rfProgrammingEventMask & BIT(0)) && status) + else if ((rfProgrammingEventMask & EMBER_BIT(0)) && status) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID, "uuvsuuws", 0x01, 0x00, userId, &userPin, 0x00, @@ -550,7 +550,7 @@ bool emberAfDoorLockClusterLockDoorCallback(uint8_t * PIN) // Possibly send operation event if (doorLocked) { - if (rfOperationEventMask & BIT(1) && (PIN != NULL)) + if (rfOperationEventMask & EMBER_BIT(1) && (PIN != NULL)) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_OPERATION_EVENT_NOTIFICATION_COMMAND_ID, "uuvsws", 0x01, 0x03, userId, PIN, 0X00, PIN); @@ -558,7 +558,7 @@ bool emberAfDoorLockClusterLockDoorCallback(uint8_t * PIN) } else { - if (rfOperationEventMask & BIT(3) && (PIN != NULL)) + if (rfOperationEventMask & EMBER_BIT(3) && (PIN != NULL)) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_OPERATION_EVENT_NOTIFICATION_COMMAND_ID, "uuvsws", 0x01, 0x03, userId, PIN, 0x00, PIN); @@ -599,7 +599,7 @@ bool emberAfDoorLockClusterUnlockDoorCallback(uint8_t * pin) (uint8_t *) &rfOperationEventMask, sizeof(rfOperationEventMask)); // send operation event - if (doorUnlocked && (rfOperationEventMask & BIT(2)) && (pin != NULL)) + if (doorUnlocked && (rfOperationEventMask & EMBER_BIT(2)) && (pin != NULL)) { emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_DOOR_LOCK_CLUSTER_ID, ZCL_OPERATION_EVENT_NOTIFICATION_COMMAND_ID, "uuvsws", EMBER_ZCL_DOOR_LOCK_EVENT_SOURCE_RF, diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index ddaddc035c17f9..1e1db3cb40730f 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -234,8 +234,8 @@ bool emberAfGroupsClusterGetGroupMembershipCallback(uint8_t groupCount, uint8_t status = emberGetBinding(i, &entry); if ((status == EMBER_SUCCESS) && (entry.type == EMBER_MULTICAST_BINDING) && (entry.local == emberAfCurrentEndpoint())) { - list[listLen] = LOW_BYTE(entry.groupId); - list[listLen + 1] = HIGH_BYTE(entry.groupId); + list[listLen] = EMBER_LOW_BYTE(entry.groupId); + list[listLen + 1] = EMBER_HIGH_BYTE(entry.groupId); listLen = static_cast(listLen + 2); count++; } @@ -254,8 +254,8 @@ bool emberAfGroupsClusterGetGroupMembershipCallback(uint8_t groupCount, uint8_t { if (entry.local == emberAfCurrentEndpoint() && entry.groupId == groupId) { - list[listLen] = LOW_BYTE(groupId); - list[listLen + 1] = HIGH_BYTE(groupId); + list[listLen] = EMBER_LOW_BYTE(groupId); + list[listLen + 1] = EMBER_HIGH_BYTE(groupId); listLen = static_cast(listLen + 2); count++; } diff --git a/src/app/clusters/ias-zone-client/ias-zone-client.cpp b/src/app/clusters/ias-zone-client/ias-zone-client.cpp index 793bb5122f203a..bda02c2785c258 100644 --- a/src/app/clusters/ias-zone-client/ias-zone-client.cpp +++ b/src/app/clusters/ias-zone-client/ias-zone-client.cpp @@ -402,8 +402,8 @@ static EmberStatus sendCommand(EmberNodeId destAddress) static void setCieAddress(EmberNodeId destAddress) { uint8_t writeAttributes[] = { - LOW_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), - HIGH_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), + EMBER_LOW_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), + EMBER_HIGH_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), ZCL_IEEE_ADDRESS_ATTRIBUTE_TYPE, 0, 0, @@ -488,11 +488,11 @@ void emberAfPluginIasZoneClientZdoMessageReceivedCallback(EmberNodeId emberNodeI void readIasZoneServerAttributes(EmberNodeId nodeId) { uint8_t iasZoneAttributeIds[] = { - LOW_BYTE(ZCL_ZONE_STATE_ATTRIBUTE_ID), HIGH_BYTE(ZCL_ZONE_STATE_ATTRIBUTE_ID), + EMBER_LOW_BYTE(ZCL_ZONE_STATE_ATTRIBUTE_ID), EMBER_HIGH_BYTE(ZCL_ZONE_STATE_ATTRIBUTE_ID), - LOW_BYTE(ZCL_ZONE_TYPE_ATTRIBUTE_ID), HIGH_BYTE(ZCL_ZONE_TYPE_ATTRIBUTE_ID), + EMBER_LOW_BYTE(ZCL_ZONE_TYPE_ATTRIBUTE_ID), EMBER_HIGH_BYTE(ZCL_ZONE_TYPE_ATTRIBUTE_ID), - LOW_BYTE(ZCL_ZONE_STATUS_ATTRIBUTE_ID), HIGH_BYTE(ZCL_ZONE_STATUS_ATTRIBUTE_ID), + EMBER_LOW_BYTE(ZCL_ZONE_STATUS_ATTRIBUTE_ID), EMBER_HIGH_BYTE(ZCL_ZONE_STATUS_ATTRIBUTE_ID), }; emberAfFillExternalBuffer((ZCL_GLOBAL_COMMAND | ZCL_FRAME_CONTROL_CLIENT_TO_SERVER), ZCL_IAS_ZONE_CLUSTER_ID, ZCL_READ_ATTRIBUTES_COMMAND_ID, "b", iasZoneAttributeIds, sizeof(iasZoneAttributeIds)); @@ -505,8 +505,8 @@ void readIasZoneServerAttributes(EmberNodeId nodeId) void readIasZoneServerCieAddress(EmberNodeId nodeId) { uint8_t iasZoneAttributeIds[] = { - LOW_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), - HIGH_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), + EMBER_LOW_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), + EMBER_HIGH_BYTE(ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID), }; emberAfFillExternalBuffer((ZCL_GLOBAL_COMMAND | ZCL_FRAME_CONTROL_CLIENT_TO_SERVER), ZCL_IAS_ZONE_CLUSTER_ID, ZCL_READ_ATTRIBUTES_COMMAND_ID, "b", iasZoneAttributeIds, sizeof(iasZoneAttributeIds)); diff --git a/src/app/clusters/messaging-client/messaging-client.cpp b/src/app/clusters/messaging-client/messaging-client.cpp index 764e4e8715b55a..bb1d7253784aef 100644 --- a/src/app/clusters/messaging-client/messaging-client.cpp +++ b/src/app/clusters/messaging-client/messaging-client.cpp @@ -58,7 +58,7 @@ static void esiDeletionCallback(uint8_t esiIndex) uint8_t i; for (i = 0; i < EMBER_AF_MESSAGING_CLUSTER_CLIENT_ENDPOINT_COUNT; i++) { - messageTable[i].esiBitmask &= ~BIT(esiIndex); + messageTable[i].esiBitmask &= ~EMBER_BIT(esiIndex); } } @@ -159,9 +159,10 @@ bool emberAfMessagingClusterDisplayMessageCallback(uint32_t messageId, uint8_t m if (messageId == messageTable[ep].messageId) { // Duplicate message from a different ESI, add the ESI to the bitmask - if (esiIndex < EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE && (messageTable[ep].esiBitmask & BIT(esiIndex)) == 0) + if (esiIndex < EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE && + (messageTable[ep].esiBitmask & EMBER_BIT(esiIndex)) == 0) { - messageTable[ep].esiBitmask |= BIT(esiIndex); + messageTable[ep].esiBitmask |= EMBER_BIT(esiIndex); } // Either way, we send back a default response. emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); @@ -179,7 +180,7 @@ bool emberAfMessagingClusterDisplayMessageCallback(uint32_t messageId, uint8_t m if (esiIndex < EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE) { - messageTable[ep].esiBitmask = BIT(esiIndex); + messageTable[ep].esiBitmask = EMBER_BIT(esiIndex); } messageTable[ep].clientEndpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint; @@ -314,7 +315,7 @@ EmberAfStatus emberAfPluginMessagingClientConfirmMessage(EndpointId endpoint) { EmberAfPluginEsiManagementEsiEntry * esiEntry = emberAfPluginEsiManagementEsiLookUpByIndex(i); EmberNodeId nodeId; - if ((messageTable[ep].esiBitmask & BIT(i)) == 0 || esiEntry == NULL) + if ((messageTable[ep].esiBitmask & EMBER_BIT(i)) == 0 || esiEntry == NULL) { continue; } diff --git a/src/app/clusters/messaging-client/messaging-client.h b/src/app/clusters/messaging-client/messaging-client.h index 294bce032b8429..d790ed356e65c0 100644 --- a/src/app/clusters/messaging-client/messaging-client.h +++ b/src/app/clusters/messaging-client/messaging-client.h @@ -44,9 +44,9 @@ // Message Control byte // ---------------------------------------------------------------------------- -#define ZCL_MESSAGING_CLUSTER_TRANSMISSION_MASK (BIT(1) | BIT(0)) -#define ZCL_MESSAGING_CLUSTER_IMPORTANCE_MASK (BIT(3) | BIT(2)) -#define ZCL_MESSAGING_CLUSTER_CONFIRMATION_MASK BIT(7) +#define ZCL_MESSAGING_CLUSTER_TRANSMISSION_MASK (EMBER_BIT(1) | EMBER_BIT(0)) +#define ZCL_MESSAGING_CLUSTER_IMPORTANCE_MASK (EMBER_BIT(3) | EMBER_BIT(2)) +#define ZCL_MESSAGING_CLUSTER_CONFIRMATION_MASK EMBER_BIT(7) #define ZCL_MESSAGING_CLUSTER_START_TIME_NOW 0x00000000UL #define ZCL_MESSAGING_CLUSTER_END_TIME_NEVER 0xFFFFFFFFUL diff --git a/src/app/clusters/messaging-server/messaging-server.cpp b/src/app/clusters/messaging-server/messaging-server.cpp index 3d5bbfad5e741e..5771a5299e3136 100644 --- a/src/app/clusters/messaging-server/messaging-server.cpp +++ b/src/app/clusters/messaging-server/messaging-server.cpp @@ -51,9 +51,9 @@ static EmberAfPluginMessagingServerMessage msgTable[EMBER_AF_MESSAGING_CLUSTER_S // These bits are used by the messageStatusControl to indicate whether or not // a message is valid, active, or if it is a "send now" message -#define VALID BIT(0) -#define ACTIVE BIT(1) -#define NOW BIT(2) +#define VALID EMBER_BIT(0) +#define ACTIVE EMBER_BIT(1) +#define NOW EMBER_BIT(2) #define messageIsValid(ep) (msgTable[ep].messageStatusControl & VALID) #define messageIsActive(ep) (msgTable[ep].messageStatusControl & ACTIVE) diff --git a/src/app/clusters/messaging-server/messaging-server.h b/src/app/clusters/messaging-server/messaging-server.h index aea95f29aaf8fe..b58e621e0e6837 100644 --- a/src/app/clusters/messaging-server/messaging-server.h +++ b/src/app/clusters/messaging-server/messaging-server.h @@ -44,10 +44,10 @@ // Message Control byte // ---------------------------------------------------------------------------- -#define ZCL_MESSAGING_CLUSTER_TRANSMISSION_MASK (BIT(1) | BIT(0)) -#define ZCL_MESSAGING_CLUSTER_IMPORTANCE_MASK (BIT(3) | BIT(2)) -#define ZCL_MESSAGING_CLUSTER_RESERVED_MASK (BIT(6) | BIT(5) | BIT(4)) -#define ZCL_MESSAGING_CLUSTER_CONFIRMATION_MASK BIT(7) +#define ZCL_MESSAGING_CLUSTER_TRANSMISSION_MASK (EMBER_BIT(1) | EMBER_BIT(0)) +#define ZCL_MESSAGING_CLUSTER_IMPORTANCE_MASK (EMBER_BIT(3) | EMBER_BIT(2)) +#define ZCL_MESSAGING_CLUSTER_RESERVED_MASK (EMBER_BIT(6) | EMBER_BIT(5) | EMBER_BIT(4)) +#define ZCL_MESSAGING_CLUSTER_CONFIRMATION_MASK EMBER_BIT(7) #define ZCL_MESSAGING_CLUSTER_START_TIME_NOW 0x00000000UL #define ZCL_MESSAGING_CLUSTER_END_TIME_NEVER 0xFFFFFFFFUL diff --git a/src/app/clusters/scenes/scenes.cpp b/src/app/clusters/scenes/scenes.cpp index 1ffbcc26496278..57209424bad11c 100644 --- a/src/app/clusters/scenes/scenes.cpp +++ b/src/app/clusters/scenes/scenes.cpp @@ -106,7 +106,7 @@ void emberAfScenesClusterServerInitCallback(EndpointId endpoint) #ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT { // The high bit of Name Support indicates whether scene names are supported. - uint8_t nameSupport = BIT(7); + uint8_t nameSupport = EMBER_BIT(7); writeServerAttribute(endpoint, ZCL_SCENES_CLUSTER_ID, ZCL_SCENE_NAME_SUPPORT_ATTRIBUTE_ID, "name support", (uint8_t *) &nameSupport, ZCL_BITMAP8_ATTRIBUTE_TYPE); } diff --git a/src/app/clusters/zll-on-off-server/zll-on-off-server.c b/src/app/clusters/zll-on-off-server/zll-on-off-server.c index f168b34366bfa7..92c34fa3ab768a 100644 --- a/src/app/clusters/zll-on-off-server/zll-on-off-server.c +++ b/src/app/clusters/zll-on-off-server/zll-on-off-server.c @@ -55,7 +55,7 @@ #include "zll-on-off-server.h" #include "../../include/af.h" -#define ZLL_ON_OFF_CLUSTER_ON_OFF_CONTROL_ACCEPT_ONLY_WHEN_ON_MASK BIT(0) +#define ZLL_ON_OFF_CLUSTER_ON_OFF_CONTROL_ACCEPT_ONLY_WHEN_ON_MASK EMBER_BIT(0) #define readOnOff(endpoint, onOff) readBoolean((endpoint), ZCL_ON_OFF_ATTRIBUTE_ID, "on/off", (onOff)) #define writeOnOff(endpoint, onOff) writeBoolean((endpoint), ZCL_ON_OFF_ATTRIBUTE_ID, "on/off", (onOff)) diff --git a/src/app/clusters/zll-scenes-server/zll-scenes-server.c b/src/app/clusters/zll-scenes-server/zll-scenes-server.c index a70d563703e624..235fe054a616fe 100644 --- a/src/app/clusters/zll-scenes-server/zll-scenes-server.c +++ b/src/app/clusters/zll-scenes-server/zll-scenes-server.c @@ -55,7 +55,7 @@ #include "../../include/af.h" #include "../scenes/scenes.h" -#define ZCL_SCENES_CLUSTER_MODE_COPY_ALL_SCENES_MASK BIT(0) +#define ZCL_SCENES_CLUSTER_MODE_COPY_ALL_SCENES_MASK EMBER_BIT(0) bool emberAfScenesClusterEnhancedAddSceneCallback(uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName, uint8_t * extensionFieldSets) diff --git a/src/app/reporting/reporting.cpp b/src/app/reporting/reporting.cpp index 961525cfe9f8d3..4d2e5dbefedca5 100644 --- a/src/app/reporting/reporting.cpp +++ b/src/app/reporting/reporting.cpp @@ -1043,7 +1043,7 @@ static void putReportableChangeInResp(const EmberAfPluginReportingEntry * entry, uint32_t value = entry->data.reported.reportableChange; for (; bytes > 0; bytes--) { - uint8_t b = BYTE_0(value); + uint8_t b = EMBER_BYTE_0(value); emberAfPutInt8uInResp(b); value >>= 8; } diff --git a/src/app/util/af.h b/src/app/util/af.h index b42d816b24ab58..41f37741aad6b2 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -1670,18 +1670,18 @@ EmberStatus emberAfInitiatePartnerLinkKeyExchange(EmberNodeId target, chip::Endp // @{ // Frame control fields (8 bits total) // Bits 0 and 1 are Frame Type Sub-field -#define ZCL_FRAME_CONTROL_FRAME_TYPE_MASK (BIT(0) | BIT(1)) -#define ZCL_CLUSTER_SPECIFIC_COMMAND BIT(0) +#define ZCL_FRAME_CONTROL_FRAME_TYPE_MASK (EMBER_BIT(0) | EMBER_BIT(1)) +#define ZCL_CLUSTER_SPECIFIC_COMMAND EMBER_BIT(0) #define ZCL_PROFILE_WIDE_COMMAND 0 #define ZCL_GLOBAL_COMMAND (ZCL_PROFILE_WIDE_COMMAND) // Bit 2 is Manufacturer Specific Sub-field -#define ZCL_MANUFACTURER_SPECIFIC_MASK BIT(2) +#define ZCL_MANUFACTURER_SPECIFIC_MASK EMBER_BIT(2) // Bit 3 is Direction Sub-field -#define ZCL_FRAME_CONTROL_DIRECTION_MASK BIT(3) -#define ZCL_FRAME_CONTROL_SERVER_TO_CLIENT BIT(3) +#define ZCL_FRAME_CONTROL_DIRECTION_MASK EMBER_BIT(3) +#define ZCL_FRAME_CONTROL_SERVER_TO_CLIENT EMBER_BIT(3) #define ZCL_FRAME_CONTROL_CLIENT_TO_SERVER 0 // Bit 4 is Disable Default Response Sub-field -#define ZCL_DISABLE_DEFAULT_RESPONSE_MASK BIT(4) +#define ZCL_DISABLE_DEFAULT_RESPONSE_MASK EMBER_BIT(4) // Bits 5 to 7 are reserved #define ZCL_DIRECTION_CLIENT_TO_SERVER 0 @@ -1695,8 +1695,8 @@ EmberStatus emberAfInitiatePartnerLinkKeyExchange(EmberNodeId target, chip::Endp #define EMBER_AF_ZCL_MANUFACTURER_SPECIFIC_OVERHEAD 5 // Permitted values for emberAfSetFormAndJoinMode -#define FIND_AND_JOIN_MODE_ALLOW_2_4_GHZ BIT(0) -#define FIND_AND_JOIN_MODE_ALLOW_SUB_GHZ BIT(1) +#define FIND_AND_JOIN_MODE_ALLOW_2_4_GHZ EMBER_BIT(0) +#define FIND_AND_JOIN_MODE_ALLOW_SUB_GHZ EMBER_BIT(1) #define FIND_AND_JOIN_MODE_ALLOW_BOTH (FIND_AND_JOIN_MODE_ALLOW_2_4_GHZ | FIND_AND_JOIN_MODE_ALLOW_SUB_GHZ) /** @} END ZCL macros */ diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 4bdd3f01bca891..82edf772edaa2e 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -438,8 +438,8 @@ EmberAfStatus emberAfAppendAttributeReportFields(EndpointId endpoint, ClusterId goto kickout; } - buffer[(*bufIndex)++] = LOW_BYTE(attributeId); - buffer[(*bufIndex)++] = HIGH_BYTE(attributeId); + buffer[(*bufIndex)++] = EMBER_LOW_BYTE(attributeId); + buffer[(*bufIndex)++] = EMBER_HIGH_BYTE(attributeId); buffer[(*bufIndex)++] = type; #if (BIGENDIAN_CPU) if (isThisDataTypeSentLittleEndianOTA(type)) diff --git a/src/app/util/client-api.cpp b/src/app/util/client-api.cpp index c62c24b1f8923d..0321437754ae5c 100644 --- a/src/app/util/client-api.cpp +++ b/src/app/util/client-api.cpp @@ -85,8 +85,8 @@ static uint16_t vFillBuffer(uint8_t * buffer, uint16_t bufferLen, uint8_t frameC buffer[bytes++] = frameControl; if (manufacturerCode != EMBER_AF_NULL_MANUFACTURER_CODE) { - buffer[bytes++] = LOW_BYTE(manufacturerCode); - buffer[bytes++] = HIGH_BYTE(manufacturerCode); + buffer[bytes++] = EMBER_LOW_BYTE(manufacturerCode); + buffer[bytes++] = EMBER_HIGH_BYTE(manufacturerCode); } buffer[bytes++] = emberAfNextSequence(); buffer[bytes++] = commandId; @@ -202,7 +202,7 @@ static uint16_t vFillBuffer(uint8_t * buffer, uint16_t bufferLen, uint8_t frameC // endian format. for (; 0 < valueLen; valueLen--) { - buffer[bytes++] = LOW_BYTE(value); + buffer[bytes++] = EMBER_LOW_BYTE(value); value = value >> 8; } diff --git a/src/app/util/message.cpp b/src/app/util/message.cpp index 8937e220194ace..8ad9a9b46fd0af 100644 --- a/src/app/util/message.cpp +++ b/src/app/util/message.cpp @@ -94,8 +94,8 @@ uint8_t * emberAfPutInt8uInResp(uint8_t value) uint16_t * emberAfPutInt16uInResp(uint16_t value) { - uint8_t * low = emberAfPutInt8uInResp(LOW_BYTE(value)); - uint8_t * high = emberAfPutInt8uInResp(HIGH_BYTE(value)); + uint8_t * low = emberAfPutInt8uInResp(EMBER_LOW_BYTE(value)); + uint8_t * high = emberAfPutInt8uInResp(EMBER_HIGH_BYTE(value)); if (low && high) { @@ -109,10 +109,10 @@ uint16_t * emberAfPutInt16uInResp(uint16_t value) uint32_t * emberAfPutInt32uInResp(uint32_t value) { - uint8_t * a = emberAfPutInt8uInResp(BYTE_0(value)); - uint8_t * b = emberAfPutInt8uInResp(BYTE_1(value)); - uint8_t * c = emberAfPutInt8uInResp(BYTE_2(value)); - uint8_t * d = emberAfPutInt8uInResp(BYTE_3(value)); + uint8_t * a = emberAfPutInt8uInResp(EMBER_BYTE_0(value)); + uint8_t * b = emberAfPutInt8uInResp(EMBER_BYTE_1(value)); + uint8_t * c = emberAfPutInt8uInResp(EMBER_BYTE_2(value)); + uint8_t * d = emberAfPutInt8uInResp(EMBER_BYTE_3(value)); if (a && b && c && d) { @@ -126,9 +126,9 @@ uint32_t * emberAfPutInt32uInResp(uint32_t value) uint32_t * emberAfPutInt24uInResp(uint32_t value) { - uint8_t * a = emberAfPutInt8uInResp(BYTE_0(value)); - uint8_t * b = emberAfPutInt8uInResp(BYTE_1(value)); - uint8_t * c = emberAfPutInt8uInResp(BYTE_2(value)); + uint8_t * a = emberAfPutInt8uInResp(EMBER_BYTE_0(value)); + uint8_t * b = emberAfPutInt8uInResp(EMBER_BYTE_1(value)); + uint8_t * c = emberAfPutInt8uInResp(EMBER_BYTE_2(value)); if (a && b && c) { diff --git a/src/app/util/types_stub.h b/src/app/util/types_stub.h index 983427c91a6c93..b174c537f7c1cb 100644 --- a/src/app/util/types_stub.h +++ b/src/app/util/types_stub.h @@ -1745,62 +1745,62 @@ typedef struct /** * @brief Useful to reference a single bit of a byte. */ -#define BIT(nr) (1UL << (nr)) // Unsigned avoids compiler warnings re BIT(15) +#define EMBER_BIT(nr) (1UL << (nr)) // Unsigned avoids compiler warnings re EMBER_BIT(15) /** * @brief Returns the low byte of the 16-bit value \c n as an \c uint8_t. */ -#define LOW_BYTE(n) ((uint8_t)((n) &0xFF)) +#define EMBER_LOW_BYTE(n) ((uint8_t)((n) &0xFF)) /** * @brief Returns the high byte of the 16-bit value \c n as an \c uint8_t. */ -#define HIGH_BYTE(n) ((uint8_t)(LOW_BYTE((n) >> 8))) +#define EMBER_HIGH_BYTE(n) ((uint8_t)(EMBER_LOW_BYTE((n) >> 8))) /** * @brief Returns the low byte of the 32-bit value \c n as an \c uint8_t. */ -#define BYTE_0(n) ((uint8_t)((n) &0xFF)) +#define EMBER_BYTE_0(n) ((uint8_t)((n) &0xFF)) /** * @brief Returns the second byte of the 32-bit value \c n as an \c uint8_t. */ -#define BYTE_1(n) BYTE_0((n) >> 8) +#define EMBER_BYTE_1(n) EMBER_BYTE_0((n) >> 8) /** * @brief Returns the third byte of the 32-bit value \c n as an \c uint8_t. */ -#define BYTE_2(n) BYTE_0((n) >> 16) +#define EMBER_BYTE_2(n) EMBER_BYTE_0((n) >> 16) /** * @brief Returns the high byte of the 32-bit value \c n as an \c uint8_t. */ -#define BYTE_3(n) BYTE_0((n) >> 24) +#define EMBER_BYTE_3(n) EMBER_BYTE_0((n) >> 24) /** * @brief Returns the fifth byte of the 64-bit value \c n as an \c uint8_t. */ -#define BYTE_4(n) BYTE_0((n) >> 32) +#define EMBER_BYTE_4(n) EMBER_BYTE_0((n) >> 32) /** * @brief Returns the sixth byte of the 64-bit value \c n as an \c uint8_t. */ -#define BYTE_5(n) BYTE_0((n) >> 40) +#define EMBER_BYTE_5(n) EMBER_BYTE_0((n) >> 40) /** * @brief Returns the seventh byte of the 64-bit value \c n as an \c uint8_t. */ -#define BYTE_6(n) BYTE_0((n) >> 48) +#define EMBER_BYTE_6(n) EMBER_BYTE_0((n) >> 48) /** * @brief Returns the high byte of the 64-bit value \c n as an \c uint8_t. */ -#define BYTE_7(n) BYTE_0((n) >> 56) +#define EMBER_BYTE_7(n) EMBER_BYTE_0((n) >> 56) /** * @brief Returns the value built from the two \c uint8_t * values \c high and \c low. */ -#define HIGH_LOW_TO_INT(high, low) (((uint16_t)(((uint16_t)(high)) << 8)) + ((uint16_t)((low) &0xFF))) +#define EMBER_HIGH_LOW_TO_INT(high, low) (((uint16_t)(((uint16_t)(high)) << 8)) + ((uint16_t)((low) &0xFF))) /** * @brief The kind of arguments the main function takes @@ -1817,7 +1817,7 @@ typedef struct /** * @brief Returns the value of \c bit within the register or byte \c reg. */ -#define READBIT(reg, bit) ((reg) & (BIT(bit))) +#define READBIT(reg, bit) ((reg) & (EMBER_BIT(bit))) /** * @brief Returns the value of the bitmask \c bits within diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 9901f0f70976eb..d0b37837540240 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -934,8 +934,8 @@ void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, uint16_t size) length = size; } memmove(dest + 2, src + 2, length); - dest[0] = LOW_BYTE(length); - dest[1] = HIGH_BYTE(length); + dest[0] = EMBER_LOW_BYTE(length); + dest[1] = EMBER_HIGH_BYTE(length); } }