Skip to content

Commit

Permalink
Make sure sw_enablement doesn't overwrite register
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Schaefer <dhs@frame.work>
  • Loading branch information
JohnAZoidberg committed Sep 19, 2023
1 parent 03f8dea commit 51188d1
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 @@ -127,7 +127,7 @@ where

/// How many SW rows to enable
pub fn sw_enablement(&mut self, setting: SwSetting) -> Result<(), I2cError> {
let config_register = 1; // Shutdown disable
let config_register = self.read_register(Page::Config, addresses::CONFIG_REGISTER)?;

let new_val = (config_register & 0x0F) | (setting as u8) << 4;
self.write_register(Page::Config, addresses::CONFIG_REGISTER, new_val)?;
Expand Down

0 comments on commit 51188d1

Please sign in to comment.