提交 | 用户 | age
|
7b8b07
|
1 |
/**
|
Q |
2 |
******************************************************************************
|
|
3 |
* @file : FP0.h
|
|
4 |
* @brief : Header for FP0.c file.
|
|
5 |
* This file contains the function defines of the FP0 .
|
|
6 |
******************************************************************************
|
|
7 |
*/
|
|
8 |
#ifndef __FP0_H__
|
|
9 |
#define __FP0_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 tagFP0PinStat
|
|
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 |
}stFP0PinStat;
|
|
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 FP0DE_PORT GPIOF
|
|
46 |
#define FP0DE_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 |
|
|
55 |
#define GetRSTPin() LL_GPIO_IsInputPinSet(RST_PORT,RST_PIN)
|
|
56 |
|
|
57 |
#define GetSYNPin() LL_GPIO_IsInputPinSet(SYN_PORT,SYN_PIN)
|
|
58 |
|
|
59 |
#define GetOEPin() LL_GPIO_IsInputPinSet(OE_PORT,OE_PIN)
|
|
60 |
|
|
61 |
#define GetSELPin() (1) //LL_GPIO_IsInputPinSet(SEL_PORT,SEL_PIN)
|
|
62 |
|
|
63 |
#define GetACKPin() LL_GPIO_IsInputPinSet(ACK_PORT,ACK_PIN)
|
|
64 |
|
|
65 |
|
|
66 |
#define SetACKPin_0() LL_GPIO_ResetOutputPin(ACK_PORT,ACK_PIN)
|
|
67 |
#define SetACKPin_1() LL_GPIO_SetOutputPin(ACK_PORT,ACK_PIN)
|
|
68 |
|
|
69 |
#define SetFP0DEPin_0() LL_GPIO_ResetOutputPin(FP0DE_PORT,FP0DE_PIN)
|
|
70 |
#define SetFP0DEPin_1() LL_GPIO_SetOutputPin(FP0DE_PORT,FP0DE_PIN)
|
|
71 |
|
|
72 |
|
|
73 |
extern uint8_t PkgBuf1[32];
|
|
74 |
extern uint8_t PkgBuf2[32];
|
|
75 |
extern uint8_t PkgLen1;
|
|
76 |
extern uint8_t PkgLen2;
|
|
77 |
extern uint8_t bReceiving;
|
|
78 |
extern uint8_t nReceivedLen;
|
|
79 |
extern uint8_t bSending;
|
|
80 |
extern uint8_t bSentLen;
|
|
81 |
|
|
82 |
extern uint8_t bConfiged;
|
|
83 |
|
|
84 |
extern uint8_t nInputBytes;
|
|
85 |
extern uint8_t nOutputBytes;
|
|
86 |
|
|
87 |
extern unsigned char SPI1RecvBuf[32];
|
|
88 |
extern unsigned char SPI1SendBuf[32];
|
|
89 |
|
|
90 |
extern volatile unsigned char bSPI1Recving;
|
|
91 |
extern volatile unsigned char bSPI1RecvDone;
|
|
92 |
|
|
93 |
extern volatile unsigned char nSPI1RecvPos;
|
|
94 |
extern volatile unsigned char nSPI1RecvLenInBuf;
|
|
95 |
|
|
96 |
extern volatile unsigned char nSPI1ToSendLen;
|
|
97 |
extern volatile unsigned char nSPI1SentLen;
|
|
98 |
|
|
99 |
extern volatile unsigned char bSPI1Sending;
|
|
100 |
extern volatile unsigned char bSPI1SendDone;
|
|
101 |
|
|
102 |
extern volatile int oldSYN;
|
|
103 |
|
|
104 |
typedef struct tagFP0QuRplyPkg
|
|
105 |
{
|
|
106 |
uint8_t Hdr1;
|
|
107 |
uint8_t nInputBytes;
|
|
108 |
uint8_t nOutputBytes;
|
|
109 |
uint8_t nParam1;
|
|
110 |
uint8_t nBCC;
|
|
111 |
uint8_t End1;
|
|
112 |
}stFP0QuRplyPkg, *pFP0QuRplyPkg;
|
|
113 |
|
|
114 |
typedef struct tagFP0EXGRplyPkg
|
|
115 |
{
|
|
116 |
uint8_t Hdr1;
|
|
117 |
uint8_t nInputBytes[6];
|
|
118 |
uint8_t nBCC;
|
|
119 |
uint8_t End1;
|
|
120 |
}stFP0EXGRplyPkg, * pFP0EXGRplyPkg;
|
|
121 |
|
|
122 |
uint8_t FP0_Init(void);
|
|
123 |
uint8_t FP0_Proc(void);
|
|
124 |
|
|
125 |
uint8_t CalFP0BCC(uint8_t* pBuf, uint8_t len1);
|
|
126 |
uint8_t CheckFP0Pkg(uint8_t * pBuf, uint8_t len1);
|
|
127 |
uint8_t ParseFP0Pkg(uint8_t * pBuf, uint8_t len1);
|
|
128 |
uint8_t SendFP0Pkg(uint8_t * pBuf, uint8_t len1);
|
|
129 |
|
|
130 |
#endif /* __FP0_H__ */
|