/// Returns device status
pub fn status(&mut self) -> Status {
let status = self.read_byte(Register::status);
Status {
measuring: (1 == status & 0b00001000),
im_update: (1 == status & 0b00000001),
}
}
Correct:
/// Returns device status
pub fn status(&mut self) -> Status {
let status = self.read_byte(Register::status);
Status {
measuring: (status & 0b00001000) != 0b0,
im_update: (status & 0b00000001) != 0b0,
}
}
The expression
1 == status & 0b00001000
will always evaluate tofalse
.Wrong:
Correct: