Skip to content

nrf52 - fix i2c/twi driver #11676

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

Merged
merged 1 commit into from
Oct 15, 2019

Conversation

maciejbocianski
Copy link
Contributor

Sync TWI driver to sdk version 15.3.0 to get rid of data length limitation

Description

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@jamesbeyond

Release Notes

@maciejbocianski maciejbocianski changed the title nrf5x - fix i2c/twi driver nrf52 - fix i2c/twi driver Oct 11, 2019
@ciarmcom ciarmcom requested review from jamesbeyond and a team October 11, 2019 19:00
@ciarmcom
Copy link
Member

@maciejbocianski, thank you for your changes.
@jamesbeyond @ARMmbed/mbed-os-maintainers please review.

@40Grit
Copy link

40Grit commented Oct 11, 2019

I could always tell whoever wrote the nrf i2c driver probably had not used it very extensively.

Was really annoying bug, especially when trying to dump an accelerometers large sample buffer.

Though using int like the mbed os api does is not much better.

Sync TWI driver to sdk version 15.3.0 to get rid of data length limitation
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 14, 2019

Though using int like the mbed os api does is not much better.

Is this related to drivers using basic types like int ?

@kjbracey
Copy link
Contributor

Is this related to drivers using basic types like int ?

Just like uint8_t can be too small for data size, so could int. size_t is technically correct.

But in practice, in Mbed OS-size embedded systems, int is probably fine, and may be preferable. For example, Nanostack tends to avoid size_t, due to 8 or 16-bit platforms that use a large memory model to address ROM (>64K), but have <64K RAM. In those platforms, size_t is 32-bit to cope with ROM objects, but it's overkill and bloat for RAM buffers. So I'd be sympathetic for int if envisaging portability to those systems.

But if assuming 32-bit ARM or bigger, then size_t is solid - there's no overhead, and only a benefit when you go 64-bit.

@40Grit
Copy link

40Grit commented Oct 14, 2019

@0xc0170, @kjbracey-arm

My main beef with int is its signed-ness and the fact that it provides no implication as to it's use.

Maybe if we had an '''i2c_tranceive()''' function signed length would make sense. I joke.

I am a huge fan of type defining for context as well.

@kjbracey
Copy link
Contributor

My main beef with int is its signed-ness and the fact that it provides no implication as to it's use.

I'm aware that there's a large contingent of people who regard the unsignedness of size_t as a significant problem. (eg https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-nonnegative) I can see the arguments both ways.

I am a huge fan of type defining for context as well.

Agreed - if doing that, I'd prefer to have some sort of buffer_size_t typedef to at least indicate what it is. (Even if it doesn't actually cause any real compiler type checking).

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 15, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Oct 15, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants