diff options
| author | Rukai <[email protected]> | 2021-07-03 22:05:12 +1000 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-07-05 01:54:29 +0200 |
| commit | 25d4b2ea2665bcf8907caf8b01d5223c615448c3 (patch) | |
| tree | 53c7d2ec20855aa404363ccf81e488561beffda9 /examples/stm32h7/src/bin/dac.rs | |
| parent | 8615ffb523edbfa10b9bc13c24668da760cf06c5 (diff) | |
fix stm32 warnings
Diffstat (limited to 'examples/stm32h7/src/bin/dac.rs')
| -rw-r--r-- | examples/stm32h7/src/bin/dac.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/examples/stm32h7/src/bin/dac.rs b/examples/stm32h7/src/bin/dac.rs index c6f3de7b6..121956755 100644 --- a/examples/stm32h7/src/bin/dac.rs +++ b/examples/stm32h7/src/bin/dac.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![allow(incomplete_features)] | ||
| 3 | #![feature(trait_alias)] | 4 | #![feature(trait_alias)] |
| 4 | #![feature(min_type_alias_impl_trait)] | 5 | #![feature(min_type_alias_impl_trait)] |
| 5 | #![feature(impl_trait_in_bindings)] | 6 | #![feature(impl_trait_in_bindings)] |
| @@ -8,16 +9,12 @@ | |||
| 8 | #[path = "../example_common.rs"] | 9 | #[path = "../example_common.rs"] |
| 9 | mod example_common; | 10 | mod example_common; |
| 10 | 11 | ||
| 11 | use embassy_stm32::gpio::{Level, Output, Input, Pull, NoPin}; | 12 | use embassy_stm32::gpio::NoPin; |
| 12 | use embedded_hal::digital::v2::{OutputPin, InputPin}; | ||
| 13 | use example_common::*; | 13 | use example_common::*; |
| 14 | 14 | ||
| 15 | use cortex_m_rt::entry; | 15 | use cortex_m_rt::entry; |
| 16 | use stm32h7::stm32h743 as pac; | 16 | use stm32h7::stm32h743 as pac; |
| 17 | use embassy_stm32::spi::{Spi, MODE_0, ByteOrder, Config}; | 17 | use stm32h7xx_hal::prelude::*; |
| 18 | use embassy_stm32::time::Hertz; | ||
| 19 | use embedded_hal::blocking::spi::Transfer; | ||
| 20 | use stm32h7xx_hal::{rcc, prelude::*}; | ||
| 21 | use embassy_stm32::dac::{Dac, Value, Channel}; | 18 | use embassy_stm32::dac::{Dac, Value, Channel}; |
| 22 | 19 | ||
| 23 | #[entry] | 20 | #[entry] |
| @@ -31,7 +28,7 @@ fn main() -> ! { | |||
| 31 | 28 | ||
| 32 | let rcc = pp.RCC.constrain(); | 29 | let rcc = pp.RCC.constrain(); |
| 33 | 30 | ||
| 34 | let ccdr = rcc | 31 | rcc |
| 35 | .sys_ck(96.mhz()) | 32 | .sys_ck(96.mhz()) |
| 36 | .pclk1(48.mhz()) | 33 | .pclk1(48.mhz()) |
| 37 | .pclk2(48.mhz()) | 34 | .pclk2(48.mhz()) |
| @@ -71,8 +68,8 @@ fn main() -> ! { | |||
| 71 | 68 | ||
| 72 | loop { | 69 | loop { |
| 73 | for v in 0..=255 { | 70 | for v in 0..=255 { |
| 74 | dac.set(Channel::Ch1, Value::Bit8(to_sine_wave(v))); | 71 | unwrap!(dac.set(Channel::Ch1, Value::Bit8(to_sine_wave(v)))); |
| 75 | dac.trigger( Channel::Ch1 ); | 72 | unwrap!(dac.trigger(Channel::Ch1)); |
| 76 | } | 73 | } |
| 77 | } | 74 | } |
| 78 | } | 75 | } |
