From 8b79168a2e8c3be1af11645ce652c5dfd257e5b7 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Mon, 28 Oct 2024 12:41:58 +0100 Subject: [PATCH] feat: add nano every to ravedude --- ravedude/src/avrdude/mod.rs | 8 ++++++++ ravedude/src/boards.toml | 17 +++++++++++++++++ ravedude/src/config.rs | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/ravedude/src/avrdude/mod.rs b/ravedude/src/avrdude/mod.rs index 65224e4ba8..dfbd84d839 100644 --- a/ravedude/src/avrdude/mod.rs +++ b/ravedude/src/avrdude/mod.rs @@ -95,6 +95,14 @@ impl Avrdude { command = command.arg("-b").arg(baudrate.to_string()); } + for option in options.extra_options.iter().flatten() { + command = command.arg("-U").arg(option) + } + + if let Some(touch_rate) = options.touch_baudrate { + command = command.arg("-r").arg(touch_rate.to_string()); + } + // TODO: Check that `bin` does not contain : let mut flash_instruction: std::ffi::OsString = "flash:w:".into(); flash_instruction.push(bin); diff --git a/ravedude/src/boards.toml b/ravedude/src/boards.toml index 7609a18683..bb67bc07ec 100644 --- a/ravedude/src/boards.toml +++ b/ravedude/src/boards.toml @@ -48,6 +48,23 @@ [nano-new.usb-info] error = "Not able to guess port" +[nano-every] + name = "Arduino Every" + + [nano-every.reset] + automatic = true + + [nano-every.avrdude] + programmer = "jtag2updi" + partno = "atmega4809" + baudrate = 115200 + do-chip-erase = true + extra-options = ["fuse2:w:0x01:m", "fuse5:w:0xC9:m", "fuse8:w:0x00:m"] + touch-baudrate = 1200 + + [nano-every.usb-info] + port-ids = [{ vid = 0x2341, pid = 0x0058 }] + [leonardo] name = "Arduino Leonardo" diff --git a/ravedude/src/config.rs b/ravedude/src/config.rs index 8e688f22ff..da1636baf1 100644 --- a/ravedude/src/config.rs +++ b/ravedude/src/config.rs @@ -131,6 +131,8 @@ pub struct BoardAvrdudeOptions { // Option pub baudrate: Option>, pub do_chip_erase: Option, + pub extra_options: Option>, + pub touch_baudrate: Option, } impl BoardAvrdudeOptions { pub fn merge(self, base: Self) -> Self { @@ -139,6 +141,8 @@ impl BoardAvrdudeOptions { partno: self.partno.or(base.partno), baudrate: self.baudrate.or(base.baudrate), do_chip_erase: self.do_chip_erase.or(base.do_chip_erase), + extra_options: self.extra_options.or(base.extra_options), + touch_baudrate: self.touch_baudrate.or(base.touch_baudrate), } } }