cpu/stm32l0: implement i2C non blocking mode#7864
Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom Nov 9, 2017
Merged
Conversation
aabadie
requested changes
Oct 29, 2017
Contributor
aabadie
left a comment
There was a problem hiding this comment.
Thanks again for this PR. I won't be able to test soon but it looks good. Maybe @vincent-d can also have a look and test ?
| DEBUG("Generate stop condition\n"); | ||
| dev->CR2 |= I2C_CR2_STOP; | ||
| } | ||
|
|
cpu/stm32l0/periph/i2c.c
Outdated
|
|
||
| /* read the data bytes */ | ||
| _read(i2c, data, length); | ||
| if (_read(i2c, data, length) < 0) |
Contributor
There was a problem hiding this comment.
Please add opening and closing curly braces, even for one line blocks. Even if it's more verbose, this improves code readability.
I found this in other places of your changes.
Contributor
|
Tested with a MPU9150 (accelerometer) and I2C still works. ACK, please squash in a single commit with message: |
Timeouts have been added in I2C driver on the stm32l0 family so that any while loop do not stall the task forever. Signed-off-by: Aurelien Fillau <[email protected]>
a5c86aa to
4eee79a
Compare
aabadie
approved these changes
Nov 9, 2017
Contributor
aabadie
left a comment
There was a problem hiding this comment.
ACK and go.
Thanks again @Marc-Aurele !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the non blocking mode for I2C on stm32l0 family cpu. A timeout and a check of the error flags have been added for each "while" loop.