Skip to content

Updated lps25hb to handle i2c errors#2698

Merged
bors[bot] merged 4 commits into
tock:masterfrom
WyliodrinEmbeddedIoT:i2c_return_buffers_for_lps25hb
Jul 29, 2021
Merged

Updated lps25hb to handle i2c errors#2698
bors[bot] merged 4 commits into
tock:masterfrom
WyliodrinEmbeddedIoT:i2c_return_buffers_for_lps25hb

Conversation

@Cristiana959

Copy link
Copy Markdown
Contributor

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

  • No updates required.

Formatting

  • Ran make prepush.

Comment thread capsules/src/lps25hb.rs Outdated
Comment thread capsules/src/lps25hb.rs Outdated
bradjc
bradjc previously approved these changes Jul 28, 2021
lschuermann
lschuermann previously approved these changes Jul 28, 2021
@bradjc

bradjc commented Jul 28, 2021

Copy link
Copy Markdown
Contributor

Need to update to kernel::errorcode::into_statuscode.

alistair23
alistair23 previously approved these changes Jul 29, 2021
@Cristiana959 Cristiana959 dismissed stale reviews from alistair23, lschuermann, and bradjc via 7d345a2 July 29, 2021 09:24
@Cristiana959 Cristiana959 force-pushed the i2c_return_buffers_for_lps25hb branch from 0426512 to 7d345a2 Compare July 29, 2021 09:24
@bradjc

bradjc commented Jul 29, 2021

Copy link
Copy Markdown
Contributor

bors r+

@bors

bors Bot commented Jul 29, 2021

Copy link
Copy Markdown
Contributor

@bors bors Bot merged commit 0d69eb1 into tock:master Jul 29, 2021
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants