Skip to content

Commit

Permalink
[update] code_project
Browse files Browse the repository at this point in the history
  • Loading branch information
balanceTWK committed Feb 23, 2020
1 parent 37906bc commit a099b16
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 61 deletions.
3 changes: 3 additions & 0 deletions code_project/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ if GetDepend(['BSP_USING_USBD']):
if GetDepend(['BSP_USING_PULSE_ENCODER']):
src += ['drv_pulse_encoder.c']

if GetDepend(['BSP_USING_SPI_FLASH']):
src += ['drv_spi_flash.c']

src += ['drv_common.c']

path = [cwd]
Expand Down
35 changes: 35 additions & 0 deletions code_project/drivers/drv_spi_flash.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-02-23 balanceTWK the first version
*/

#include <rtthread.h>
#include "spi_flash.h"
#include "spi_flash_sfud.h"
#include "drv_spi.h"

#define DBG_TAG "spi_flash"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>

#if defined(BSP_USING_SPI_FLASH)
static int rt_hw_spi_flash_init(void)
{
__HAL_RCC_GPIOA_CLK_ENABLE();
rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_15);

if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi10"))
{
return -RT_ERROR;
}
return RT_EOK;
}
INIT_PREV_EXPORT(rt_hw_spi_flash_init);

#endif

61 changes: 0 additions & 61 deletions code_project/drivers/spi_flash_init.c

This file was deleted.

7 changes: 7 additions & 0 deletions code_project/project.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@
<FilePath>drivers\drv_spi.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>drv_spi_flash.c</FileName>
<FileType>1</FileType>
<FilePath>drivers\drv_spi_flash.c</FilePath>
</File>
</Files>
<Files>
<File>
<FileName>drv_common.c</FileName>
Expand Down

0 comments on commit a099b16

Please sign in to comment.