diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-12 20:57:36 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-12 20:57:36 +0000 |
| commit | 77c2b151c239c470acd6b29a1d5ee8dfe64276b8 (patch) | |
| tree | 95e07b017c9456c0af9ed2edeab93b6d755a4037 | |
| parent | d8dd671522defd6b9e40526969ea37888d49a622 (diff) | |
| parent | c1914a477d13eec27089975dbf996ebf7389e0a8 (diff) | |
Merge #715
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 <[email protected]>
| -rw-r--r-- | embassy-stm32/src/dac/v2.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/embassy-stm32/src/dac/v2.rs b/embassy-stm32/src/dac/v2.rs index 006602439..ef64f60e9 100644 --- a/embassy-stm32/src/dac/v2.rs +++ b/embassy-stm32/src/dac/v2.rs | |||
| @@ -240,7 +240,7 @@ impl<'d, T: Instance> Dac<'d, T> { | |||
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | pub fn set(&mut self, ch: Channel, value: Value) -> Result<(), Error> { | 242 | pub fn set(&mut self, ch: Channel, value: Value) -> Result<(), Error> { |
| 243 | self.check_channel_exists(Channel::Ch2)?; | 243 | self.check_channel_exists(ch)?; |
| 244 | match ch { | 244 | match ch { |
| 245 | Channel::Ch1 => match value { | 245 | Channel::Ch1 => match value { |
| 246 | Value::Bit8(v) => unsafe { | 246 | Value::Bit8(v) => unsafe { |
