From 91b336f2fdc82f5dcdc13ea66ccc70a73b458a65 Mon Sep 17 00:00:00 2001 From: hodasemi Date: Thu, 21 Jul 2022 13:13:19 +0200 Subject: [PATCH] Fix for nano v3 --- rust/.cargo/config.toml | 3 ++- rust/src/main.rs | 10 +++++++++- rust/src/setup.rs | 5 +---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml index a296bd9..06ff18c 100644 --- a/rust/.cargo/config.toml +++ b/rust/.cargo/config.toml @@ -1,8 +1,9 @@ [build] target = "avr-atmega328p.json" +# nano v3, not an official arduino [target.'cfg(target_arch = "avr")'] -runner = "ravedude uno -cb 57600" +runner = "ravedude nano -cb 57600 -P /dev/ttyUSB0" [unstable] build-std = ["core"] \ No newline at end of file diff --git a/rust/src/main.rs b/rust/src/main.rs index f2335e1..03edd14 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -31,10 +31,18 @@ fn panic(_info: &PanicInfo) -> ! { #[arduino_hal::entry] fn main() -> ! { - let setup = Setup::default(); + let mut setup = Setup::default(); loop { fuzz(&setup); + + if setup.led.is_set_high() { + setup.led.set_low(); + } else { + setup.led.set_high(); + } + + delay_ms(250); } } diff --git a/rust/src/setup.rs b/rust/src/setup.rs index 5eb1e5d..25ef524 100644 --- a/rust/src/setup.rs +++ b/rust/src/setup.rs @@ -1,10 +1,7 @@ use core::mem; use arduino_hal::{ - hal::{ - adc, - port::{PB4, PB5, PC4, PC5, PD2}, - }, + hal::port::{PB4, PB5, PC4, PC5, PD2}, pac::{ adc::adc::ADC_SPEC, tc1::{ocr1a::OCR1A_SPEC, ocr1b::OCR1B_SPEC},