Skip to content

Commit 7b4cb83

Browse files
tones111Rahix
authored andcommitted
update toolchain to 2025-03-03
1 parent 95f5810 commit 7b4cb83

File tree

6 files changed

+17
-37
lines changed

6 files changed

+17
-37
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ jobs:
5353
- name: Install Nightly Rust
5454
uses: actions-rust-lang/setup-rust-toolchain@v1
5555
with:
56-
toolchain: nightly-2023-08-08
56+
toolchain: nightly-2025-03-03
5757
components: rustfmt
5858

5959
# Actual test run
6060
- name: Generate chip description sources
61-
run: make RUSTUP_TOOLCHAIN=nightly-2023-08-08
61+
run: make RUSTUP_TOOLCHAIN=nightly-2025-03-03
6262
- name: Test-compile the crate
6363
run: cargo check --all-features
6464

@@ -86,7 +86,8 @@ jobs:
8686
- name: Install Rust
8787
uses: actions-rust-lang/setup-rust-toolchain@v1
8888
with:
89-
toolchain: nightly-2023-12-28
89+
toolchain: nightly-2025-03-03
90+
rustflags: ""
9091
components: rust-src,rustfmt
9192
- name: Install AVR gcc, binutils, and libc
9293
run: sudo apt-get install -y avr-libc binutils-avr gcc-avr

examples/atmega328p/.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build]
2-
target = "avr-specs/avr-atmega328p.json"
2+
target = "avr-none"
3+
rustflags = ["-C", "target-cpu=atmega328p"]
34

45
[target.'cfg(target_arch = "avr")']
56
runner = "ravedude uno -cb 57600"

examples/atmega328p/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mega328-test"
33
version = "0.1.0"
44
authors = ["Frank Villaro-Dixon <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "MIT OR Apache-2.0"
77

88
[[bin]]
@@ -18,7 +18,7 @@ embedded-hal = "0.2.3"
1818

1919

2020
[dependencies.avr-device]
21-
version = "0.5.3"
21+
version = "0.7"
2222
# To use the local version of avr-device instead, uncomment the following line:
2323
# NB: make sure to build this crate first by running `make` at the root of the project
2424
# path = "../.."

examples/atmega328p/avr-specs/avr-atmega328p.json

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2023-12-28"
2+
channel = "nightly-2025-03-03"
33
components = ["rust-src"]
44
profile = "minimal"

examples/atmega328p/src/main.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ fn TIMER0_OVF() {
3838
// We then count 61 times to approximate 1s.
3939
// XXX: this is a really bad way to count time
4040

41-
static mut OVF_COUNTER: u16 = 0;
42-
const ROLLOVER: u16 = 61;
41+
use core::sync::atomic::{AtomicU8, Ordering::Relaxed};
4342

44-
*OVF_COUNTER = OVF_COUNTER.wrapping_add(1);
45-
if *OVF_COUNTER > ROLLOVER {
46-
*OVF_COUNTER = 0;
43+
static OVF_COUNTER: AtomicU8 = AtomicU8::new(0);
44+
const ROLLOVER: u8 = 61;
4745

46+
let ovf = OVF_COUNTER.load(Relaxed);
47+
if ovf < ROLLOVER {
48+
OVF_COUNTER.store(ovf + 1, Relaxed);
49+
} else {
50+
OVF_COUNTER.store(0, Relaxed);
4851
interrupt::free(|cs| {
4952
LED_STATE.borrow(cs).set(!LED_STATE.borrow(cs).get());
5053
});

0 commit comments

Comments
 (0)