91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 12KB
    文件類型: .zip
    金幣: 2
    下載: 4 次
    發布日期: 2021-05-29
  • 語言: C/C++
  • 標簽: STM32??FM1702??

資源簡介

STM32單片機驅動射頻芯片FM1702,C語言實現,包含C文件和H文件

資源截圖

代碼片段和文件信息



#include?“stm32f10x.h“
#include?“rsport.h“
#include?“string.h“
#include?“rsos.h“??
?
#include?“FM1702.h“ ???



unsigned?char tagtype[2]; ????????????/*?卡片標識字符?*/?
unsigned?char???MF_CardType; ???//讀頭發回的卡類型

unsigned?char RevBuffer[40]; ????????/*?FM1702命令發送接收緩沖區?*/
unsigned?char UID2[8]; ????????????/*?序列號?*/




static?rst_gpio?csgpio;
static?rst_spi??pcdspi;
static?rst_gpio?rstgpio={00};



void?FM1702_NotSelect(void)
{
//????GPIO_SetBits(FM1702_GPIOFM1702_CS_PIN);
????rs_setgpio(&csgpio);
}
void?FM1702_Select(void)
{
//????GPIO_ResetBits(FM1702_GPIOFM1702_CS_PIN);???
????rs_resetgpio(&csgpio);
}
void?FM1702_Reset(void)
{
rs_resetgpio(&csgpio);
rs_resetgpio(&csgpio);
rs_setgpio(&rstgpio);
rs_delayus(30000);
rs_resetgpio(&rstgpio);??
rs_delayus(10000);
rs_setgpio(&csgpio);
}

uint8_t?SPI_SendByte(uint8_t?byte)
{
????while(SPI_I2S_GetFlagStatus(pcdspi?SPI_I2S_FLAG_TXE)?==?RESET);
????SPI_I2S_SendData(pcdspi?byte);???????????????
????while(SPI_I2S_GetFlagStatus(pcdspi?SPI_I2S_FLAG_TXE)?==?RESET);
????while(SPI_I2S_GetFlagStatus(pcdspi?SPI_I2S_FLAG_RXNE)?==?RESET);
????return?SPI_I2S_ReceiveData(pcdspi);
}
uint8_t?SPI_ReadByte(void)
{
????return?(SPI_SendByte(0));
}


/****************************************************************/
/*名稱:?SPIRead?*/
/*功能:?該函數根據給定的地址讀取FM1702SL的寄存器*/
/*輸入:?寄存器地址?讀出值存放首地址*/
/*輸出:?寄存器值*/
/****************************************************************/
unsigned?char?SPIRead(unsigned?char?SpiAddress)
{
unsigned?char?rdata;

SpiAddress?=?SpiAddress?< SpiAddress?=?SpiAddress?|?0x80;
FM1702_Select();

//Send?SpiAddress;
SPI_SendByte(SpiAddress);

//Receive?data
rdata?=?SPI_SendByte(0);

FM1702_NotSelect();
return?(rdata);
}

/****************************************************************/
/*名稱:?SPIWrite?*/
/*功能:?該函數根據給定的地址寫入FM1702SL的寄存器*/
/*輸入:?寄存器地址要寫入的字節數?*/
/*輸出:?N/A*/
/****************************************************************/
void?SPIWrite(unsigned?char?SpiAddressunsigned?char?SpiData)
{
SpiAddress?=?SpiAddress?< SpiAddress?=?SpiAddress?&?0x7e;
FM1702_Select();

//Send?SpiAddress
SPI_SendByte(SpiAddress);

// Send?data;
SPI_SendByte(SpiData);

FM1702_NotSelect();
}
/****************************************************************/


/****************************************************************/
/*名稱:?Read_Card_Serial ????*/
/*功能:?該函數實現讀取卡片序列號 */
/*輸入:?serial:?卡片序列號的存儲首地址 */
/*輸出:?讀卡片產生的狀態碼 */
/****************************************************************/
unsigned?char?Read_Card_Serial(unsigned?char?*serial)
{
unsigned?char?status;

??? status?=?Intern_Read_Card_Serial(serial); ?//讀取卡片序列號到serial??
????if(status?!=?FM1702_OK)?
??? ????status?=?Intern_Read_Card_Serial(serial);

return?status;
}?

unsigned?char?Card_Authentication(unsigned?char?*serialunsi

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????10380??2013-07-08?14:51??FM1702.h
?????文件???????50858??2013-07-08?14:50??FM1702.c

評論

共有 條評論