From 99975b2eb6e8ab913ee85b1864c8417c4019d456 Mon Sep 17 00:00:00 2001 From: "henthe-5@student.ltu.se" <henthe-5@student.ltu.se> Date: Wed, 6 Mar 2019 08:48:49 +0100 Subject: [PATCH] bare6_4 --- examples/bare6.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/bare6.rs b/examples/bare6.rs index b0beaec..9eda79d 100644 --- a/examples/bare6.rs +++ b/examples/bare6.rs @@ -83,22 +83,22 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) { // mco2 : SYSCLK = 0b00 // mcopre : divide by 4 = 0b110 rcc.cfgr - .modify(|_, w| unsafe { w.mco2().bits(0b00).mco2pre().bits(0b110) }); + .modify(|_, w| w.mco2().sysclk().mco2pre().div4() ); // power on GPIOC, RM0368 6.3.11 - rcc.ahb1enr.modify(|_, w| w.gpiocen().set_bit()); + rcc.ahb1enr.modify(|_, w| w.gpiocen().enabled()); // MCO_2 alternate function AF0, STM32F401xD STM32F401xE data sheet // table 9 // AF0, gpioc reset value = AF0 // configure PC9 as alternate function 0b10, RM0368 6.2.10 - gpioc.moder.modify(|_, w| w.moder9().bits(0b10)); + gpioc.moder.modify(|_, w| w.moder9().alternate()); // otyper reset state push/pull, in reset state (don't need to change) // ospeedr 0b11 = very high speed - gpioc.ospeedr.modify(|_, w| w.ospeedr9().bits(0b11)); + gpioc.ospeedr.modify(|_, w| w.ospeedr9().very_high_speed()); } // 0. Compile and run the example, in 16Mhz @@ -173,15 +173,15 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) { // // What is the frequency of MCO2 read by the oscilloscope? // -// ** your answer here ** +// ** 16MHz ** // // Compute the value of SYSCLK based on the oscilloscope reading. // -// ** your answer here ** +// ** 64MHz ** // // What is the peak to peak reading of the signal? // -// ** your answer here ** +// ** 8.4V ** // // Make a screen dump or photo of the oscilloscope output. // Save the the picture as "bare_6_64mhz_high_speed". -- GitLab