Bump edition, dependencies and fix clippy
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Bump all edition to 2021, run `cargo update` and manually bump the following dependencies: - `nb` - `avr-device` Fix several and meanwhile unnecessary uses of unsave blocks and a unneeded cast.
This commit is contained in:
parent
63b76aa3ef
commit
d1faf584c5
6 changed files with 58 additions and 72 deletions
97
firmware/rust/Cargo.lock
generated
97
firmware/rust/Cargo.lock
generated
|
@ -5,7 +5,7 @@ version = 3
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atmega-hal"
|
name = "atmega-hal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rahix/avr-hal?branch=main#8e4ba8f2a097b28459e35528e9f3d89dcf2a6c39"
|
source = "git+https://github.com/rahix/avr-hal?branch=main#7b3212216899d51a9ab3b63852264147ae642e84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"avr-device",
|
"avr-device",
|
||||||
"avr-hal-generic",
|
"avr-hal-generic",
|
||||||
|
@ -13,22 +13,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "avr-device"
|
name = "avr-device"
|
||||||
version = "0.3.4"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edb5cf74147f0a7ef4b7b2b5cdd6bc04e749d050cf48ed2a40048db290165db4"
|
checksum = "644690f9699830f0efce38ca9d41c7ad51a6ec1829364dd272638938c953673a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"avr-device-macros",
|
"avr-device-macros",
|
||||||
"bare-metal",
|
"bare-metal",
|
||||||
"cfg-if",
|
"cfg-if 1.0.0",
|
||||||
"rustversion",
|
|
||||||
"vcell",
|
"vcell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "avr-device-macros"
|
name = "avr-device-macros"
|
||||||
version = "0.3.4"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "474dda7ee758065593ae9fd53c9f95a38c1f7d44fac02a4d354838a6c40070d8"
|
checksum = "ba8b49941a5148cec432d5180d205871f0132f9f15b7225a9f3ad9e2bae026cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -38,11 +37,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "avr-hal-generic"
|
name = "avr-hal-generic"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rahix/avr-hal?branch=main#8e4ba8f2a097b28459e35528e9f3d89dcf2a6c39"
|
source = "git+https://github.com/rahix/avr-hal?branch=main#7b3212216899d51a9ab3b63852264147ae642e84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"avr-device",
|
"avr-device",
|
||||||
"cfg-if",
|
"cfg-if 0.1.10",
|
||||||
"embedded-hal",
|
"embedded-hal",
|
||||||
|
"embedded-storage",
|
||||||
"nb 0.1.3",
|
"nb 0.1.3",
|
||||||
"paste",
|
"paste",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
|
@ -52,12 +52,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bare-metal"
|
name = "bare-metal"
|
||||||
version = "0.2.5"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603"
|
||||||
dependencies = [
|
|
||||||
"rustc_version",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
|
@ -71,6 +68,12 @@ version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clock-generator"
|
name = "clock-generator"
|
||||||
version = "0.1.0-dev"
|
version = "0.1.0-dev"
|
||||||
|
@ -78,7 +81,7 @@ dependencies = [
|
||||||
"atmega-hal",
|
"atmega-hal",
|
||||||
"avr-device",
|
"avr-device",
|
||||||
"embedded-hal",
|
"embedded-hal",
|
||||||
"nb 1.0.0",
|
"nb 1.1.0",
|
||||||
"panic-halt",
|
"panic-halt",
|
||||||
"si5351",
|
"si5351",
|
||||||
]
|
]
|
||||||
|
@ -93,20 +96,26 @@ dependencies = [
|
||||||
"void",
|
"void",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-storage"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "723dce4e9f25b6e6c5f35628e144794e5b459216ed7da97b7c4b66cdb3fa82ca"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
|
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nb 1.0.0",
|
"nb 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
|
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "panic-halt"
|
name = "panic-halt"
|
||||||
|
@ -116,63 +125,39 @@ checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
version = "1.0.9"
|
version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
|
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-hack"
|
name = "proc-macro-hack"
|
||||||
version = "0.5.19"
|
version = "0.5.20+deprecated"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.46"
|
version = "1.0.59"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b"
|
checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.21"
|
version = "1.0.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
version = "1.0.9"
|
version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
|
checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "si5351"
|
name = "si5351"
|
||||||
|
@ -186,9 +171,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.102"
|
version = "1.0.109"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -226,9 +211,9 @@ checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.5"
|
version = "1.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcell"
|
name = "vcell"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clock-generator"
|
name = "clock-generator"
|
||||||
version = "0.1.0-dev"
|
version = "0.1.0-dev"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -11,9 +11,9 @@ bench = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
panic-halt = "0.2"
|
panic-halt = "0.2"
|
||||||
nb = "1.0"
|
nb = "1"
|
||||||
embedded-hal = "0.2"
|
embedded-hal = "0.2"
|
||||||
avr-device = { version = "0.3", features = ["atmega328p"] }
|
avr-device = { version = "0.5", features = ["atmega328p"] }
|
||||||
si5351 = "0.2"
|
si5351 = "0.2"
|
||||||
|
|
||||||
[dependencies.atmega-hal]
|
[dependencies.atmega-hal]
|
||||||
|
@ -23,6 +23,7 @@ features = ["atmega328p", "rt"]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
codegen-units = 1
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub fn read_byte(p_addr: *const u8) -> nb::Result<u8, Infallible> {
|
||||||
|
|
||||||
interrupt::free(|_cs| {
|
interrupt::free(|_cs| {
|
||||||
// Write address into EEPROM address register
|
// Write address into EEPROM address register
|
||||||
eeprom.eear.write(|w| unsafe { w.bits(p_addr as u16) });
|
eeprom.eear.write(|w| w.bits(p_addr as u16));
|
||||||
// Start to read from EEPROM by setting EERE
|
// Start to read from EEPROM by setting EERE
|
||||||
eeprom.eecr.write(|w| w.eere().set_bit());
|
eeprom.eecr.write(|w| w.eere().set_bit());
|
||||||
});
|
});
|
||||||
|
@ -34,9 +34,9 @@ pub fn write_byte(p_addr: *const u8, data: u8) -> nb::Result<(), Infallible> {
|
||||||
|
|
||||||
interrupt::free(|_cs| {
|
interrupt::free(|_cs| {
|
||||||
// Write address into EEPROM address register
|
// Write address into EEPROM address register
|
||||||
eeprom.eear.write(|w| unsafe { w.bits(p_addr as u16) });
|
eeprom.eear.write(|w| w.bits(p_addr as u16));
|
||||||
// Write data into EEPROM data register
|
// Write data into EEPROM data register
|
||||||
eeprom.eedr.write(|w| unsafe { w.bits(data) });
|
eeprom.eedr.write(|w| w.bits(data));
|
||||||
// Enable writing to the EEPROM by setting EEMPE
|
// Enable writing to the EEPROM by setting EEMPE
|
||||||
eeprom.eecr.write(|w| w.eempe().set_bit());
|
eeprom.eecr.write(|w| w.eempe().set_bit());
|
||||||
// Start to write to EEPROM by setting EEPE
|
// Start to write to EEPROM by setting EEPE
|
||||||
|
|
|
@ -125,11 +125,11 @@ impl Lcd {
|
||||||
invert,
|
invert,
|
||||||
[0x00, 0x00]
|
[0x00, 0x00]
|
||||||
.iter()
|
.iter()
|
||||||
.chain(array.iter().flat_map(|c| {
|
.chain(
|
||||||
SYMBOL_TABLE[array[*c as usize]][i as usize]
|
array.iter().flat_map(|c| {
|
||||||
.iter()
|
SYMBOL_TABLE[array[*c]][i as usize].iter().chain(&[0x00])
|
||||||
.chain(&[0x00])
|
}),
|
||||||
}))
|
)
|
||||||
.chain(&[0x00]),
|
.chain(&[0x00]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl ClockGenerator {
|
||||||
|
|
||||||
fn init(&mut self) {
|
fn init(&mut self) {
|
||||||
// Init Timer/Counter1
|
// Init Timer/Counter1
|
||||||
self.tc1.ocr1a.write(|w| unsafe { w.bits(65535) });
|
self.tc1.ocr1a.write(|w| w.bits(65535));
|
||||||
|
|
||||||
// Enable interrupts for encoder, button and timer
|
// Enable interrupts for encoder, button and timer
|
||||||
self.exint.pcicr.write(|w| w.pcie().bits(0b0000_0011));
|
self.exint.pcicr.write(|w| w.pcie().bits(0b0000_0011));
|
||||||
|
@ -152,7 +152,7 @@ impl ClockGenerator {
|
||||||
if self.button.is_low() {
|
if self.button.is_low() {
|
||||||
// Press
|
// Press
|
||||||
if self.tc1.tccr1b.read().cs1().is_no_clock() {
|
if self.tc1.tccr1b.read().cs1().is_no_clock() {
|
||||||
self.tc1.tcnt1.write(|w| unsafe { w.bits(0) });
|
self.tc1.tcnt1.write(|w| w.bits(0));
|
||||||
self.tc1.tccr1b.write(|w| w.cs1().prescale_64());
|
self.tc1.tccr1b.write(|w| w.cs1().prescale_64());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl Screen {
|
||||||
|
|
||||||
pub fn init(&mut self) {
|
pub fn init(&mut self) {
|
||||||
// Init display backlight
|
// Init display backlight
|
||||||
self.tc0.ocr0a.write(|w| unsafe { w.bits(255) });
|
self.tc0.ocr0a.write(|w| w.bits(255));
|
||||||
self.tc0.tccr0a.write(|w| {
|
self.tc0.tccr0a.write(|w| {
|
||||||
w.wgm0().pwm_fast();
|
w.wgm0().pwm_fast();
|
||||||
w.com0b().match_clear()
|
w.com0b().match_clear()
|
||||||
|
@ -155,14 +155,14 @@ impl Screen {
|
||||||
w.wgm02().set_bit();
|
w.wgm02().set_bit();
|
||||||
w.cs0().prescale_256()
|
w.cs0().prescale_256()
|
||||||
});
|
});
|
||||||
self.tc0.ocr0b.write(|w| unsafe { w.bits(backlight - 1) });
|
self.tc0.ocr0b.write(|w| w.bits(backlight - 1));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.tc0.tccr0b.write(|w| {
|
self.tc0.tccr0b.write(|w| {
|
||||||
w.wgm02().set_bit();
|
w.wgm02().set_bit();
|
||||||
w.cs0().prescale_64()
|
w.cs0().prescale_64()
|
||||||
});
|
});
|
||||||
self.tc0.ocr0b.write(|w| unsafe { w.bits(backlight - 6) });
|
self.tc0.ocr0b.write(|w| w.bits(backlight - 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue