715: stm32/dac: Check proper channel r=Dirbaio a=michalsrb

Small fix. Otherwise it panics when trying to use channel 1 if channel 2 does not exist.

Co-authored-by: Michal Srb <michalsrb@gmail.com>
This commit is contained in:
bors[bot] 2022-04-12 20:57:36 +00:00 committed by GitHub
commit 77c2b151c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,7 +240,7 @@ impl<'d, T: Instance> Dac<'d, T> {
}
pub fn set(&mut self, ch: Channel, value: Value) -> Result<(), Error> {
self.check_channel_exists(Channel::Ch2)?;
self.check_channel_exists(ch)?;
match ch {
Channel::Ch1 => match value {
Value::Bit8(v) => unsafe {