Skip to content

Commit 8b79168

Browse files
committed
feat: add nano every to ravedude
1 parent b791fda commit 8b79168

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

ravedude/src/avrdude/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ impl Avrdude {
9595
command = command.arg("-b").arg(baudrate.to_string());
9696
}
9797

98+
for option in options.extra_options.iter().flatten() {
99+
command = command.arg("-U").arg(option)
100+
}
101+
102+
if let Some(touch_rate) = options.touch_baudrate {
103+
command = command.arg("-r").arg(touch_rate.to_string());
104+
}
105+
98106
// TODO: Check that `bin` does not contain :
99107
let mut flash_instruction: std::ffi::OsString = "flash:w:".into();
100108
flash_instruction.push(bin);

ravedude/src/boards.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@
4848
[nano-new.usb-info]
4949
error = "Not able to guess port"
5050

51+
[nano-every]
52+
name = "Arduino Every"
53+
54+
[nano-every.reset]
55+
automatic = true
56+
57+
[nano-every.avrdude]
58+
programmer = "jtag2updi"
59+
partno = "atmega4809"
60+
baudrate = 115200
61+
do-chip-erase = true
62+
extra-options = ["fuse2:w:0x01:m", "fuse5:w:0xC9:m", "fuse8:w:0x00:m"]
63+
touch-baudrate = 1200
64+
65+
[nano-every.usb-info]
66+
port-ids = [{ vid = 0x2341, pid = 0x0058 }]
67+
5168
[leonardo]
5269
name = "Arduino Leonardo"
5370

ravedude/src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ pub struct BoardAvrdudeOptions {
131131
// Option<if baudrate == -1 { None } else { NonZeroU32(baudrate) }>
132132
pub baudrate: Option<Option<NonZeroU32>>,
133133
pub do_chip_erase: Option<bool>,
134+
pub extra_options: Option<Vec<String>>,
135+
pub touch_baudrate: Option<u32>,
134136
}
135137
impl BoardAvrdudeOptions {
136138
pub fn merge(self, base: Self) -> Self {
@@ -139,6 +141,8 @@ impl BoardAvrdudeOptions {
139141
partno: self.partno.or(base.partno),
140142
baudrate: self.baudrate.or(base.baudrate),
141143
do_chip_erase: self.do_chip_erase.or(base.do_chip_erase),
144+
extra_options: self.extra_options.or(base.extra_options),
145+
touch_baudrate: self.touch_baudrate.or(base.touch_baudrate),
142146
}
143147
}
144148
}

0 commit comments

Comments
 (0)