diff --git a/docs/Nucleo-64-User-manual.pdf b/docs/Nucleo-64-User-manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f36035f98164841ddb7aa8af9f07f444aae358cf Binary files /dev/null and b/docs/Nucleo-64-User-manual.pdf differ diff --git a/docs/Nucleo_f411re.png b/docs/Nucleo_f411re.png new file mode 100644 index 0000000000000000000000000000000000000000..af6074c7750c1345bb9182451df6d0166f5171cd Binary files /dev/null and b/docs/Nucleo_f411re.png differ diff --git a/docs/Nucleo_f411re_morpho.png b/docs/Nucleo_f411re_morpho.png new file mode 100644 index 0000000000000000000000000000000000000000..7eaaa273f7a758a2864b1ad2381a053bb4803f93 Binary files /dev/null and b/docs/Nucleo_f411re_morpho.png differ diff --git a/docs/STM32F411_Datasheet.pdf b/docs/STM32F411_Datasheet.pdf new file mode 100644 index 0000000000000000000000000000000000000000..330771fccae9debdccf826c8802c8e28116eea44 Binary files /dev/null and b/docs/STM32F411_Datasheet.pdf differ diff --git a/docs/STM32F411_Reference_Manual.pdf b/docs/STM32F411_Reference_Manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a5226d0c297a15a636b8d7384358c0eb39f9aff8 Binary files /dev/null and b/docs/STM32F411_Reference_Manual.pdf differ diff --git a/examples/concurrency.rs b/examples/concurrency.rs index 44058a57fe60adb56292bb48e821d3df81e16b43..624591a50c7c6873ebe39bf2ef971a42ba0f8053 100644 --- a/examples/concurrency.rs +++ b/examples/concurrency.rs @@ -46,7 +46,7 @@ app! { // INITIALIZATION PHASE fn init(p: init::Peripherals, _r: init::Resources) { - led::init(p.GPIOA, p.RCC); + led::init(p.GPIOB, p.RCC); let serial = Serial(p.USART2); serial.init(BAUD_RATE.invert(), Some(p.DMA1), p.GPIOA, p.RCC); diff --git a/examples/roulette.rs b/examples/roulette.rs index e691e407895d0cdd936aaee3e597a74a7466853b..2666dd225391470303d60d5705a1b75067b29f4e 100644 --- a/examples/roulette.rs +++ b/examples/roulette.rs @@ -35,7 +35,7 @@ app! { // INITIALIZATION PHASE fn init(p: init::Peripherals, _r: init::Resources) { - led::init(p.GPIOA, p.RCC); + led::init(p.GPIOB, p.RCC); p.SYST.set_clock_source(SystClkSource::Core); p.SYST.set_reload(16_000_000 / DIVISOR); diff --git a/src/led.rs b/src/led.rs index 98dc55147436c14bee6c61d15a03bf26e4bba268..e8582ae2db472e378e888baf3bc783f5ad191500 100644 --- a/src/led.rs +++ b/src/led.rs @@ -1,10 +1,17 @@ //! User LEDs -use stm32f40x::{GPIOA, RCC}; +use stm32f40x::{GPIOB, RCC}; /// All the user LEDs -pub static LEDS: [Led; 1] = [ +pub static LEDS: [Led; 8] = [ + Led { i: 2 }, + Led { i: 1 }, + Led { i: 15 }, + Led { i: 14 }, + Led { i: 13 }, Led { i: 5 }, + Led { i: 4 }, + Led { i: 10 }, ]; /// An LED @@ -16,28 +23,35 @@ impl Led { /// Turns off the LED pub fn off(&self) { // NOTE(safe) atomic write - unsafe { (*GPIOA.get()).bsrr.write(|w| w.bits(1 << (self.i + 16))) } + unsafe { (*GPIOB.get()).bsrr.write(|w| w.bits(1 << (self.i + 16))) } } /// Turns on the LED pub fn on(&self) { // NOTE(safe) atomic write - unsafe { (*GPIOA.get()).bsrr.write(|w| w.bits(1 << self.i)) } + unsafe { (*GPIOB.get()).bsrr.write(|w| w.bits(1 << self.i)) } } } /// Initializes all the user LEDs -pub fn init(gpioa: &GPIOA, rcc: &RCC) { +pub fn init(gpioa: &GPIOB, rcc: &RCC) { // Power up peripherals - rcc.ahb1enr.modify(|_, w| w.gpioaen().set_bit()); + rcc.ahb1enr.modify(|_, w| w.gpioben().set_bit()); // Configure pins 8-15 as outputs gpioa .moder .modify( - |_, w| { - w.moder5() - .bits(1) + |_, w| {unsafe { + w.moder2().bits(1) + .moder1().bits(1) + .moder15().bits(1) + .moder14().bits(1) + .moder13().bits(1) + .moder5().bits(1) + .moder4().bits(1) + .moder10().bits(1) + } }, ); }