Bump edition, dependencies and fix clippy
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:
finga 2023-05-27 13:31:46 +02:00
parent 63b76aa3ef
commit d1faf584c5
6 changed files with 58 additions and 72 deletions

View file

@ -14,7 +14,7 @@ pub fn read_byte(p_addr: *const u8) -> nb::Result<u8, Infallible> {
interrupt::free(|_cs| {
// 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
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| {
// 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
eeprom.eedr.write(|w| unsafe { w.bits(data) });
eeprom.eedr.write(|w| w.bits(data));
// Enable writing to the EEPROM by setting EEMPE
eeprom.eecr.write(|w| w.eempe().set_bit());
// Start to write to EEPROM by setting EEPE

View file

@ -125,11 +125,11 @@ impl Lcd {
invert,
[0x00, 0x00]
.iter()
.chain(array.iter().flat_map(|c| {
SYMBOL_TABLE[array[*c as usize]][i as usize]
.iter()
.chain(&[0x00])
}))
.chain(
array.iter().flat_map(|c| {
SYMBOL_TABLE[array[*c]][i as usize].iter().chain(&[0x00])
}),
)
.chain(&[0x00]),
);
}

View file

@ -101,7 +101,7 @@ impl ClockGenerator {
fn init(&mut self) {
// 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
self.exint.pcicr.write(|w| w.pcie().bits(0b0000_0011));
@ -152,7 +152,7 @@ impl ClockGenerator {
if self.button.is_low() {
// Press
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());
}
} else {

View file

@ -129,7 +129,7 @@ impl Screen {
pub fn init(&mut self) {
// 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| {
w.wgm0().pwm_fast();
w.com0b().match_clear()
@ -155,14 +155,14 @@ impl Screen {
w.wgm02().set_bit();
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| {
w.wgm02().set_bit();
w.cs0().prescale_64()
});
self.tc0.ocr0b.write(|w| unsafe { w.bits(backlight - 6) });
self.tc0.ocr0b.write(|w| w.bits(backlight - 6));
}
}
}