ad5680: cap value to MAX_VALUE
This commit is contained in:
parent
e5c9ee8ed0
commit
f76ae453a9
@ -46,6 +46,7 @@ impl<SPI: Transfer<u8>, S: OutputPin> Dac<SPI, S> {
|
||||
}
|
||||
|
||||
pub fn set(&mut self, value: u32) -> Result<(), SPI::Error> {
|
||||
let value = value.min(MAX_VALUE);
|
||||
let mut buf = [
|
||||
(value >> 14) as u8,
|
||||
(value >> 6) as u8,
|
||||
|
Loading…
Reference in New Issue
Block a user