更改协议处理部分,但是串口没反应?

This commit is contained in:
2025-01-20 01:30:18 +08:00
parent cc4d898114
commit 705cb68764
7 changed files with 179 additions and 31 deletions

View File

@@ -13,13 +13,12 @@
#include "fwdgt.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ultrasonic_analog.h"
/******************************************************************************/
#define RX_BUFFER_SIZE 32
#define PROTOCOL_PACKAGE_HEADER 0xD5
#define PROTOCOL_BOARD_TYPE 0x04
#define PROTOCOL_PACKAGE_LENGTH 0x02
@@ -43,10 +42,16 @@ typedef enum
PS_PAYLOAD,
PS_CRC,
PS_NULL
} packet_state;
} packet_state_t;
/******************************************************************************/
#define BUF_SIZE 8
#define MAX_CMD_SIZE 16
#define PACKET_START_BYTE 0xD5
bool code_seen(char code);
// void process_command(uint8_t* cmd, size_t length);
void process_command(void);