新增 HC-12 库
This commit is contained in:
parent
8cf4574325
commit
f677bbecc8
20
Hardware/hc12/hc12.c
Normal file
20
Hardware/hc12/hc12.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//HC12 库
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "hc25.h"
|
||||||
|
|
||||||
|
/**************************************** 私有变量 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
void HC12_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
19
Hardware/hc12/hc12.h
Normal file
19
Hardware/hc12/hc12.h
Normal file
@ -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
|
||||||
@ -407,6 +407,7 @@ uint8_t Uart_GetBuffUntil(COM_PORT_E _ucPort, uint8_t *_pBuf, uint8_t _endByte,
|
|||||||
if (ch == _endByte)
|
if (ch == _endByte)
|
||||||
{
|
{
|
||||||
_pBuf[i] = '\0';
|
_pBuf[i] = '\0';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#define UART1_FIFO_EN 1 //调试用串口
|
#define UART1_FIFO_EN 1 //调试用串口
|
||||||
#define UART2_FIFO_EN 1 //WiFi 透传
|
#define UART2_FIFO_EN 1 //WiFi 透传
|
||||||
#define UART3_FIFO_EN 0
|
#define UART3_FIFO_EN 1 //HC-12
|
||||||
#define UART4_FIFO_EN 0
|
#define UART4_FIFO_EN 0
|
||||||
#define UART5_FIFO_EN 0
|
#define UART5_FIFO_EN 0
|
||||||
#define UART6_FIFO_EN 0
|
#define UART6_FIFO_EN 0
|
||||||
@ -39,7 +39,7 @@ typedef enum
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UART3_FIFO_EN == 1
|
#if UART3_FIFO_EN == 1
|
||||||
#define UART3_BAUD 115200
|
#define UART3_BAUD 9600
|
||||||
#define UART3_TX_BUF_SIZE 1 * 1024
|
#define UART3_TX_BUF_SIZE 1 * 1024
|
||||||
#define UART3_RX_BUF_SIZE 1 * 1024
|
#define UART3_RX_BUF_SIZE 1 * 1024
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user