Skip to content

Commit 8a61989

Browse files
RahixFlorian Bezannier
authored and
Florian Bezannier
committed
[WIP] Add super simple blinky example for Arduino Nano Every
This is all a big jumbled mess and in no way "production ready". Clock/delay seems to be wrong, at least the blinky blinks way too slow...
1 parent ab58982 commit 8a61989

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ members = [
2929
"examples/arduino-mega2560",
3030
"examples/arduino-mega1280",
3131
"examples/arduino-nano",
32+
"examples/arduino-nano-every",
3233
"examples/arduino-uno",
3334
"examples/atmega2560",
3435
"examples/nano168",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
target = "../../avr-specs/avr-atmega4809.json"
3+
4+
[unstable]
5+
build-std = ["core"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "arduino-nano-every-examples"
3+
version = "0.0.0"
4+
authors = ["Rahix <[email protected]>"]
5+
edition = "2018"
6+
publish = false
7+
8+
[dependencies]
9+
panic-halt = "0.2.0"
10+
ufmt = "0.1.0"
11+
nb = "0.1.2"
12+
embedded-hal = "0.2.3"
13+
14+
[dependencies.atxmega-hal]
15+
path = "../../mcu/atxmega-hal/"
16+
features = ["atmega4809", "rt"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#![no_std]
2+
#![no_main]
3+
4+
// Proof of concept, all hacked together right now...
5+
//
6+
// Compile with the dirty avr-atmega4809.json target (which actually uses atxmega32a4 ...).
7+
//
8+
// Flashing works using the following command, based on the Arduino stuff (not verified anything
9+
// else yet):
10+
//
11+
// stty -F /dev/ttyACM0 hup 1200 && \
12+
// echo 1>/dev/ttyACM0 && \
13+
// ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude \
14+
// -C${HOME}/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf \
15+
// -v -patmega4809 -cjtag2updi -P/dev/ttyACM0 -b115200 -e -D \
16+
// -Uflash:w:../../target/avr-atmega4809/release/every-blink.elf:e
17+
18+
use panic_halt as _;
19+
20+
use embedded_hal::blocking::delay::DelayMs;
21+
22+
#[atxmega_hal::entry]
23+
fn main() -> ! {
24+
let dp = atxmega_hal::Peripherals::take().unwrap();
25+
26+
let mut led = dp.pins.pe2.into_output();
27+
28+
let mut delay = atxmega_hal::delay::Delay::<atxmega_hal::clock::MHz16>::new();
29+
30+
loop {
31+
led.toggle();
32+
delay.delay_ms(100u16);
33+
}
34+
}

0 commit comments

Comments
 (0)