Skip to content

Commit

Permalink
fix miscalculation in read_gpioab due to missing parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
mrd0ll4r committed Aug 25, 2020
1 parent a3d0727 commit 61933f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ where
/// Reads all 16 pins (port A and B) into a single 16 bit variable.
pub fn read_gpioab(&mut self) -> Result<u16, E> {
let buffer = self.read_double_register(Register::GPIOA)?;
Ok((buffer[0] as u16) << 8 + (buffer[1] as u16))
Ok((buffer[0] as u16) << 8 | (buffer[1] as u16))
}

/// Reads a single port, A or B, and returns its current 8 bit value.
Expand Down

0 comments on commit 61933f8

Please sign in to comment.