Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Digispark + Micronucleus #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[build]
{% case board -%}
{%- when "Digispark + Micronucleus" -%}
target = "avr-specs/avr-attiny85.json"
{%- when "Adafruit Trinket" -%}
target = "avr-specs/avr-attiny85.json"
{%- when "Adafruit Trinket Pro" -%}
Expand All @@ -22,6 +24,8 @@

[target.'cfg(target_arch = "avr")']
{% case board -%}
{%- when "Digispark + Micronucleus" -%}
runner = "micronucleus-runner"
{%- when "Adafruit Trinket" -%}
runner = "ravedude trinket"
{%- when "Adafruit Trinket Pro" -%}
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ embedded-hal = "0.2.3"
git = "https://github.com/rahix/avr-hal"
rev = "3b8f39fa2ec5e3359c7bedc33d982e75e8cc3700"
{% case board -%}
{%- when "Digispark + Micronucleus" -%}
features = ["digispark"]
{%- when "Adafruit Trinket" -%}
features = ["trinket"]
{%- when "Adafruit Trinket Pro" -%}
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ time:
- SparkFun ProMicro
- Adafruit Trinket
- Adafruit Trinket Pro
- Digispark + Micronucleus

## Usage
If you don't have them already, install [`cargo-generate`] and [`ravedude`]:
Expand All @@ -21,6 +22,13 @@ cargo install cargo-generate
cargo install ravedude
```

Alternatively if you are uploading to a board with the Micronucleus 'virtual usb' bootloader use [`micronucleus-runner`]:
```bash
cargo install cargo-generate
cargo install micronucleus-runner
```


Then instanciate this template:

```bash
Expand All @@ -37,8 +45,8 @@ cargo run
and see a blinky flashed to your board!

[`cargo-generate`]: https://github.com/cargo-generate/cargo-generate
[`ravedude`]: https://github.com/Rahix/avr-hal/tree/next/ravedude

[`ravedude`]: https://github.com/Rahix/avr-hal/tree/main/ravedude
[`micronucleus-runner`]:https://github.com/Rahix/avr-hal/tree/main/micronucleus-runner
## License
Licensed under either of

Expand Down
1 change: 1 addition & 0 deletions cargo-generate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ choices = [
"Arduino Uno",
"SparkFun ProMicro",
"Nano168",
"Digispark + Micronucleus"
]
default = "Arduino Uno"
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() -> ! {
*/

{% case board -%}
{%- when "Adafruit Trinket" -%}
{%- when "Adafruit Trinket", "Digispark + Micronucleus" -%}
let mut led = pins.d1.into_output();
{%- when "Arduino Leonardo", "Arduino Mega 2560", "Arduino Nano", "Arduino Nano New Bootloader", "Arduino Uno", "Nano168", "Adafruit Trinket Pro" -%}
let mut led = pins.d13.into_output();
Expand Down