-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[device]修改i2c读写函数返回类型为rt_ssize_t #7029
Conversation
@@ -118,16 +118,16 @@ rt_size_t rt_i2c_master_send(struct rt_i2c_bus_device *bus, | |||
|
|||
ret = rt_i2c_transfer(bus, &msg, 1); | |||
|
|||
return (ret > 0) ? count : ret; | |||
return ret; |
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.
Not back-compatible. It SHOULD return byte count value if sent an I2C message successfully.
@@ -138,11 +138,5 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus, | |||
|
|||
ret = rt_i2c_transfer(bus, &msg, 1); | |||
|
|||
return (ret > 0) ? count : ret; | |||
return ret; |
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.
Not back-compatible. It SHOULD return byte count value if received an I2C message successfully.
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.
5.0.0不考虑向前兼容的问题,一些历史包袱需要在这个版本中逐步得到解决,返回值改为:如果返回值>=0 为成功传输的长度,<0为传输出现错误并返回错误码
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.
如果返回值>=0 为成功传输的长度
所以這兩個 APIs 應該回傳成功传输 "byte count" 長度; 而不是"message number"。對嗎?
Caller 提交的是 send/receive byte length; 而成功回傳的是 message count。 不太合理。
這一改,又一堆 3rd contributed packages NG 了。
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.
噢噢 我理解你的意思了 这个地方有问题 返回应该是成功传输的长度,而不是message number。我落实下去来改。
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.
Thanks Meco.
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
[修改i2c读写函数返回类型为rt_ssize_t]
你的解决方案是什么 (what is your solution)
[修改i2c读写函数返回类型为rt_ssize_t]
在什么测试环境下测试通过 (what is the test environment)
]
当前拉取/合并请求的状态 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