Add ifdef to bit definitions to avoid conflicts with other libraries. Refactor BITx to use BIT macro. (#45)

This commit is contained in:
Steve Karg
2020-02-18 08:21:54 -06:00
committed by GitHub
parent cf963a63ca
commit 9c41180145
19 changed files with 89 additions and 104 deletions
+2 -2
View File
@@ -273,7 +273,7 @@ static bool dlmstp_compare_data_expecting_reply(
}
request.invoke_id = request_pdu[offset + 2];
/* segmented message? */
if (request_pdu[offset] & BIT3)
if (request_pdu[offset] & BIT(3))
request.service_choice = request_pdu[offset + 5];
else
request.service_choice = request_pdu[offset + 3];
@@ -296,7 +296,7 @@ static bool dlmstp_compare_data_expecting_reply(
case PDU_TYPE_COMPLEX_ACK:
reply.invoke_id = reply_pdu[offset + 1];
/* segmented message? */
if (reply_pdu[offset] & BIT3)
if (reply_pdu[offset] & BIT(3))
reply.service_choice = reply_pdu[offset + 4];
else
reply.service_choice = reply_pdu[offset + 2];
+7 -7
View File
@@ -165,13 +165,13 @@ void test_task(
mstimer_reset(&Test_Timer);
sprintf(Send_Buffer, "BACnet: 0000000\r\n");
MSTP_MAC_Address = input_address();
Send_Buffer[8] = (MSTP_MAC_Address & BIT0) ? '1' : '0';
Send_Buffer[9] = (MSTP_MAC_Address & BIT1) ? '1' : '0';
Send_Buffer[10] = (MSTP_MAC_Address & BIT2) ? '1' : '0';
Send_Buffer[11] = (MSTP_MAC_Address & BIT3) ? '1' : '0';
Send_Buffer[12] = (MSTP_MAC_Address & BIT4) ? '1' : '0';
Send_Buffer[13] = (MSTP_MAC_Address & BIT5) ? '1' : '0';
Send_Buffer[14] = (MSTP_MAC_Address & BIT6) ? '1' : '0';
Send_Buffer[8] = (MSTP_MAC_Address & BIT(0)) ? '1' : '0';
Send_Buffer[9] = (MSTP_MAC_Address & BIT(1)) ? '1' : '0';
Send_Buffer[10] = (MSTP_MAC_Address & BIT(2)) ? '1' : '0';
Send_Buffer[11] = (MSTP_MAC_Address & BIT(3)) ? '1' : '0';
Send_Buffer[12] = (MSTP_MAC_Address & BIT(4)) ? '1' : '0';
Send_Buffer[13] = (MSTP_MAC_Address & BIT(5)) ? '1' : '0';
Send_Buffer[14] = (MSTP_MAC_Address & BIT(6)) ? '1' : '0';
serial_bytes_send((uint8_t *) Send_Buffer, 17);
}
if (serial_byte_get(&data_register)) {