Skip to content

Commit

Permalink
feat: add nano every to ravedude
Browse files Browse the repository at this point in the history
  • Loading branch information
flobz committed Oct 29, 2024
1 parent b791fda commit 8b79168
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ravedude/src/avrdude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions ravedude/src/boards.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 4 additions & 0 deletions ravedude/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ pub struct BoardAvrdudeOptions {
// Option<if baudrate == -1 { None } else { NonZeroU32(baudrate) }>
pub baudrate: Option<Option<NonZeroU32>>,
pub do_chip_erase: Option<bool>,
pub extra_options: Option<Vec<String>>,
pub touch_baudrate: Option<u32>,
}
impl BoardAvrdudeOptions {
pub fn merge(self, base: Self) -> Self {
Expand All @@ -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),
}
}
}
Expand Down

0 comments on commit 8b79168

Please sign in to comment.