Skip to content

cpu/stm32l0: implement i2C non blocking mode#7864

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
Marc-Aurele:i2c_timeout_l0
Nov 9, 2017
Merged

cpu/stm32l0: implement i2C non blocking mode#7864
aabadie merged 1 commit intoRIOT-OS:masterfrom
Marc-Aurele:i2c_timeout_l0

Conversation

@Marc-Aurele
Copy link
Copy Markdown
Contributor

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.

@miri64 miri64 requested a review from aabadie October 28, 2017 15:03
@miri64 miri64 added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Oct 28, 2017
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

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;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unrelated change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done


/* read the data bytes */
_read(i2c, data, length);
if (_read(i2c, data, length) < 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 7, 2017

Tested with a MPU9150 (accelerometer) and I2C still works.

ACK, please squash in a single commit with message:

cpu/stm32l0: implement i2C non blocking mode

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]>
@Marc-Aurele Marc-Aurele changed the title cpu/stm32l0 : i2c non blocking mode implementation cpu/stm32l0: implement i2C non blocking mode Nov 7, 2017
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

ACK and go.

Thanks again @Marc-Aurele !

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 9, 2017
@aabadie aabadie merged commit 283c207 into RIOT-OS:master Nov 9, 2017
@aabadie aabadie added this to the Release 2018.01 milestone Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants