BLE_TYQ_BJQ_CH584M/bsp/inc/bsp_uart.h

55 lines
1.3 KiB
C
Raw Normal View History

2024-12-07 17:09:36 +08:00
/***
* @Author: mbw
* @Date: 2024-12-06 16:52:29
* @LastEditors: mbw && 1600520629@qq.com
2024-12-11 20:03:50 +08:00
* @LastEditTime: 2024-12-09 11:15:13
2024-12-07 17:09:36 +08:00
* @FilePath: \ble_-tyq_-bjq_-ch584-m\bsp\inc\bsp_uart.h
* @Description:
* @
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
*/
#ifndef __BSP_UART_H__
#define __BSP_UART_H__
#include "CH58x_common.h"
2024-12-11 20:03:50 +08:00
#define BT_START_EVT (0X01 << 0)
#define BT_REC_EVT (0X01 << 1)
#define BT_INFO_UPDATA_EVT (0X01 << 2)
#define BT_SEND_EVT (0X01 << 3)//
2024-12-07 17:09:36 +08:00
2024-12-11 20:03:50 +08:00
#define UART3_RX_PIN GPIO_Pin_20 //PB20
2024-12-07 17:09:36 +08:00
#define UART3_TX_PIN GPIO_Pin_21 // PB21
#define BT_UART_TX_PIN GPIO_Pin_9 //PA9
#define BT_UART_RX_PIN GPIO_Pin_8 //PA8
2024-12-11 20:03:50 +08:00
typedef struct __attribute__((packed))
2024-12-07 17:09:36 +08:00
{
2024-12-11 20:03:50 +08:00
uint8_t cmd;
uint8_t buf[];
} BtData_t;
2024-12-07 17:09:36 +08:00
2024-12-11 20:03:50 +08:00
typedef struct __attribute__((packed))
2024-12-07 17:09:36 +08:00
{
2024-12-11 20:03:50 +08:00
uint8_t len;
uint8_t buf[256];
} BTFrameData;
2024-12-07 17:09:36 +08:00
void BSP_UART1_Init(void);
unsigned int BSP_Uart1_Receive_Data(void *buf, unsigned int len);
unsigned int BSP_Uart1_Send_Data(const void *buf, unsigned int len);
void BSP_UART3_Init(void);
unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len);
unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len);
2024-12-11 20:03:50 +08:00
uint8_t XOR_CheckSum(const uint8_t *data, size_t len);
extern uint8_t BtRxTaskId;
2024-12-07 17:09:36 +08:00
#endif // !__BSP_UART_H__