/*
 * communication_protocol.c
 *
 *  Created on: 2024年5月18日
 *      Author: 34509
 */

#include <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);
}

