提交 | 用户 | age
|
5dd1b7
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file : FPx.h |
|
4 |
* @brief : Header for FPx.c file. |
|
5 |
* This file contains the function defines of the FPx . |
|
6 |
****************************************************************************** |
|
7 |
*/ |
|
8 |
#ifndef __FPX_H__ |
|
9 |
#define __FPX_H__ |
|
10 |
#include "main.h" |
|
11 |
|
|
12 |
enum enCMD_TYPE |
|
13 |
{ |
|
14 |
CMD_0_QUERY =0, |
|
15 |
CMD_1=0x1, // |
|
16 |
CMD_2=0x2, // |
|
17 |
CMD_3_EXCHG=0x3, // |
|
18 |
CMD_4=0x4, // |
|
19 |
CMD_5=0x5, // |
|
20 |
CMD_6=0x6, // |
|
21 |
CMD_7_END=0x7, // |
|
22 |
}; |
|
23 |
|
|
24 |
typedef struct tagFPxPinStat |
|
25 |
{ |
|
26 |
unsigned short OE:1; |
|
27 |
unsigned short RST:1; |
|
28 |
unsigned short SYN:1; |
|
29 |
unsigned short ACK:1; |
|
30 |
unsigned short SEL:1; |
|
31 |
|
|
32 |
}stFPxPinStat; |
|
33 |
|
|
34 |
|
|
35 |
#define RST_PORT GPIOB |
|
36 |
#define RST_PIN LL_GPIO_PIN_9 |
|
37 |
|
|
38 |
#define SYN_PORT GPIOF |
|
39 |
#define SYN_PIN LL_GPIO_PIN_6 |
|
40 |
|
|
41 |
#define ACK_PORT GPIOA |
|
42 |
#define ACK_PIN LL_GPIO_PIN_11 |
|
43 |
|
|
44 |
|
|
45 |
#define FPxDE_PORT GPIOF |
|
46 |
#define FPxDE_PIN LL_GPIO_PIN_7 |
|
47 |
|
|
48 |
#define OE_PORT GPIOB |
|
49 |
#define OE_PIN LL_GPIO_PIN_6 |
|
50 |
|
|
51 |
#define SEL_PORT GPIOB |
|
52 |
#define SEL_PIN LL_GPIO_PIN_8 |
|
53 |
|
|
54 |
#define FPX_WX_NUM 16 |
|
55 |
#define FPX_WY_NUM 16 |
|
56 |
|
|
57 |
#define GetRSTPin() LL_GPIO_IsInputPinSet(RST_PORT,RST_PIN) |
|
58 |
|
|
59 |
#define GetSYNPin() LL_GPIO_IsInputPinSet(SYN_PORT,SYN_PIN) |
|
60 |
|
|
61 |
#define GetOEPin() LL_GPIO_IsInputPinSet(OE_PORT,OE_PIN) |
|
62 |
|
|
63 |
#define GetSELPin() (1) //LL_GPIO_IsInputPinSet(SEL_PORT,SEL_PIN) |
|
64 |
|
|
65 |
#define GetACKPin() LL_GPIO_IsInputPinSet(ACK_PORT,ACK_PIN) |
|
66 |
|
|
67 |
|
|
68 |
#define SetACKPin_0() LL_GPIO_ResetOutputPin(ACK_PORT,ACK_PIN) |
|
69 |
#define SetACKPin_1() LL_GPIO_SetOutputPin(ACK_PORT,ACK_PIN) |
|
70 |
|
|
71 |
#define SetFPxDEPin_0() LL_GPIO_ResetOutputPin(FPxDE_PORT,FPxDE_PIN) |
|
72 |
#define SetFPxDEPin_1() LL_GPIO_SetOutputPin(FPxDE_PORT,FPxDE_PIN) |
|
73 |
|
842bb6
|
74 |
typedef void *(*FPxEvCBFuncDef) (int nEvent, void * pBuf, int); //callback func ,prama s is void *,void *,int; return void *; |
5dd1b7
|
75 |
|
Q |
76 |
// extern uint8_t PktBuf1[64]; |
|
77 |
|
|
78 |
extern uint8_t PktBuf2[64]; |
|
79 |
extern uint8_t PktLen1; |
|
80 |
extern uint8_t PktLen2; |
|
81 |
|
|
82 |
typedef struct tagFPxStat{ |
|
83 |
|
|
84 |
uint8_t bConfiged; |
|
85 |
uint8_t nConfigStationId; |
|
86 |
uint8_t nInputBytes; |
|
87 |
uint8_t nOutputBytes; |
|
88 |
|
|
89 |
uint8_t bReceiving; |
|
90 |
uint8_t nReceivedLen; |
|
91 |
uint8_t bSending; |
|
92 |
uint8_t bSentLen; |
|
93 |
|
|
94 |
volatile uint8_t oldSYN; |
|
95 |
int RSTCount0; |
|
96 |
int bFirstReq; |
842bb6
|
97 |
FPxEvCBFuncDef FPxEvCBFunc; |
Q |
98 |
// uint8_t bFPxCallBackFuncSet; |
5dd1b7
|
99 |
|
Q |
100 |
|
|
101 |
|
|
102 |
}stFPxStat; |
|
103 |
|
|
104 |
extern stFPxStat FPxStat; |
|
105 |
|
|
106 |
|
|
107 |
#pragma anon_unions |
|
108 |
|
|
109 |
typedef struct tagFPxMem{ |
|
110 |
union { |
|
111 |
unsigned short WLX[16]; //虚拟的X和Y,远程通讯时映射用。 |
|
112 |
unsigned char WLXB[32]; //虚拟的X和Y,远程通讯时映射用。 |
|
113 |
|
|
114 |
}; |
|
115 |
union { |
|
116 |
unsigned short WLY[16]; //虚拟的X和Y,远程通讯时映射用。 |
|
117 |
unsigned char WLYB[32]; //虚拟的X和Y,远程通讯时映射用。 |
|
118 |
}; |
|
119 |
}stFPxMem; |
|
120 |
|
|
121 |
extern stFPxMem FPxMem; |
|
122 |
|
|
123 |
typedef struct tagFPxQuRplyPkt |
|
124 |
{ |
|
125 |
uint8_t Hdr1; |
|
126 |
uint8_t nInputBytes; |
|
127 |
uint8_t nOutputBytes; |
|
128 |
uint8_t nParam1; |
|
129 |
uint8_t nBCC; |
|
130 |
uint8_t End1; |
|
131 |
}stFPxQuRplyPkt, *pFPxQuRplyPkt; |
|
132 |
|
|
133 |
typedef struct tagFPxEXGRplyPkt |
|
134 |
{ |
|
135 |
uint8_t Hdr1; |
|
136 |
uint8_t nInputBytes[6]; |
|
137 |
uint8_t nBCC; |
|
138 |
uint8_t End1; |
|
139 |
}stFPxEXGRplyPkt, * pFPxEXGRplyPkt; |
|
140 |
|
|
141 |
uint8_t FPx_Init(int nChilds); |
|
142 |
uint8_t FPx_SetIOCount(int nInputBytes, int nOutputBytes); |
|
143 |
uint8_t FPx_Proc(void); |
|
144 |
|
842bb6
|
145 |
uint8_t FPxBCC(uint8_t* pBuf, uint8_t len1); |
5dd1b7
|
146 |
uint8_t FPxCheckPkt(uint8_t * pBuf, uint8_t len1); |
Q |
147 |
uint8_t FPxParsePkt(uint8_t * pBuf, uint8_t len1); |
|
148 |
uint8_t FPxSendPkt(uint8_t * pBuf, uint8_t len1); |
|
149 |
|
|
150 |
|
842bb6
|
151 |
int FPxSetCallBackFunc(FPxEvCBFuncDef Func1); |
5dd1b7
|
152 |
|
Q |
153 |
enum enumFPxCallBackEvent |
|
154 |
{ |
|
155 |
evFPxNone = 0, |
|
156 |
evFPxCreate = 1, |
|
157 |
evFPxConnected = 2, |
|
158 |
evFPxDisConnected = 3, |
|
159 |
evFPxClosed = 4, |
|
160 |
evFPxStateChange =5, |
|
161 |
evFPxTimeSync=6, |
|
162 |
evFPxDataUpdate =7, |
|
163 |
}; |
|
164 |
|
|
165 |
#endif /* __FPX_H__ */ |