Further work sharing config for example and removing duplicated code.

This commit is contained in:
Bob McWhirter
2021-08-04 13:39:02 -04:00
parent 4fe9114695
commit f4971fbb79
6 changed files with 25 additions and 73 deletions

View File

@ -14,9 +14,6 @@ use example_common::*;
use cortex_m_rt::entry;
use embassy_stm32::dac::{Channel, Dac, Value};
use embassy_stm32::rcc;
use embassy_stm32::time::U32Ext;
use embassy_stm32::Config;
#[entry]
fn main() -> ! {
@ -52,16 +49,3 @@ fn to_sine_wave(v: u8) -> u8 {
(r.sin() * 128.0 + 127.0) as u8
}
}
fn config() -> Config {
let mut config = Config::default();
config.rcc = rcc_config();
config
}
fn rcc_config() -> rcc::Config {
let mut config = rcc::Config::default();
config.sys_ck = Some(400.mhz().into());
config.pll1.q_ck = Some(100.mhz().into());
config
}