spi_driver.c

来自「SD卡驱动基于SPI总线与SD卡通信」· C语言 代码 · 共 105 行

C
105
字号
#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 + =
减小字号Ctrl + -
显示快捷键?