Skip to content

Conversation

@wangyq2018
Copy link
Contributor

@wangyq2018 wangyq2018 commented Feb 25, 2019

拉取/合并请求描述:(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):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other style
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality

@BernardXiong BernardXiong requested a review from misonyo February 25, 2019 15:12

source "drivers/Kconfig"

if RT_USING_W25QXX || RT_USING_SFUD
Copy link
Contributor

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

@@ -0,0 +1,142 @@
/*
* File : drv_i2c.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面把file这一行都去掉吧,和其他文档统一一下。

RT_NULL,
};

int drv_i2c_init(void)
Copy link
Contributor

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()

#ifndef DRV_I2C_H__
#define DRV_I2C_H__

int hw_i2c_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为rt_hw_i2c_init()

* File : drv_i2c.c
* Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
*
* description: I2C0_SCL->PB8, I2C0_SDA->PB9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多余的描述信息也不要放这里吧,可以放GPIO初始化的函数那里,作为注释。

* File : drv_spi.c
* Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
*
* description: SPI0_SCK->PB3, SPI0_MISO->PB4, SPI0_MOSI->PB5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

描述信息和file移除保持风格统一。

#ifndef DRV_NOR_FLASH_H__
#define DRV_NOR_FLASH_H__

extern int rt_w25qxx_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个函数不需要extern进来。

#define DRV_NOR_FLASH_H__

extern int rt_w25qxx_init(void);
int rt_nor_flash_init(void)
Copy link
Contributor

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()更合适?

es32f0_spi_bus_attach_device(RT_FLASH_CS_PIN, RT_FLASH_SPI_BUS_NAME, "spi00");

#ifdef RT_USING_W25QXX
return w25qxx_init("flash0", "spi00");
Copy link
Contributor

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。

src += ['drv_i2c.c']

# add w25qx flash driver code
if GetDepend('RT_USING_W25QXX') or GetDepend('RT_USING_SFUD'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里判断BSP_USING_SPI_FLASH就好了。

Copy link
Contributor

@misonyo misonyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改过几次了,可以merge。

@BernardXiong BernardXiong merged commit 8eb7e02 into RT-Thread:master Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants