1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /*****************************************************************************
- AT25DF.h
- *****************************************************************************/
- #ifndef _AT25DF_H
- #define _AT25DF_H
- /*****************************************************************************/
- #include <stm32f10x.h>
- #define AT25DF_CS_PIN GPIO_Pin_4 /* PA.04 */
- #define AT25DF_CS_GPIO_PORT GPIOA /* GPIOA */
- #define AT25DF_CS_GPIO_CLK RCC_APB2Periph_GPIOA
- #define AT25DF_CS_LOW() GPIO_ResetBits(AT25DF_CS_GPIO_PORT, AT25DF_CS_PIN)
- #define AT25DF_CS_HIGH() GPIO_SetBits(AT25DF_CS_GPIO_PORT, AT25DF_CS_PIN)
- #define AT25DF_SPI SPI1
- #define AT25DF_SPI_CLK RCC_APB2Periph_SPI1
- #define AT25DF_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */
- #define AT25DF_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */
- #define AT25DF_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOA
- #define AT25DF_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */
- #define AT25DF_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */
- #define AT25DF_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOA
- #define AT25DF_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */
- #define AT25DF_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */
- #define AT25DF_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOA
- int AT25DF_Init(void);
- void SPI_Flash_Global_Protect(void);
- void SPI_Flash_Global_Unprotect(void);
- void SPI_Flash_Erase_Chip(void);
- void SPI_Flash_Erase_Sector(u32 Dst_Addr);
- void SPI_Flash_Read(u8* pBuffer,u32 ReadAddr,u16 NumByteToRead);
- void SPI_Flash_Write(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);
- void SPI_Flash_Write_NoCheck(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);
- void SPI_Flash_PowerDown(void);
- void SPI_Flash_WAKEUP(void);
- void SPI_Flash_Unprotect_Sector(u32 Dst_Addr);
- void SPI_Flash_Protect_Sector(u32 Dst_Addr);
- void AT25DFTest(void);
- void DelayUs(u16 myUs);
- /*****************************************************************************/
- #endif
- /*****************************************************************************/
|