use 115200 baud and print panic over serial
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
target = "avr-specs/avr-atmega328p.json"
|
target = "avr-specs/avr-atmega328p.json"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "avr")']
|
[target.'cfg(target_arch = "avr")']
|
||||||
runner = "ravedude nano-new -cb 57600"
|
runner = "ravedude nano-new -cb 115200"
|
||||||
|
|
||||||
[unstable]
|
[unstable]
|
||||||
build-std = ["core"]
|
build-std = ["core"]
|
||||||
|
|||||||
11
Cargo.lock
generated
11
Cargo.lock
generated
@@ -32,7 +32,7 @@ dependencies = [
|
|||||||
"arduino-hal",
|
"arduino-hal",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"nb 1.1.0",
|
"nb 1.1.0",
|
||||||
"panic-halt",
|
"panic-serial",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"ufmt",
|
"ufmt",
|
||||||
]
|
]
|
||||||
@@ -142,10 +142,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
|
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "panic-halt"
|
name = "panic-serial"
|
||||||
version = "0.2.0"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
|
checksum = "c3afc60d58b0825ea32dd8d8a2796098f7b87ad3b9392cace3b6dc79e450afd9"
|
||||||
|
dependencies = [
|
||||||
|
"ufmt",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ test = false
|
|||||||
bench = false
|
bench = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
panic-halt = "0.2.0"
|
|
||||||
ufmt = "0.2.0"
|
ufmt = "0.2.0"
|
||||||
nb = "1.1.0"
|
nb = "1.1.0"
|
||||||
embedded-hal = "1.0"
|
embedded-hal = "1.0"
|
||||||
|
panic-serial = { version = "0.1.2", features = ["full"] }
|
||||||
|
|
||||||
[dependencies.arduino-hal]
|
[dependencies.arduino-hal]
|
||||||
git = "https://github.com/rahix/avr-hal"
|
git = "https://github.com/rahix/avr-hal"
|
||||||
|
|||||||
14
src/main.rs
14
src/main.rs
@@ -1,7 +1,15 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use panic_halt as _;
|
use arduino_hal::prelude::*;
|
||||||
|
|
||||||
|
panic_serial::impl_panic_handler!(
|
||||||
|
arduino_hal::usart::Usart<
|
||||||
|
arduino_hal::pac::USART0,
|
||||||
|
arduino_hal::port::Pin<arduino_hal::port::mode::Input, arduino_hal::hal::port::PD0>,
|
||||||
|
arduino_hal::port::Pin<arduino_hal::port::mode::Output, arduino_hal::hal::port::PD1>
|
||||||
|
>
|
||||||
|
);
|
||||||
|
|
||||||
#[arduino_hal::entry]
|
#[arduino_hal::entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
@@ -19,6 +27,10 @@ fn main() -> ! {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let mut led = pins.d13.into_output();
|
let mut led = pins.d13.into_output();
|
||||||
|
let serial = arduino_hal::default_serial!(dp, pins, 115200);
|
||||||
|
let mut serial = share_serial_port_with_panic(serial);
|
||||||
|
|
||||||
|
ufmt::uwriteln!(&mut serial, "Hello from Arduino!").unwrap_infallible();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
led.toggle();
|
led.toggle();
|
||||||
|
|||||||
Reference in New Issue
Block a user