-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[bsp/es32f0654]add spi/i2c drivers #2367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bsp/es32f0654/Kconfig
Outdated
|
|
||
| source "drivers/Kconfig" | ||
|
|
||
| if RT_USING_W25QXX || RT_USING_SFUD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里对于flash的选择项放到driver下面的kconfig里面,参考stm32,放到板载外设菜单类,使用宏BSP_USING_SPI_FLASH
bsp/es32f0654/drivers/drv_i2c.c
Outdated
| @@ -0,0 +1,142 @@ | |||
| /* | |||
| * File : drv_i2c.c | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后面把file这一行都去掉吧,和其他文档统一一下。
bsp/es32f0654/drivers/drv_i2c.c
Outdated
| RT_NULL, | ||
| }; | ||
|
|
||
| int drv_i2c_init(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数改为rt_hw_i2c_init(),驱动函数初始化的命名统一加rt_hw_xxx_init()
bsp/es32f0654/drivers/drv_i2c.h
Outdated
| #ifndef DRV_I2C_H__ | ||
| #define DRV_I2C_H__ | ||
|
|
||
| int hw_i2c_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改为rt_hw_i2c_init()
bsp/es32f0654/drivers/drv_i2c.c
Outdated
| * File : drv_i2c.c | ||
| * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. | ||
| * | ||
| * description: I2C0_SCL->PB8, I2C0_SDA->PB9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多余的描述信息也不要放这里吧,可以放GPIO初始化的函数那里,作为注释。
bsp/es32f0654/drivers/drv_spi.c
Outdated
| * File : drv_spi.c | ||
| * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. | ||
| * | ||
| * description: SPI0_SCK->PB3, SPI0_MISO->PB4, SPI0_MOSI->PB5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
描述信息和file移除保持风格统一。
bsp/es32f0654/drivers/drv_spiflash.h
Outdated
| #ifndef DRV_NOR_FLASH_H__ | ||
| #define DRV_NOR_FLASH_H__ | ||
|
|
||
| extern int rt_w25qxx_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数不需要extern进来。
bsp/es32f0654/drivers/drv_spiflash.h
Outdated
| #define DRV_NOR_FLASH_H__ | ||
|
|
||
| extern int rt_w25qxx_init(void); | ||
| int rt_nor_flash_init(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数参考STM32命名为rt_hw_spi_flash_init()更合适?
bsp/es32f0654/drivers/drv_spiflash.c
Outdated
| es32f0_spi_bus_attach_device(RT_FLASH_CS_PIN, RT_FLASH_SPI_BUS_NAME, "spi00"); | ||
|
|
||
| #ifdef RT_USING_W25QXX | ||
| return w25qxx_init("flash0", "spi00"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参考stm32 BSP提供的FLASH移植文件,bsp\stm32\stm32f407-atk-explorer-fs-test\board\ports\spi_flash_init.c,probe的第一个函数的名称就取名为flash设备的信号,如W25Q128,w25qxx_init()应该是不需要调用的,然后这个函数和.h里面extern的名称有差别。SPI flash对应的宏判断为BSP_USING_SPI_FLASH。
bsp/es32f0654/drivers/SConscript
Outdated
| src += ['drv_i2c.c'] | ||
|
|
||
| # add w25qx flash driver code | ||
| if GetDepend('RT_USING_W25QXX') or GetDepend('RT_USING_SFUD'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里判断BSP_USING_SPI_FLASH就好了。
misonyo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改过几次了,可以merge。
拉取/合并请求描述:(PR description)
[ [bsp/es32f0654]add spi/i2c drivers ]
以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use web browser to visit PR, and check items one by one, and ticked them if no problem.
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up