yincheng.zhong
9 天以前 d10f581eb749a8338e697a418d630db2cb01843f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*******************************************************************************
 * 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  50
 
 
// ¶¨Òå״̬ö¾Ù
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);
void  BT_DisConnect(void);
HIDO_VOID BT_Init(void);
// º¯ÊýÉùÃ÷
void Joystick_Process(Joystick_t *joy);
void Parse_Joystick_Data(char *data);
 
 
#endif