⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi_driver.c

📁 SD卡驱动基于SPI总线与SD卡通信
💻 C
字号:
#include <REGX51.H>

//=============================================================
// Syntas  :	unsigned char SD_ChkCard(void)
// Function:	Check if the card is Present
// Argument:	None
// Return  :	1: Present
//				0: Not Present
//=============================================================
unsigned char SD_ChkCard(void)
{
	// The Card has been inserted if the CP pin is low
	// Put your code here

}
 
//=============================================================
// Syntas  :	void SD_IOInit(void)
// Function:	Initialize the IO of the SPI bus
// Argument:	None
// Return  :	None
//=============================================================
void SD_IOInit(void)
{
	// Put your code here

}

//=============================================================
// Syntas  :	unsigned char SD_ChkCardWP(void)
// Function:	Check if the card is WriteProtected
// Argument:	None
// Return  :	1: Protected
//				0: Not Protected
//=============================================================
unsigned char SD_ChkCardWP(void)
{
	// The Card is WritePortect if the WP pin is high
	// Put your code here

}

//=============================================================
// Syntas  :	void SPI_SendByte(unsigned char ucByte)
// Function:	Send a byte var SPI bus
// Argument:	ucByte	-	byte want to send
// Return  :	None
//=============================================================
void SPI_SendByte(unsigned char ucByte)
{
	// Put your code here

}

//=============================================================
// Syntas  :	unsigned char SPI_RecByte(void)
// Function:	Receive a byte from SPI bus
// Argument:	None
// Return  :	Received byte
//=============================================================
unsigned char SPI_RecByte(void)
{
	unsigned char Ret;
	// Put your code here

	return Ret;
}

//=============================================================
// Syntas  :	void SPI_CS_Assert(void)
// Function:	Pull Down CS Pin
// Argument:	None
// Return  :	None
//=============================================================
void SPI_CS_Assert(void)
{
	// Put your code here

}

//=============================================================
// Syntas  :	void SPI_CS_Deassert(void)
// Function:	Pull Up CS Pin
// Argument:	None
// Return  :	None
//=============================================================
void SPI_CS_Deassert(void)
{
	// Put your code here

}

//=============================================================
// Syntas  :	void SD_SPIDelay(unsigned char ucTim)
// Function:	SPI bus delay
// Argument:	ucTim	-	delay cycles
// Return  :	None
//=============================================================
void SD_SPIDelay(unsigned char ucTim)
{
	// Please Do not modify this code
	while(ucTim--)
		SPI_SendByte(0xff);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -