Skip to content

Commit 190f2c3

Browse files
author
ani
authored
Support the SparkFun ProMini 5V
1 parent 01029ae commit 190f2c3

File tree

12 files changed

+88
-4
lines changed

12 files changed

+88
-4
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- type: board
3434
name: sparkfun-promicro
3535
examples: true
36+
- type: board
37+
name: sparkfun-promini-5v
38+
examples: true
3639
- type: board
3740
name: trinket-pro
3841
examples: true

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ members = [
3131
"examples/arduino-uno",
3232
"examples/nano168",
3333
"examples/sparkfun-promicro",
34+
"examples/sparkfun-promini-5v",
3435
"examples/trinket-pro",
3536
"examples/trinket",
3637
]

arduino-hal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ arduino-nano = ["mcu-atmega", "atmega-hal/atmega328p", "atmega-hal/enable-extra-
2121
arduino-uno = ["mcu-atmega", "atmega-hal/atmega328p", "board-selected"]
2222
trinket-pro = ["mcu-atmega", "atmega-hal/atmega328p", "board-selected"]
2323
sparkfun-promicro = ["mcu-atmega", "atmega-hal/atmega32u4", "board-selected"]
24+
sparkfun-promini-5v = ["mcu-atmega", "atmega-hal/atmega328p", "atmega-hal/enable-extra-adc", "board-selected"]
2425
trinket = ["mcu-attiny", "attiny-hal/attiny85", "board-selected"]
2526
nano168 = ["mcu-atmega", "atmega-hal/atmega168", "atmega-hal/enable-extra-adc", "board-selected"]
2627

arduino-hal/src/clock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) mod default {
2222
feature = "arduino-nano",
2323
feature = "arduino-uno",
2424
feature = "sparkfun-promicro",
25+
feature = "sparkfun-promini-5v",
2526
feature = "trinket-pro",
2627
feature = "nano168",
2728
))]

arduino-hal/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![cfg_attr(feature = "arduino-nano", doc = "**Arduino Nano**.")]
1414
#![cfg_attr(feature = "arduino-uno", doc = "**Arduino Uno**.")]
1515
#![cfg_attr(feature = "sparkfun-promicro", doc = "**SparkFun ProMicro**.")]
16+
#![cfg_attr(feature = "sparkfun-promini-5v", doc = "**SparkFun ProMini 5V (16MHz)**.")]
1617
#![cfg_attr(feature = "trinket-pro", doc = "**Trinket Pro**.")]
1718
#![cfg_attr(feature = "trinket", doc = "**Trinket**.")]
1819
#![cfg_attr(feature = "nano168", doc = "**Nano clone (ATmega168)**.")]
@@ -59,6 +60,7 @@ compile_error!(
5960
* arduino-nano
6061
* arduino-uno
6162
* sparkfun-promicro
63+
* sparkfun-promini-5v
6264
* trinket-pro
6365
* trinket
6466
* nano168
@@ -257,7 +259,7 @@ macro_rules! default_serial {
257259
)
258260
};
259261
}
260-
#[cfg(any(feature = "arduino-nano", feature = "nano168"))]
262+
#[cfg(any(feature = "arduino-nano", feature = "nano168", feature = "sparkfun-promini-5v"))]
261263
#[macro_export]
262264
macro_rules! default_serial {
263265
($p:expr, $pins:expr, $baud:expr) => {

arduino-hal/src/port/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ pub use leonardo::*;
2727
mod mega;
2828
#[cfg(any(feature = "arduino-mega2560", feature = "arduino-mega1280"))]
2929
pub use mega::*;
30-
#[cfg(any(feature = "arduino-nano", feature = "arduino-uno", feature = "nano168"))]
30+
#[cfg(any(feature = "arduino-nano", feature = "arduino-uno", feature = "nano168", feature = "sparkfun-promini-5v"))]
3131
mod uno;
32-
#[cfg(any(feature = "arduino-nano", feature = "arduino-uno", feature = "nano168"))]
32+
#[cfg(any(feature = "arduino-nano", feature = "arduino-uno", feature = "nano168", feature = "sparkfun-promini-5v"))]
3333
pub use uno::*;
3434
#[cfg(feature = "sparkfun-promicro")]
3535
mod promicro;

arduino-hal/src/port/uno.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub use atmega_hal::port::{mode, Pin, PinOps, PinMode};
33
avr_hal_generic::renamed_pins! {
44
type Pin = Pin;
55

6-
/// Pins of the **Arduino Uno**.
6+
/// Pins of the **Arduino Uno**, **Arduino Nano**, and **SparkFun ProMini 5V (16MHz)**.
77
///
88
/// This struct is best initialized via the [`arduino_hal::pins!()`][crate::pins] macro.
99
pub struct Pins from atmega_hal::Pins {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
target = "../../avr-specs/avr-atmega328p.json"
3+
4+
[target.'cfg(target_arch = "avr")']
5+
runner = "ravedude promini-5v"
6+
7+
[unstable]
8+
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 = "sparkfun-promini-5v-examples"
3+
version = "0.0.0"
4+
authors = ["Rahix <rahix@rahix.de>"]
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.arduino-hal]
15+
path = "../../arduino-hal/"
16+
features = ["sparkfun-promini-5v"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![no_std]
2+
#![no_main]
3+
4+
use panic_halt as _;
5+
6+
#[arduino_hal::entry]
7+
fn main() -> ! {
8+
let dp = arduino_hal::Peripherals::take().unwrap();
9+
let pins = arduino_hal::pins!(dp);
10+
11+
// Digital pin 13 is also connected to an onboard LED marked "L"
12+
let mut led = pins.d13.into_output();
13+
led.set_high();
14+
15+
loop {
16+
led.toggle();
17+
arduino_hal::delay_ms(100);
18+
led.toggle();
19+
arduino_hal::delay_ms(100);
20+
led.toggle();
21+
arduino_hal::delay_ms(100);
22+
led.toggle();
23+
arduino_hal::delay_ms(800);
24+
}
25+
}

0 commit comments

Comments
 (0)