diff --git a/.gdbinit b/.gdbinit index 26a03e4..6924dab 100644 --- a/.gdbinit +++ b/.gdbinit @@ -2,5 +2,5 @@ target remote :3333 monitor arm semihosting enable set print asm-demangle on load -#break main +break main continue diff --git a/src/display/Cargo.toml b/src/display/Cargo.toml index 261d5c5..6da3b6e 100644 --- a/src/display/Cargo.toml +++ b/src/display/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "display" -version = "0.1.0" +version = "0.2.0" +edition = "2018" [dependencies] cortex-m-rt="~0.6" cortex-m-semihosting="~0.3" panic-semihosting = "~0.5" -microbit="~0.6" +microbit="~0.8" diff --git a/src/display/src/main.rs b/src/display/src/main.rs index 35a7eb5..12ea853 100644 --- a/src/display/src/main.rs +++ b/src/display/src/main.rs @@ -69,10 +69,10 @@ impl Display { /// Clear display pub fn clear(&mut self) { for row in &mut self.rows { - row.set_low(); + row.set_low().unwrap(); } for col in &mut self.cols { - col.set_high(); + col.set_high().unwrap(); } } @@ -97,18 +97,18 @@ impl Display { let loops = duration_ms / (self.rows.len() as u32 * self.delay_ms); for _ in 0..loops { for (row_line, led_matrix_row) in self.rows.iter_mut().zip(led_matrix.iter()) { - row_line.set_high(); + row_line.set_high().unwrap(); for (col_line, led_matrix_val) in self.cols.iter_mut().zip(led_matrix_row.iter()) { // We are keeping it simple, and not adding brightness if *led_matrix_val > 0 { - col_line.set_low(); + col_line.set_low().unwrap(); } } delay.delay_ms(self.delay_ms); for col_line in &mut self.cols { - col_line.set_high(); + col_line.set_high().unwrap(); } - row_line.set_low(); + row_line.set_low().unwrap(); } } } @@ -120,15 +120,15 @@ fn main() -> ! { writeln!(stdout, "Start").unwrap(); if let Some(p) = microbit::Peripherals::take() { // Split GPIO - let mut gpio = p.GPIO.split(); + let gpio = p.GPIO.split(); // Configure RX and TX pins accordingly let tx = gpio.pin24.into_push_pull_output().downgrade(); let rx = gpio.pin25.into_floating_input().downgrade(); // Configure serial communication let (mut tx, _) = serial::Serial::uart0(p.UART0, tx, rx, BAUD115200).split(); - writeln!(tx, ""); - writeln!(tx, "Init"); + writeln!(tx, "").unwrap(); + writeln!(tx, "Init").unwrap(); // Create delay provider let mut delay = Delay::new(p.TIMER0); @@ -179,10 +179,10 @@ fn main() -> ! { [0, 1, 1, 1, 0], ]; - writeln!(tx, "Starting!"); + writeln!(tx, "Starting!").unwrap(); loop { - writeln!(tx, "I <3 Rust on the micro:bit!"); + writeln!(tx, "I <3 Rust on the micro:bit!").unwrap(); leds.display(&mut delay, letter_I, 1000); leds.display(&mut delay, heart, 1000); leds.display(&mut delay, letter_U, 1000); diff --git a/src/getting-started/Cargo.toml b/src/getting-started/Cargo.toml index 652b2de..9ade1fd 100644 --- a/src/getting-started/Cargo.toml +++ b/src/getting-started/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "start" -version = "0.2.0" +version = "0.3.0" +edition = "2018" [dependencies] panic-halt = "~0.2" diff --git a/src/hello-world/Cargo.toml b/src/hello-world/Cargo.toml index 4a939ce..3954304 100644 --- a/src/hello-world/Cargo.toml +++ b/src/hello-world/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "hello" -version = "0.2.0" +version = "0.3.0" +edition = "2018" [dependencies] -microbit="~0.6" +microbit="~0.8" cortex-m-rt="~0.6" cortex-m-semihosting="~0.3" panic-semihosting = "~0.5" diff --git a/src/hello-world/src/main.rs b/src/hello-world/src/main.rs index 253bdcb..ac1d81d 100644 --- a/src/hello-world/src/main.rs +++ b/src/hello-world/src/main.rs @@ -20,20 +20,20 @@ fn main() -> ! { writeln!(stdout, "Start").unwrap(); if let Some(p) = microbit::Peripherals::take() { // Split GPIO - let mut gpio = p.GPIO.split(); + let gpio = p.GPIO.split(); // Configure RX and TX pins accordingly let tx = gpio.pin24.into_push_pull_output().downgrade(); let rx = gpio.pin25.into_floating_input().downgrade(); // Configure serial communication let (mut tx, _) = serial::Serial::uart0(p.UART0, tx, rx, BAUD115200).split(); - write!(tx, "serial - start\r\n"); + write!(tx, "serial - start\r\n").unwrap(); // Get row and column for display let mut led = gpio.pin13.into_push_pull_output(); let _ = gpio.pin4.into_push_pull_output(); // Set row high (column starts low) - led.set_high(); + led.set_high().unwrap(); // Write string with newline and carriage return - write!(tx, "serial - LED on\r\n"); + write!(tx, "serial - LED on\r\n").unwrap(); } panic!("End"); } diff --git a/src/microbit/Cargo.toml b/src/microbit/Cargo.toml index 7a57323..ef9ad35 100644 --- a/src/microbit/Cargo.toml +++ b/src/microbit/Cargo.toml @@ -1,10 +1,11 @@ [package] -name = "microbit" -version = "0.1.0" +name = "micro" +version = "0.2.0" +edition = "2018" [dependencies] cortex-m-rt="~0.6" cortex-m-semihosting="~0.3" -panic-abort = "~0.3" +panic-halt = "~0.2" panic-semihosting = "~0.5" -microbit="~0.6" +microbit="~0.8" diff --git a/src/microbit/examples/buttons.rs b/src/microbit/examples/buttons.rs index 1b75469..000ece1 100644 --- a/src/microbit/examples/buttons.rs +++ b/src/microbit/examples/buttons.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -extern crate panic_abort; +extern crate panic_halt; extern crate cortex_m_rt as rt; extern crate microbit; @@ -16,7 +16,7 @@ use microbit::hal::serial::BAUD115200; fn main() -> ! { if let Some(p) = microbit::Peripherals::take() { // Split GPIO - let mut gpio = p.GPIO.split(); + let gpio = p.GPIO.split(); // Configure RX and TX pins accordingly let tx = gpio.pin24.into_push_pull_output().downgrade(); let rx = gpio.pin25.into_floating_input().downgrade(); diff --git a/src/microbit/examples/buttons_poll.rs b/src/microbit/examples/buttons_poll.rs index fbeb5b0..2e356d7 100644 --- a/src/microbit/examples/buttons_poll.rs +++ b/src/microbit/examples/buttons_poll.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -extern crate panic_abort; +extern crate panic_halt; extern crate cortex_m_rt as rt; extern crate microbit; diff --git a/src/microbit/examples/display_blocking.rs b/src/microbit/examples/display_blocking.rs index 41cce1a..d864e89 100644 --- a/src/microbit/examples/display_blocking.rs +++ b/src/microbit/examples/display_blocking.rs @@ -5,7 +5,7 @@ extern crate microbit; extern crate cortex_m_rt as rt; extern crate cortex_m_semihosting as sh; -extern crate panic_abort; +extern crate panic_halt; use core::fmt::Write; use rt::entry; diff --git a/src/serial/Cargo.toml b/src/serial/Cargo.toml index cb62ac3..b1b714e 100644 --- a/src/serial/Cargo.toml +++ b/src/serial/Cargo.toml @@ -1,10 +1,11 @@ [package] name = "serial" -version = "0.1.0" +version = "0.2.0" +edition = "2018" [dependencies] -heapless="~0.3" +heapless="~0.5" cortex-m-rt="~0.6" cortex-m-semihosting="~0.3" panic-semihosting = "~0.5" -microbit="~0.6" +microbit="~0.8" diff --git a/src/serial/src/main.rs b/src/serial/src/main.rs index 4773c79..71494fd 100644 --- a/src/serial/src/main.rs +++ b/src/serial/src/main.rs @@ -13,7 +13,7 @@ use sh::hio; use microbit::hal::prelude::*; use microbit::hal::serial; use microbit::hal::serial::BAUD115200; -use microbit::nb::block; +use microbit::block; #[entry] fn main() -> ! { @@ -21,16 +21,16 @@ fn main() -> ! { writeln!(stdout, "Start").unwrap(); if let Some(p) = microbit::Peripherals::take() { // Split GPIO - let mut gpio = p.GPIO.split(); + let gpio = p.GPIO.split(); // Configure RX and TX pins accordingly let tx = gpio.pin24.into_push_pull_output().downgrade(); let rx = gpio.pin25.into_floating_input().downgrade(); // Configure serial communication let (mut tx, mut rx) = serial::Serial::uart0(p.UART0, tx, rx, BAUD115200).split(); - writeln!(tx, "Start"); + writeln!(tx, "Start").unwrap(); loop { let val = block!(rx.read()).unwrap(); - block!(tx.write(val)); + block!(tx.write(val)).unwrap(); } } panic!("End"); diff --git a/src/setup/README.md b/src/setup/README.md index c896bab..8bdd7bd 100644 --- a/src/setup/README.md +++ b/src/setup/README.md @@ -38,18 +38,12 @@ Next, follow OS-agnostic installation instructions for a few of the tools: Install rustup by following the instructions at [https://rustup.rs](https://rustup.rs). -Then, install or switch to the nightly channel. - -``` shell -$ rustup default nightly -``` - -**NOTE** Make sure you have a nightly newer than `nightly-2018-10-12`. +**NOTE** Make sure you have a recent version, but only `1.39.0` is validated. `rustc -V` should return a date newer than the one shown below: ``` shell $ rustc -V -rustc 1.31.0-nightly (2c2e2c57d 2018-10-12) +rustc 1.39.0 (4560ea788 2019-11-04) ``` ### OS specific instructions