Skip to content

Commit

Permalink
Adding fix for AD5627 return voltage calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-summers committed Aug 20, 2020
1 parent 0c14d02 commit 50ce3b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ad5627/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ where
// Write the dac level to the output.
self.write(Command::WriteInput, dac, code.to_be_bytes())?;

let programmed_voltage = (code as f32) / (0x1000 as f32) * 2.5;
let programmed_voltage = ((code >> 4) as f32) / (0x1000 as f32) * 2.5;
Ok(programmed_voltage)
}
}

0 comments on commit 50ce3b2

Please sign in to comment.