File tree Expand file tree Collapse file tree 6 files changed +17
-37
lines changed Expand file tree Collapse file tree 6 files changed +17
-37
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ jobs:
53
53
- name : Install Nightly Rust
54
54
uses : actions-rust-lang/setup-rust-toolchain@v1
55
55
with :
56
- toolchain : nightly-2023-08-08
56
+ toolchain : nightly-2025-03-03
57
57
components : rustfmt
58
58
59
59
# Actual test run
60
60
- name : Generate chip description sources
61
- run : make RUSTUP_TOOLCHAIN=nightly-2023-08-08
61
+ run : make RUSTUP_TOOLCHAIN=nightly-2025-03-03
62
62
- name : Test-compile the crate
63
63
run : cargo check --all-features
64
64
86
86
- name : Install Rust
87
87
uses : actions-rust-lang/setup-rust-toolchain@v1
88
88
with :
89
- toolchain : nightly-2023-12-28
89
+ toolchain : nightly-2025-03-03
90
+ rustflags : " "
90
91
components : rust-src,rustfmt
91
92
- name : Install AVR gcc, binutils, and libc
92
93
run : sudo apt-get install -y avr-libc binutils-avr gcc-avr
Original file line number Diff line number Diff line change 1
1
[build ]
2
- target = " avr-specs/avr-atmega328p.json"
2
+ target = " avr-none"
3
+ rustflags = [" -C" , " target-cpu=atmega328p" ]
3
4
4
5
[target .'cfg(target_arch = "avr")' ]
5
6
runner = " ravedude uno -cb 57600"
Original file line number Diff line number Diff line change 2
2
name = " mega328-test"
3
3
version = " 0.1.0"
4
4
authors = [
" Frank Villaro-Dixon <[email protected] >" ]
5
- edition = " 2021 "
5
+ edition = " 2024 "
6
6
license = " MIT OR Apache-2.0"
7
7
8
8
[[bin ]]
@@ -18,7 +18,7 @@ embedded-hal = "0.2.3"
18
18
19
19
20
20
[dependencies .avr-device ]
21
- version = " 0.5.3 "
21
+ version = " 0.7 "
22
22
# To use the local version of avr-device instead, uncomment the following line:
23
23
# NB: make sure to build this crate first by running `make` at the root of the project
24
24
# path = "../.."
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
[toolchain ]
2
- channel = " nightly-2023-12-28 "
2
+ channel = " nightly-2025-03-03 "
3
3
components = [" rust-src" ]
4
4
profile = " minimal"
Original file line number Diff line number Diff line change @@ -38,13 +38,16 @@ fn TIMER0_OVF() {
38
38
// We then count 61 times to approximate 1s.
39
39
// XXX: this is a really bad way to count time
40
40
41
- static mut OVF_COUNTER : u16 = 0 ;
42
- const ROLLOVER : u16 = 61 ;
41
+ use core:: sync:: atomic:: { AtomicU8 , Ordering :: Relaxed } ;
43
42
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 ;
47
45
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 ) ;
48
51
interrupt:: free ( |cs| {
49
52
LED_STATE . borrow ( cs) . set ( !LED_STATE . borrow ( cs) . get ( ) ) ;
50
53
} ) ;
You can’t perform that action at this time.
0 commit comments