3_littlefs
config BSP_USING_SPI_FLASH
bool "Enable SPI FLASH (W25Q128 spi2)"
select BSP_USING_SPI
select BSP_USING_SPI2
select RT_USING_SFUD
select RT_SFUD_USING_SFDP
default n#include <rtthread.h>
#include "spi_flash.h"
#include "spi_flash_sfud.h"
#include <drv_spi.h>
#include <drv_gpio.h>
#if defined(BSP_USING_SPI_FLASH)
static int rt_hw_spi_flash_init(void)
{
__HAL_RCC_GPIOB_CLK_ENABLE();
rt_hw_spi_device_attach("spi2", "spi20", GET_PIN(B, 12));
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi20"))
{
return -RT_ERROR;
}
return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
#endif最后更新于