1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-6-14      solar        first version
9  */
10 
11 #include <rtthread.h>
12 #include "dev_spi_flash.h"
13 #include "dev_spi_flash_sfud.h"
14 #include <drv_spi.h>
15 #include <drv_soft_spi.h>
16 
17 #ifdef BSP_USING_SOFT_SPI_FLASH
18 
rt_soft_spi_flash_init(void)19 static int rt_soft_spi_flash_init(void)
20 {
21     __HAL_RCC_GPIOB_CLK_ENABLE();
22     rt_hw_soft_spi_device_attach("sspi2", "sspi20", "PB.14");
23 
24     if (RT_NULL == rt_sfud_flash_probe("W25Q128", "sspi20"))
25     {
26         return -RT_ERROR;
27     }
28 
29     return RT_EOK;
30 }
31 INIT_COMPONENT_EXPORT(rt_soft_spi_flash_init);
32 #endif /* BSP_USING_SOFT_SPI_FLASH */
33