8000 HS3003: Removed Unnecessary Code by TheButterMineCutter · Pull Request #3708 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HS3003: Removed Unnecessary Code #3708

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 3 commits into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions capsules/extra/src/hs3003.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ use kernel::hil::sensors::{HumidityClient, HumidityDriver, TemperatureClient, Te
use kernel::utilities::cells::{OptionalCell, TakeCell};
use kernel::ErrorCode;

const I2C_ADDRESS: u8 = 0x44;

pub struct Hs3003<'a, I: I2CDevice> {
buffer: TakeCell<'static, [u8]>,
i2c: &'a I,
Expand Down Expand Up @@ -86,8 +84,6 @@ impl<'a, I: I2CDevice> Hs3003<'a, I> {
self.i2c.enable();
match self.state.get() {
State::Sleep => {
buffer[0] = I2C_ADDRESS << 1 | 0;

if let Err((_error, buffer)) = self.i2c.write(buffer, 1) {
self.buffer.replace(buffer);
self.i2c.disable();
Expand Down Expand Up @@ -152,9 +148,7 @@ impl<'a, I: I2CDevice> I2CClient for Hs3003<'a, I> {

match self.state.get() {
State::InitiateReading => {
buffer[0] = I2C_ADDRESS << 1 | 1;

if let Err((i2c_err, buffer)) = self.i2c.write_read(buffer, 1, 4) {
if let Err((i2c_err, buffer)) = self.i2c.read(buffer, 4) {
self.state.set(State::Sleep);
self.buffer.replace(buffer);
self.temperature_client
Expand Down
0