Updated lps25hb to handle i2c errors#2698
Merged
bors[bot] merged 4 commits intoJul 29, 2021
Merged
Conversation
bradjc
requested changes
Jul 27, 2021
2 tasks
bradjc
previously approved these changes
Jul 28, 2021
lschuermann
previously approved these changes
Jul 28, 2021
Contributor
|
Need to update to |
alistair23
previously approved these changes
Jul 29, 2021
Co-authored-by: Brad Campbell <bradjc5@gmail.com>
7d345a2
0426512 to
7d345a2
Compare
bradjc
approved these changes
Jul 29, 2021
Contributor
|
bors r+ |
Contributor
bors Bot
added a commit
that referenced
this pull request
Aug 1, 2021
2701: Separate schedule_upcall number and values through Rust types r=phil-levis a=alexandruradovici
### Pull Request Overview
This pull request groups the values returned by `schedule_upcall` into a tuple to prevent wrongly placing a value instead of the upcall number.
```rust
pub fn schedule_upcall(
&self,
subscribe_num: usize,
r: (usize, usize, usize),
) -> Result<(), UpcallError>
```
This tries to use Rust's type system to clearly separate the upcall number and the values. The `schedule_upcall` takes four `usize` parameters, the first one being the upcall number and the following three the values returned to the application. As all four parameters have the same type, it is easy to forget that the first parameter is the upcall number, not the first value. The compiler has no way of protecting against this error.
This is inspired from the error within #2698.
There should be no impact in size or performance.
### Testing Strategy
N/A
### TODO or Help Wanted
N/A
### Documentation Updated
- [x] Updated the relevant files in `/docs`, or no updates are required.
### Formatting
- [x] Ran `make prepush`.
Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>
Co-authored-by: Alexandru Radovici <alexandru.radovici@wyliodrin.com>
sirchnik
pushed a commit
to sirchnik/tock
that referenced
this pull request
May 12, 2026
2698: Updated lps25hb to handle i2c errors r=bradjc a=Cristiana959 ### Pull Request Overview This pull request adds i2c error verification for the lps25hb drivers. ### Testing Strategy This pull request was not tested as I do not own the sensor. ### TODO or Help Wanted N/A ### Documentation Updated - [x] No updates required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Cristiana959 <cristiana699@gmail.com> Co-authored-by: Cristiana Andrei <63002082+Cristiana959@users.noreply.github.com>
sirchnik
pushed a commit
to sirchnik/tock
that referenced
this pull request
May 12, 2026
2701: Separate schedule_upcall number and values through Rust types r=phil-levis a=alexandruradovici
### Pull Request Overview
This pull request groups the values returned by `schedule_upcall` into a tuple to prevent wrongly placing a value instead of the upcall number.
```rust
pub fn schedule_upcall(
&self,
subscribe_num: usize,
r: (usize, usize, usize),
) -> Result<(), UpcallError>
```
This tries to use Rust's type system to clearly separate the upcall number and the values. The `schedule_upcall` takes four `usize` parameters, the first one being the upcall number and the following three the values returned to the application. As all four parameters have the same type, it is easy to forget that the first parameter is the upcall number, not the first value. The compiler has no way of protecting against this error.
This is inspired from the error within tock#2698.
There should be no impact in size or performance.
### Testing Strategy
N/A
### TODO or Help Wanted
N/A
### Documentation Updated
- [x] Updated the relevant files in `/docs`, or no updates are required.
### Formatting
- [x] Ran `make prepush`.
Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>
Co-authored-by: Alexandru Radovici <alexandru.radovici@wyliodrin.com>
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.
Pull Request Overview
This pull request adds i2c error verification for the lps25hb drivers.
Testing Strategy
This pull request was not tested as I do not own the sensor.
TODO or Help Wanted
N/A
Documentation Updated
Formatting
make prepush.