1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2023-01-10 luobeihai 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 16 #if defined(BSP_USING_SPI_FLASH) rt_hw_spi_flash_init(void)17static int rt_hw_spi_flash_init(void) 18 { 19 RCM_EnableAHB1PeriphClock(RCM_AHB1_PERIPH_GPIOF); 20 rt_hw_spi_device_attach("spi1", "spi10", GPIOF, GPIO_PIN_5); 21 22 if (RT_NULL == rt_sfud_flash_probe("W25Q16", "spi10")) 23 { 24 return -RT_ERROR; 25 } 26 27 return RT_EOK; 28 } 29 INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init); 30 #endif 31 32