diff --git a/Hardware/hc12/hc12.c b/Hardware/hc12/hc12.c new file mode 100644 index 0000000..5bfa0ff --- /dev/null +++ b/Hardware/hc12/hc12.c @@ -0,0 +1,20 @@ +//HC12 库 + +#include "string.h" + +#include "systick.h" + +#include "hc25.h" + +/**************************************** 私有变量 ****************************************/ + +/*****************************************************************************************/ + +/**************************************** 私有函数 ****************************************/ + +/*****************************************************************************************/ + +void HC12_Init(void) +{ + +} diff --git a/Hardware/hc12/hc12.h b/Hardware/hc12/hc12.h new file mode 100644 index 0000000..2433ab7 --- /dev/null +++ b/Hardware/hc12/hc12.h @@ -0,0 +1,19 @@ +//HC12 库 + +#ifndef __HC12_H +#define __HC12_H + +#include "uart.h" + +#define HC12_COM COM3 + +#define HC12_SendBuff(__pdata__, __data_len__) Uart_SendBuf(HC12_COM, __pdata__, __data_len__) +#define HC12_Receive(__pdata__) Uart_GetChar(HC12_COM, __pdata__) +#define HC12_ReceiveBuffUntil(__pdata__, __end_byte__, __timeout__) Uart_GetBuffUntil(HC12_COM, __pdata__, __end_byte__, __timeout__) +#define HC12_ClearSend Uart_ClearTxFifo(HC12_COM) +#define HC12_ClearReceive Uart_ClearRxFifo(HC12_COM) +#define HC12_BindReceiveHandle(__receive__) Uart_BindReceiveHandle(HC12_COM, __receive__) + +void HC12_Init(void); + +#endif diff --git a/System/usart/uart.c b/System/usart/uart.c index fe7e89a..6f6e618 100644 --- a/System/usart/uart.c +++ b/System/usart/uart.c @@ -407,6 +407,7 @@ uint8_t Uart_GetBuffUntil(COM_PORT_E _ucPort, uint8_t *_pBuf, uint8_t _endByte, if (ch == _endByte) { _pBuf[i] = '\0'; + return 1; } diff --git a/System/usart/uart.h b/System/usart/uart.h index a7516bd..fd039cc 100644 --- a/System/usart/uart.h +++ b/System/usart/uart.h @@ -5,7 +5,7 @@ #define UART1_FIFO_EN 1 //调试用串口 #define UART2_FIFO_EN 1 //WiFi 透传 -#define UART3_FIFO_EN 0 +#define UART3_FIFO_EN 1 //HC-12 #define UART4_FIFO_EN 0 #define UART5_FIFO_EN 0 #define UART6_FIFO_EN 0 @@ -39,7 +39,7 @@ typedef enum #endif #if UART3_FIFO_EN == 1 -#define UART3_BAUD 115200 +#define UART3_BAUD 9600 #define UART3_TX_BUF_SIZE 1 * 1024 #define UART3_RX_BUF_SIZE 1 * 1024 #endif