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

📄 sd.h

📁 AVR单片机做的MP3
💻 H
字号:
/*M16-SPI*/
#define SD_SS          PB4
#define SD_SCK         PB7
#define SD_MOSI        PB5
#define SD_MISO        PB6

#define SD_DDR         DDRB
#define SD_PORT        PORTB
#define SD_PIN         PINB

#define SD_SS_H        SD_PORT |= (1<<SD_SS)
#define SD_SS_L        SD_PORT &= ~(1<<SD_SS)

#define SD_MISO_IN     (SD_PIN&(1<<SD_MISO))
//------------------------------------------------------------
// Error define
//-------------------------------------------------------------
#define INIT_OK                  0x00
#define READ_BLOCK_OK            0x00
#define INIT_CMD0_ERROR          0x01
#define INIT_CMD1_ERROR		     0x02
#define WRITE_BLOCK_ERROR	     0x03
#define READ_BLOCK_ERROR   	     0x04

// MMC/SD commands

//set MMC_Chip_Select to high (MMC/SD-Card Invalid)
#define SD_Disable()   SD_SS_H
//set MMC_Chip_Select to low (MMC/SD-Card Active)
#define SD_Enable()    SD_SS_L



uint8 SD_Init(void);
//void SD_Port_Init(void);
uint8 sd_write_sector(uint32 addr,uint8 *Buffer);
//uint8 Write_Command_SD(uint8 *cmd);
//uint8 SD_Read_Block(uint8 *CMD,uint8 *Buffer,uint16 Bytes);
uint8 SD_read_sector(uint32 addr,uint8 *Buffer);

//void SPI_TransferByte(uint8 cmp1);
//uint8 SPI_ReadferByte(uint8 cmp1);
void uart_init(void);
void put_c(uint8 c);
void put_s(char *ptr);

⌨️ 快捷键说明

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