diff --git a/examples/a_test_buttons.rs b/examples/a_test_buttons.rs new file mode 100755 index 0000000000000000000000000000000000000000..35139a47b39e31a034a1e5685964761c07d9407c --- /dev/null +++ b/examples/a_test_buttons.rs @@ -0,0 +1,277 @@ +//! rtic_bare7.rs +//! +//! HAL OutputPin abstractions +//! +//! What it covers: +//! - using embedded hal, and the OutputPin abstraction + +#![no_main] +#![no_std] + + +//use core::intrinsics::rotate_left; + +use core::convert::TryInto; + +use panic_rtt_target as _; +use rtic::cyccnt::{Instant, U32Ext as _}; +use rtt_target::{rprint, rprintln, rtt_init_print}; +use stm32f4xx_hal::{gpio::{AlternateOD, PullUp}, stm32}; + +use stm32f4xx_hal::{ + gpio::{ + gpioa::{ + PA1, PA2, PA3, PA4, PA5, PA6, PA7}, + gpiob::{ + PB14,PB15}, + gpioc::{ + PC4, PC5}, + Input, Output, PushPull, PullDown, Alternate}, + prelude::*, +}; + +use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin, InputPin}; + +const OFFSET: u32 = 50_000_000; + +#[rtic::app(device = stm32f4xx_hal::stm32, monotonic = rtic::cyccnt::CYCCNT, peripherals = true)] +const APP: () = { + struct Resources { + // late resources + //GPIOA: stm32::GPIOA, + led_blue: PA1<Output<PushPull>>, + led_red: PA3<Output<PushPull>>, + led_green: PA2<Output<PushPull>>, + + turbo_button: PA4<Input<PullDown>>, + right_button: PA5<Input<PullDown>>, + scroll_button: PA6<Input<PullDown>>, + + scroll_forward: PC4<Input<PullDown>>, + scroll_back: PA7<Input<PullDown>>, + + forward_button: PB14<Input<PullDown>>, + backward_button: PB15<Input<PullDown>>, + + left_button: PC5<Input<PullDown>>, + + + } + //#[init(schedule = [toggle])] + #[init(schedule = [is_button_pressed])] + fn init(cx: init::Context) -> init::LateResources { + rtt_init_print!(); + rprintln!("init"); + + + let mut core = cx.core; + let device = cx.device; + + + // Initialize (enable) the monotonic timer (CYCCNT) + core.DCB.enable_trace(); + core.DWT.enable_cycle_counter(); + + // semantically, the monotonic timer is frozen at time "zero" during `init` + // NOTE do *not* call `Instant::now` in this context; it will return a nonsense value + let now = cx.start; // the start time of the system + + // Schedule `toggle` to run 8e6 cycles (clock cycles) in the future + //let number_of_toggles = 0; + //cx.schedule.toggle(now + OFFSET.cycles(),number_of_toggles).unwrap(); + + cx.schedule.is_button_pressed(now + OFFSET.cycles()).unwrap(); + + + //let left_button = gpioc.pc5.into_pull_up_input(); + //let left_button_timer = dp.TIM2; + + // power on GPIOA, RM0368 6.3.11 + //device.RCC.ahb1enr.modify(|_, w| w.gpioaen().set_bit()); + + //device.RCC.ahb1enr.modify(|_, w| w.gpiocen().set_bit()); + //configure PA3 as output, RM0368 8.4.1 + device.GPIOA.moder.modify(|_, w| w.moder3().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder2().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder1().bits(1)); + + device.GPIOC.moder.modify(|_, w| w.moder5().bits(1)); + //left_button_read = device.GPIOCEN_R; + let gpioa = device.GPIOA.split(); + let gpiob = device.GPIOB.split(); + let gpioc = device.GPIOC.split(); + + // pass on late resources + init::LateResources { + //GPIOA: device.GPIOA, + led_red: gpioa.pa3.into_push_pull_output(), + led_green: gpioa.pa2.into_push_pull_output(), + led_blue: gpioa.pa1.into_push_pull_output(), + turbo_button: gpioa.pa4.into_pull_down_input(), + left_button: gpioc.pc5.into_pull_down_input(), + right_button: gpioa.pa5.into_pull_down_input(), + + scroll_forward: gpioc.pc4.into_pull_down_input(), + scroll_button: gpioa.pa6.into_pull_down_input(), + scroll_back: gpioa.pa7.into_pull_down_input(), + + forward_button: gpiob.pb14.into_pull_down_input(), + backward_button: gpiob.pb15.into_pull_down_input(), + } + } + + #[idle] + fn idle(_cx: idle::Context) -> ! { + rprintln!("idle"); + loop { + continue; + } + } + + #[task(resources = [left_button, right_button, scroll_button, turbo_button, forward_button, backward_button, + scroll_forward, scroll_back, led_red], schedule = [is_button_pressed])] + fn is_button_pressed(cx: is_button_pressed::Context) { + + //[left,right,mouse,turbo,forward,backward] + let mut buttons: [bool;8] = [false,false,false,false,false,false,false,false]; + + let mut buttons_prev : [bool;8] = [false,false,false,false,false,false,false, false]; + loop { + //cx.resources.left_button.set_high().ok(); + if cx.resources.left_button.is_high().unwrap() { + buttons[0] = false; + //rprintln!("left button is set high"); + } else { + buttons[0] = true; + //rprintln!("left button is set low"); + } + + if cx.resources.right_button.is_high().unwrap() { + buttons[1] = false; + } else { + buttons[1] = true; + //rprintln!("right button is set low"); + } + + if cx.resources.scroll_button.is_low().unwrap() { + buttons[2] = false; + + + } else { + buttons[2] = true; + //rprintln!("scroll button is set high"); + } + + if cx.resources.turbo_button.is_low().unwrap() { + buttons[3] = false; + } else { + buttons[3] = true; + //rprintln!("turbo/dpi button is set high"); + } + if cx.resources.forward_button.is_low().unwrap(){ + + buttons[4] = false; + + } + else{ + buttons[4] = true; + // rprintln!("forward button is set high"); + } + + if cx.resources.backward_button.is_low().unwrap(){ + buttons[5] = false + } + else{ + buttons[5] = true; + //rprintln!("bacward button is set high"); + } + + if cx.resources.scroll_forward.is_high().unwrap(){ + buttons[6] = true + } else { + buttons[6] = false; + } + + if cx.resources.scroll_back.is_high().unwrap(){ + buttons[7] = true + } else { + buttons[7] = false; + } + + if buttons != buttons_prev{ + + rprintln!("Buttons -- Right: {}, Left: {}, Middle: {}, DPI: {}, Fram: {}, Bak: {}, scroll forward: {}, scroll back: {}", buttons[0], buttons[1], buttons[2], buttons[3], + buttons[4],buttons[5], buttons[6], buttons[7]); + + //rprintln!(print); + buttons_prev = buttons; + } + + + } + } + + + #[task(resources = [led_green,led_blue,led_red], schedule = [toggle])] + fn toggle(cx: toggle::Context, mut no_toggled: i32) { + static mut TOGGLE: bool = false; + //rprintln!("toggle @ {:?}", Instant::now()); + //rprintln!("times I have toggled {:?}", no_toggled); + no_toggled +=1; + + /*if no_toggled % 8 == 0{ + rprintln!("White"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_green.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + } else if no_toggled % 8 == 1{ + rprintln!("Green-yellow"); //Needs more oomph to be real yellow. + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 2{ + rprintln!("Purple"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 3{ + rprintln!("Light blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 4{ + rprintln!("Red"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 5{ + rprintln!("Green"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 6{ + rprintln!("Blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else { + rprintln!("Off"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + }*/ + rprintln!("printing"); + rprintln!("White"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_green.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + + //*TOGGLE = !*TOGGLE; + //cx.schedule.toggle(cx.scheduled + OFFSET.cycles(),no_toggled).unwrap(); + } + + extern "C" { + fn EXTI0(); + fn USART1(); + } +}; \ No newline at end of file diff --git a/examples/all_combinations_of_colurs.rs b/examples/all_combinations_of_colurs.rs new file mode 100755 index 0000000000000000000000000000000000000000..0a615dd1dad8e07d544914a29762e1288340e7aa --- /dev/null +++ b/examples/all_combinations_of_colurs.rs @@ -0,0 +1,141 @@ +//! rtic_bare7.rs +//! +//! HAL OutputPin abstractions +//! +//! What it covers: +//! - using embedded hal, and the OutputPin abstraction + +#![no_main] +#![no_std] + + +use panic_rtt_target as _; +use rtic::cyccnt::{Instant, U32Ext as _}; +use rtt_target::{rprintln, rtt_init_print}; +use stm32f4xx_hal::stm32; + +use stm32f4xx_hal::{ + gpio::{gpioa::PA1, gpioa::PA2, gpioa::PA3, Output, PushPull}, + prelude::*, +}; + +use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin}; + +const OFFSET: u32 = 50_000_000; + +#[rtic::app(device = stm32f4xx_hal::stm32, monotonic = rtic::cyccnt::CYCCNT, peripherals = true)] +const APP: () = { + struct Resources { + // late resources + //GPIOA: stm32::GPIOA, + led_red: PA3<Output<PushPull>>, + led_green: PA2<Output<PushPull>>, + led_blue: PA1<Output<PushPull>>, + } + #[init(schedule = [toggle])] + fn init(cx: init::Context) -> init::LateResources { + rtt_init_print!(); + rprintln!("init"); + + + let mut core = cx.core; + let device = cx.device; + + + // Initialize (enable) the monotonic timer (CYCCNT) + core.DCB.enable_trace(); + core.DWT.enable_cycle_counter(); + + // semantically, the monotonic timer is frozen at time "zero" during `init` + // NOTE do *not* call `Instant::now` in this context; it will return a nonsense value + let now = cx.start; // the start time of the system + + // Schedule `toggle` to run 8e6 cycles (clock cycles) in the future + let number_of_toggles = 0; + cx.schedule.toggle(now + OFFSET.cycles(),number_of_toggles).unwrap(); + + // power on GPIOA, RM0368 6.3.11 + device.RCC.ahb1enr.modify(|_, w| w.gpioaen().set_bit()); + // configure PA3 as output, RM0368 8.4.1 + device.GPIOA.moder.modify(|_, w| w.moder3().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder2().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder1().bits(1)); + + + let gpioa = device.GPIOA.split(); + + // pass on late resources + init::LateResources { + //GPIOA: device.GPIOA, + led_red: gpioa.pa3.into_push_pull_output(), + led_green: gpioa.pa2.into_push_pull_output(), + led_blue: gpioa.pa1.into_push_pull_output(), + } + } + + #[idle] + fn idle(_cx: idle::Context) -> ! { + rprintln!("idle"); + loop { + continue; + } + } + + #[task(resources = [led_green,led_blue,led_red], schedule = [toggle])] + fn toggle(cx: toggle::Context, mut no_toggled: i32) { + static mut TOGGLE: bool = false; + //rprintln!("toggle @ {:?}", Instant::now()); + //rprintln!("times I have toggled {:?}", no_toggled); + no_toggled +=1; + + if no_toggled % 8 == 0{ + rprintln!("White"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_green.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + } else if no_toggled % 8 == 1{ + rprintln!("Green-yellow"); //Needs more oomph to be real yellow. + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 2{ + rprintln!("Purple"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 3{ + rprintln!("Light blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 4{ + rprintln!("Red"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 5{ + rprintln!("Green"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 6{ + rprintln!("Blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else { + rprintln!("Off"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + } + + //*TOGGLE = !*TOGGLE; + cx.schedule.toggle(cx.scheduled + OFFSET.cycles(),no_toggled).unwrap(); + } + + extern "C" { + fn EXTI0(); + fn USART1(); + } +}; \ No newline at end of file diff --git a/examples/buttons.rs b/examples/buttons.rs new file mode 100644 index 0000000000000000000000000000000000000000..7fe324fbac4ecb95629091259c7821aa20b4ad67 --- /dev/null +++ b/examples/buttons.rs @@ -0,0 +1,277 @@ +//!buttons.rs +//! +//! HAL OutputPin abstractions +//! +//! What it covers: +//! - using embedded hal, and the OutputPin abstraction + +#![no_main] +#![no_std] + + +//use core::intrinsics::rotate_left; + +use core::convert::TryInto; + +use panic_rtt_target as _; +use rtic::cyccnt::{Instant, U32Ext as _}; +use rtt_target::{rprint, rprintln, rtt_init_print}; +use stm32f4xx_hal::{gpio::{AlternateOD, PullUp}, stm32}; + +use stm32f4xx_hal::{ + gpio::{ + gpioa::{ + PA1, PA2, PA3, PA4, PA5, PA6, PA7}, + gpiob::{ + PB14,PB15}, + gpioc::{ + PC4, PC5}, + Input, Output, PushPull, PullDown, Alternate}, + prelude::*, +}; + +use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin, InputPin}; + +const OFFSET: u32 = 50_000_000; + +#[rtic::app(device = stm32f4xx_hal::stm32, monotonic = rtic::cyccnt::CYCCNT, peripherals = true)] +const APP: () = { + struct Resources { + // late resources + //GPIOA: stm32::GPIOA, + led_blue: PA1<Output<PushPull>>, + led_red: PA3<Output<PushPull>>, + led_green: PA2<Output<PushPull>>, + + turbo_button: PA4<Input<PullDown>>, + right_button: PA5<Input<PullDown>>, + scroll_button: PA6<Input<PullDown>>, + + scroll_forward: PC4<Input<PullDown>>, + scroll_back: PA7<Input<PullDown>>, + + forward_button: PB14<Input<PullDown>>, + backward_button: PB15<Input<PullDown>>, + + left_button: PC5<Input<PullDown>>, + + + } + //#[init(schedule = [toggle])] + #[init(schedule = [is_button_pressed])] + fn init(cx: init::Context) -> init::LateResources { + rtt_init_print!(); + rprintln!("init"); + + + let mut core = cx.core; + let device = cx.device; + + + // Initialize (enable) the monotonic timer (CYCCNT) + core.DCB.enable_trace(); + core.DWT.enable_cycle_counter(); + + // semantically, the monotonic timer is frozen at time "zero" during `init` + // NOTE do *not* call `Instant::now` in this context; it will return a nonsense value + let now = cx.start; // the start time of the system + + // Schedule `toggle` to run 8e6 cycles (clock cycles) in the future + //let number_of_toggles = 0; + //cx.schedule.toggle(now + OFFSET.cycles(),number_of_toggles).unwrap(); + + cx.schedule.is_button_pressed(now + OFFSET.cycles()).unwrap(); + + + //let left_button = gpioc.pc5.into_pull_up_input(); + //let left_button_timer = dp.TIM2; + + // power on GPIOA, RM0368 6.3.11 + //device.RCC.ahb1enr.modify(|_, w| w.gpioaen().set_bit()); + + //device.RCC.ahb1enr.modify(|_, w| w.gpiocen().set_bit()); + //configure PA3 as output, RM0368 8.4.1 + device.GPIOA.moder.modify(|_, w| w.moder3().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder2().bits(1)); + device.GPIOA.moder.modify(|_, w| w.moder1().bits(1)); + + device.GPIOC.moder.modify(|_, w| w.moder5().bits(1)); + //left_button_read = device.GPIOCEN_R; + let gpioa = device.GPIOA.split(); + let gpiob = device.GPIOB.split(); + let gpioc = device.GPIOC.split(); + + // pass on late resources + init::LateResources { + //GPIOA: device.GPIOA, + led_red: gpioa.pa3.into_push_pull_output(), + led_green: gpioa.pa2.into_push_pull_output(), + led_blue: gpioa.pa1.into_push_pull_output(), + turbo_button: gpioa.pa4.into_pull_down_input(), + left_button: gpioc.pc5.into_pull_down_input(), + right_button: gpioa.pa5.into_pull_down_input(), + + scroll_forward: gpioc.pc4.into_pull_down_input(), + scroll_button: gpioa.pa6.into_pull_down_input(), + scroll_back: gpioa.pa7.into_pull_down_input(), + + forward_button: gpiob.pb14.into_pull_down_input(), + backward_button: gpiob.pb15.into_pull_down_input(), + } + } + + #[idle] + fn idle(_cx: idle::Context) -> ! { + rprintln!("idle"); + loop { + continue; + } + } + + #[task(resources = [left_button, right_button, scroll_button, turbo_button, forward_button, backward_button, + scroll_forward, scroll_back, led_red], schedule = [is_button_pressed])] + fn is_button_pressed(cx: is_button_pressed::Context) { + + //[left,right,mouse,turbo,forward,backward] + let mut buttons: [bool;8] = [false,false,false,false,false,false,false,false]; + + let mut buttons_prev : [bool;8] = [false,false,false,false,false,false,false, false]; + loop { + //cx.resources.left_button.set_high().ok(); + if cx.resources.left_button.is_high().unwrap() { + buttons[0] = false; + //rprintln!("left button is set high"); + } else { + buttons[0] = true; + //rprintln!("left button is set low"); + } + + if cx.resources.right_button.is_high().unwrap() { + buttons[1] = false; + } else { + buttons[1] = true; + //rprintln!("right button is set low"); + } + + if cx.resources.scroll_button.is_low().unwrap() { + buttons[2] = false; + + + } else { + buttons[2] = true; + //rprintln!("scroll button is set high"); + } + + if cx.resources.turbo_button.is_low().unwrap() { + buttons[3] = false; + } else { + buttons[3] = true; + //rprintln!("turbo/dpi button is set high"); + } + if cx.resources.forward_button.is_low().unwrap(){ + + buttons[4] = false; + + } + else{ + buttons[4] = true; + // rprintln!("forward button is set high"); + } + + if cx.resources.backward_button.is_low().unwrap(){ + buttons[5] = false + } + else{ + buttons[5] = true; + //rprintln!("bacward button is set high"); + } + + if cx.resources.scroll_forward.is_high().unwrap(){ + buttons[6] = true + } else { + buttons[6] = false; + } + + if cx.resources.scroll_back.is_high().unwrap(){ + buttons[7] = true + } else { + buttons[7] = false; + } + + if buttons != buttons_prev{ + + rprintln!("Buttons -- Right: {}, Left: {}, Middle: {}, DPI: {}, Fram: {}, Bak: {}, scroll forward: {}, scroll back: {}", buttons[0], buttons[1], buttons[2], buttons[3], + buttons[4],buttons[5], buttons[6], buttons[7]); + + //rprintln!(print); + buttons_prev = buttons; + } + + + } + } + + + #[task(resources = [led_green,led_blue,led_red], schedule = [toggle])] + fn toggle(cx: toggle::Context, mut no_toggled: i32) { + static mut TOGGLE: bool = false; + //rprintln!("toggle @ {:?}", Instant::now()); + //rprintln!("times I have toggled {:?}", no_toggled); + no_toggled +=1; + + /*if no_toggled % 8 == 0{ + rprintln!("White"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_green.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + } else if no_toggled % 8 == 1{ + rprintln!("Green-yellow"); //Needs more oomph to be real yellow. + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 2{ + rprintln!("Purple"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 3{ + rprintln!("Light blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 4{ + rprintln!("Red"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + } else if no_toggled % 8 == 5{ + rprintln!("Green"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_high().ok(); + } else if no_toggled % 8 == 6{ + rprintln!("Blue"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_high().ok(); + cx.resources.led_green.set_low().ok(); + } else { + rprintln!("Off"); + cx.resources.led_red.set_low().ok(); + cx.resources.led_blue.set_low().ok(); + cx.resources.led_green.set_low().ok(); + }*/ + rprintln!("printing"); + rprintln!("White"); + cx.resources.led_red.set_high().ok(); + cx.resources.led_green.set_high().ok(); + cx.resources.led_blue.set_high().ok(); + + //*TOGGLE = !*TOGGLE; + //cx.schedule.toggle(cx.scheduled + OFFSET.cycles(),no_toggled).unwrap(); + } + + extern "C" { + fn EXTI0(); + fn USART1(); + } +}; \ No newline at end of file diff --git a/examples/pmw3389.rs b/examples/pmw3389.rs index 746cf156cfe2d7dd194ed3d5c80ac8235ef33d81..b6fe0a13029db05ab2050beaebde0fc0eba27617 100644 --- a/examples/pmw3389.rs +++ b/examples/pmw3389.rs @@ -11,7 +11,7 @@ use stm32f4xx_hal::{ dwt::Dwt, gpio::Speed, gpio::{ - gpiob::{PB10, PB4}, + gpiob::{PB10, PB12}, gpioc::{PC2, PC3}, Alternate, Output, PushPull, }, @@ -36,7 +36,7 @@ type PMW3389T = pmw3389::Pmw3389< PC3<Alternate<stm32f4xx_hal::gpio::AF5>>, ), >, - PB4<Output<PushPull>>, + PB12<Output<PushPull>>, >; #[rtic::app(device = stm32f4xx_hal::stm32, monotonic = rtic::cyccnt::CYCCNT, peripherals = true)] @@ -80,7 +80,7 @@ const APP: () = { let sck = gpiob.pb10.into_alternate_af5(); let miso = gpioc.pc2.into_alternate_af5(); let mosi = gpioc.pc3.into_alternate_af5(); - let cs = gpiob.pb4.into_push_pull_output().set_speed(Speed::High); + let cs = gpiob.pb12.into_push_pull_output().set_speed(Speed::High); let spi = Spi::spi2( device.SPI2, diff --git a/examples/rtic_bare5.rs b/examples/rtic_bare5.rs index 6bf6f2a42d2b76f30082ce734385b5bdd5516391..b46c0960b6ea1ac223c5229f72c83f5074a1aae1 100644 --- a/examples/rtic_bare5.rs +++ b/examples/rtic_bare5.rs @@ -181,10 +181,7 @@ const APP: () = { gpioa.MODER.write(r | 0b01 << (5 * 2)); // set output mode // test_modify(); -<<<<<<< HEAD -======= test_modify(); ->>>>>>> 4897099 (Did my best) loop { @@ -249,10 +246,6 @@ const APP: () = { // What if we could automatically generate that from Vendors specifications (SVD files)? // Wouldn't that be great? // -<<<<<<< HEAD -// ** your answer here ** -======= // I got the first assert to work. But I don't understand the second. What are we supposed to do? ->>>>>>> 4897099 (Did my best) // // Commit your answers (bare5_2) diff --git a/examples/rtic_bare6.rs b/examples/rtic_bare6.rs index d6eab5a03cb33e7500764241fa27f9b72efcc4eb..ca59e4f503fe6ea81e099b4ace1c1f33b9667ddb 100644 --- a/examples/rtic_bare6.rs +++ b/examples/rtic_bare6.rs @@ -231,7 +231,8 @@ fn clock_out(rcc: &RCC, gpioc: &GPIOC) { // // `rcc.cfgr.sysclk(84.mhz()).pclk1(42.mhz()).pclk2(64.mhz()).freeze();` // -// When I changee pclk2 to 64 the other sysclk changes to 64 and pclk1 changes to 32. This is due that the // PCLK2 does not have a prescalar that can scale it from 84 MHz to 64 Mhz and therefore changes the clock. +// When I changee pclk2 to 64 the other sysclk changes to 64 and pclk1 changes to 32. This is due that the +// PCLK2 does not have a prescalar that can scale it from 84 MHz to 64 Mhz and therefore changes the clock. // // Commit your answers (bare6_0) //