1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2018-11-27 SummerGift add spi flash port file 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_gpio.h> 16 17 #if defined(BSP_USING_SPI_FLASH) rt_hw_spi_flash_init(void)18static int rt_hw_spi_flash_init(void) 19 { 20 __HAL_RCC_GPIOA_CLK_ENABLE(); 21 rt_hw_spi_device_attach("spi1", "spi10", GET_PIN(A, 4)); 22 23 if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi10")) 24 { 25 return -RT_ERROR; 26 }; 27 28 return RT_EOK; 29 } 30 INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init); 31 #endif 32 33