Skip to content

Conversation

@Placebo27
Copy link
Contributor

@Placebo27 Placebo27 commented May 7, 2023

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

在AT32F437-START开发板上使用IAR编译project工程会报“结构体类型不匹配的问题”,定位原因到drv_gpio.c与pin.h文件中。
在此给出文件的详细路径:

bsp/at32/libraries/rt_drivers/drv_gpio.c
components/drivers/include/drivers/pin.h
查看pin.h文件中struct rt_pin_ops 原型:

struct rt_pin_ops
{
void (*pin_mode)(struct rt_device *device, rt_base_t pin, rt_uint8_t mode);
void (*pin_write)(struct rt_device *device, rt_base_t pin, rt_uint8_t value);
rt_int8_t (*pin_read)(struct rt_device *device, rt_base_t pin);
rt_err_t (*pin_attach_irq)(struct rt_device *device, rt_base_t pin,
rt_uint8_t mode, void (*hdr)(void *args), void *args);
rt_err_t (*pin_detach_irq)(struct rt_device *device, rt_base_t pin);
rt_err_t (*pin_irq_enable)(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled);
rt_base_t (*pin_get)(const char *name);
};
发现两部分类型并不匹配!

你的解决方案是什么 (what is your solution)

把不匹配的参数类型修改成正确的类型。具体来说把drv_gpio.c中下列函数的形参或返回值修改为跟rt_pin_ops操作方法中的成员形参与返回值一致。重新修改之后的drv_gpio.c中函数原型如下:

static void at32_pin_mode(rt_device_t dev, rt_base_t pin, rt_uint8_t mode)
static void at32_pin_write(rt_device_t dev, rt_base_t pin, rt_uint8_t value)
static rt_int8_t at32_pin_read(rt_device_t dev, rt_base_t pin)
static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_base_t pin,
rt_uint8_t mode, void (*hdr)(void *args), void *args)
static rt_err_t at32_pin_dettach_irq(struct rt_device *device, rt_base_t pin)
static rt_err_t at32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
rt_uint8_t enabled)
static rt_base_t at32_pin_get(const char *name)

在什么测试环境下测试通过 (what is the test environment)

]

当前拉取/合并请求的状态 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 styles
  • 没有垃圾代码,代码尽量精简,不包含#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
  • 已经使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@CLAassistant
Copy link

CLAassistant commented May 7, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@CuttySark1869 CuttySark1869 left a comment

Choose a reason for hiding this comment

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

感谢pr。修改的文件可否用formatting处理下?自动检测有些小问题比如空格之类的,都是之前遗留下来的。
https://github.com/mysterywolf/formatting

@Placebo27
Copy link
Contributor Author

感谢pr。修改的文件可否用formatting处理下?自动检测有些小问题比如空格之类的,都是之前遗留下来的。 https://github.com/mysterywolf/formatting

好的

@Placebo27 Placebo27 marked this pull request as ready for review May 7, 2023 17:40
@Placebo27 Placebo27 requested a review from CuttySark1869 May 7, 2023 17:41
@mysterywolf
Copy link
Member

感谢提交PR,CI检查项第一项报错可以忽略

@mysterywolf mysterywolf added the +1 Agree +1 label May 8, 2023
@Guozhanxin Guozhanxin added the +2 Agree +2 label May 9, 2023
@mysterywolf mysterywolf merged commit 538158b into RT-Thread:master May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSP +1 Agree +1 +2 Agree +2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants