gateway/Software/Protocol/communication_protocol.c

38 lines
880 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* communication_protocol.c
*
* Created on: 2024年5月18日
* Author: 34509
*/
#include <Protocol/communication_protocol.h>
#include <string.h>
uint8_t protocol[max_Len];
/*
* Function Name : broadcast_Scan_Fun
* Description : 对pUSARTx串口发送扫描广播帧汇聚网关->接入节点)
* Input : USART_TypeDef* pUSARTx 串口号
* Return : None
**/
void broadcast_Scan_Fun(USART_TypeDef* pUSARTx)
{
memcpy(protocol, StartFlag, 2);
protocol[2] = broadcast_ID & 0xFF;
protocol[3] = (broadcast_ID >> 8) & 0xFF;
protocol[4] = (broadcast_ID >> 16) & 0xFF;
protocol[5] = (broadcast_ID >> 24) & 0xFF;
protocol[6] = (broadcast_ID >> 32) & 0xFF;
protocol[7] = (broadcast_ID >> 40) & 0xFF;
protocol[8] = broadcast_Scan;
protocol[9] = 0xCE;
protocol[10] = EndFlag;
USARTx_SendStr_Len(J5_0_USART, protocol, 11);
}