/** ****************************************************************************** * @file : FP0.h * @brief : Header for FP0.c file. * This file contains the function defines of the FP0 . ****************************************************************************** */ #ifndef __FP0_H__ #define __FP0_H__ #include "main.h" enum enCMD_TYPE { CMD_0_QUERY =0, CMD_1=0x1, // CMD_2=0x2, // CMD_3_EXCHG=0x3, // CMD_4=0x4, // CMD_5=0x5, // CMD_6=0x6, // CMD_7_END=0x7, // }; typedef struct tagFP0PinStat { unsigned short OE:1; unsigned short RST:1; unsigned short SYN:1; unsigned short ACK:1; unsigned short SEL:1; }stFP0PinStat; #define RST_PORT GPIOB #define RST_PIN LL_GPIO_PIN_9 #define SYN_PORT GPIOF #define SYN_PIN LL_GPIO_PIN_6 #define ACK_PORT GPIOA #define ACK_PIN LL_GPIO_PIN_11 #define FP0DE_PORT GPIOF #define FP0DE_PIN LL_GPIO_PIN_7 #define OE_PORT GPIOB #define OE_PIN LL_GPIO_PIN_6 #define SEL_PORT GPIOB #define SEL_PIN LL_GPIO_PIN_8 #define GetRSTPin() LL_GPIO_IsInputPinSet(RST_PORT,RST_PIN) #define GetSYNPin() LL_GPIO_IsInputPinSet(SYN_PORT,SYN_PIN) #define GetOEPin() LL_GPIO_IsInputPinSet(OE_PORT,OE_PIN) #define GetSELPin() (1) //LL_GPIO_IsInputPinSet(SEL_PORT,SEL_PIN) #define GetACKPin() LL_GPIO_IsInputPinSet(ACK_PORT,ACK_PIN) #define SetACKPin_0() LL_GPIO_ResetOutputPin(ACK_PORT,ACK_PIN) #define SetACKPin_1() LL_GPIO_SetOutputPin(ACK_PORT,ACK_PIN) #define SetFP0DEPin_0() LL_GPIO_ResetOutputPin(FP0DE_PORT,FP0DE_PIN) #define SetFP0DEPin_1() LL_GPIO_SetOutputPin(FP0DE_PORT,FP0DE_PIN) extern uint8_t PkgBuf1[32]; extern uint8_t PkgBuf2[32]; extern uint8_t PkgLen1; extern uint8_t PkgLen2; extern uint8_t bReceiving; extern uint8_t nReceivedLen; extern uint8_t bSending; extern uint8_t bSentLen; extern uint8_t bConfiged; extern uint8_t nInputBytes; extern uint8_t nOutputBytes; extern unsigned char SPI1RecvBuf[32]; extern unsigned char SPI1SendBuf[32]; extern volatile unsigned char bSPI1Recving; extern volatile unsigned char bSPI1RecvDone; extern volatile unsigned char nSPI1RecvPos; extern volatile unsigned char nSPI1RecvLenInBuf; extern volatile unsigned char nSPI1ToSendLen; extern volatile unsigned char nSPI1SentLen; extern volatile unsigned char bSPI1Sending; extern volatile unsigned char bSPI1SendDone; extern volatile int oldSYN; typedef struct tagFP0QuRplyPkg { uint8_t Hdr1; uint8_t nInputBytes; uint8_t nOutputBytes; uint8_t nParam1; uint8_t nBCC; uint8_t End1; }stFP0QuRplyPkg, *pFP0QuRplyPkg; typedef struct tagFP0EXGRplyPkg { uint8_t Hdr1; uint8_t nInputBytes[6]; uint8_t nBCC; uint8_t End1; }stFP0EXGRplyPkg, * pFP0EXGRplyPkg; uint8_t FP0_Init(void); uint8_t FP0_Proc(void); uint8_t CalFP0BCC(uint8_t* pBuf, uint8_t len1); uint8_t CheckFP0Pkg(uint8_t * pBuf, uint8_t len1); uint8_t ParseFP0Pkg(uint8_t * pBuf, uint8_t len1); uint8_t SendFP0Pkg(uint8_t * pBuf, uint8_t len1); #endif /* __FP0_H__ */