/*******************************************************************************
|
* File Name : bluetooth.h
|
* Description :
|
* Created on :
|
* Author :
|
*******************************************************************************/
|
|
#ifndef FML_BLUETOOTH_H_
|
#define FML_BLUETOOTH_H_
|
/*******************************************************************************
|
* Include Files *
|
*******************************************************************************/
|
#include "HIDO_TypeDef.h"
|
#include "stm32h7xx_hal.h"
|
|
/*******************************************************************************
|
* Macro *
|
*******************************************************************************/
|
#define OUTPUT_BUF_SIZE 512
|
#define BT_UART_RX_BUF_SIZE 256
|
#define BT_UART_TX_BUF_SIZE (1024*2)
|
#define BT_UART_TX_QUEUE_MEMBER_CNT 64
|
|
// ¶¨Òå×î´óÖØÊÔ´ÎÊý
|
#define MAX_RETRY 5
|
#define RESPONSE_TIMEOUT 1000 // 1Ã볬ʱ
|
#define UART6_DMA_RX_BUF_SIZE 100
|
|
|
// ¶¨Òå״̬ö¾Ù
|
typedef enum {
|
BT_STATE_IDLE = 0, // ¿ÕÏÐ״̬
|
BT_STATE_RECEIVING = 1, // ½ÓÊÕÊý¾ÝÖÐ
|
BT_STATE_COMPLETE = 2 // Êý¾Ý½ÓÊÕÍê³É
|
} BT_RevState;
|
|
// ¶¨Òå״̬ö¾Ù
|
typedef enum {
|
BT_CONFIG_FAIL= 0, // ʧ°Ü
|
BT_CONFIG_SUCCESS = 1, // ³É¹¦
|
} BT_Config;
|
|
// Ò¡¸ËÊäÈë½á¹¹Ìå
|
typedef struct {
|
int16_t x1;
|
int16_t y1;
|
int16_t x2;
|
int16_t y2;
|
} Joystick_t;
|
|
|
/*******************************************************************************
|
* Local Function Declaration *
|
*******************************************************************************/
|
extern HIDO_UINT8 uart6_dma_recv_end_flag;
|
extern HIDO_UINT8 uart6_dma_recv_len;
|
extern HIDO_UINT8 uart6_dma_rxbuf[UART6_DMA_RX_BUF_SIZE];
|
|
/*******************************************************************************
|
* Type Definition *
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Global Function *
|
*******************************************************************************/
|
|
HIDO_VOID BT_Poll(void);
|
HIDO_VOID BT_Init(void);
|
// º¯ÊýÉùÃ÷
|
void Joystick_Process(Joystick_t *joy);
|
void Parse_Joystick_Data(char *data);
|
void UART6_StartReceive(void);
|
|
|
#endif
|