clippy + dependency updates

This commit is contained in:
2025-06-26 19:44:36 +02:00
parent 61ffe06343
commit 4120b0d40a
19 changed files with 37 additions and 36 deletions

View File

@ -11,7 +11,7 @@ keywords = ["no-std", "arm", "cortex-a", "amd", "zynq7000"]
categories = ["embedded", "no-std", "hardware-support"] categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
cortex-ar = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main", features = ["critical-section-single-core"] } cortex-ar = "0.2"
zynq7000-rt = { path = "../../zynq7000-rt" } zynq7000-rt = { path = "../../zynq7000-rt" }
zynq7000 = { path = "../../zynq7000" } zynq7000 = { path = "../../zynq7000" }
zynq7000-hal = { path = "../../zynq7000-hal" } zynq7000-hal = { path = "../../zynq7000-hal" }

View File

@ -10,13 +10,13 @@ use embedded_hal::{delay::DelayNs, digital::StatefulOutputPin};
use embedded_io::Write; use embedded_io::Write;
use log::{error, info, warn}; use log::{error, info, warn};
use zynq7000_hal::{ use zynq7000_hal::{
BootMode,
clocks::Clocks, clocks::Clocks,
gic::{GicConfigurator, GicInterruptHelper, Interrupt}, gic::{GicConfigurator, GicInterruptHelper, Interrupt},
gpio::{mio, Flex, Output, PinState}, gpio::{Flex, Output, PinState, mio},
gtc::Gtc, gtc::Gtc,
time::Hertz, time::Hertz,
uart::{ClkConfigRaw, Uart, UartConfig}, uart::{ClkConfigRaw, Uart, UartConfig},
BootMode,
}; };
use zynq7000::PsPeripherals; use zynq7000::PsPeripherals;
@ -148,7 +148,7 @@ async fn main(_spawner: Spawner) -> ! {
info!("Humidity: {} %", reading.relative_humidity); info!("Humidity: {} %", reading.relative_humidity);
} }
Err(err) => { Err(err) => {
warn!("Reading error: {:?}", err); warn!("Reading error: {err:?}");
} }
} }
} }
@ -202,6 +202,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -144,6 +144,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -98,7 +98,7 @@ async fn main(_spawner: Spawner) -> ! {
led.toggle().unwrap(); led.toggle().unwrap();
pwm.set_duty_cycle_percent(current_duty).unwrap(); pwm.set_duty_cycle_percent(current_duty).unwrap();
info!("Setting duty cycle to {}%", current_duty); info!("Setting duty cycle to {current_duty}%");
current_duty += 5; current_duty += 5;
if current_duty > 100 { if current_duty > 100 {
current_duty = 0; current_duty = 0;
@ -152,6 +152,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -131,6 +131,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -9,7 +9,7 @@ repository = "https://egit.irs.uni-stuttgart.de/rust/zynq7000-rs"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
cortex-ar = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main" } cortex-ar = "0.2"
zynq7000-rt = { path = "../../zynq7000-rt" } zynq7000-rt = { path = "../../zynq7000-rt" }
zynq7000 = { path = "../../zynq7000" } zynq7000 = { path = "../../zynq7000" }
zynq7000-hal = { path = "../../zynq7000-hal" } zynq7000-hal = { path = "../../zynq7000-hal" }

View File

@ -131,6 +131,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -77,13 +77,13 @@ pub fn main() -> ! {
}; };
let boot_mode = BootMode::new(); let boot_mode = BootMode::new();
info!("Boot mode: {:?}", boot_mode); info!("Boot mode: {boot_mode:?}");
let mut led = Output::new_for_mio(mio_pins.mio7, PinState::Low); let mut led = Output::new_for_mio(mio_pins.mio7, PinState::Low);
loop { loop {
let gtc = gtc.read_timer(); let gtc = gtc.read_timer();
info!("Hello, world!"); info!("Hello, world!");
info!("GTC ticks: {}", gtc); info!("GTC ticks: {gtc}");
led.toggle().unwrap(); led.toggle().unwrap();
for _ in 0..5_000_000 { for _ in 0..5_000_000 {
nop(); nop();
@ -134,6 +134,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -11,7 +11,7 @@ keywords = ["no-std", "arm", "cortex-a", "amd", "zynq7000"]
categories = ["embedded", "no-std", "hardware-support"] categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
cortex-ar = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main", features = ["critical-section-single-core"] } cortex-ar = "0.2"
zynq7000-rt = { path = "../../zynq7000-rt" } zynq7000-rt = { path = "../../zynq7000-rt" }
zynq7000 = { path = "../../zynq7000" } zynq7000 = { path = "../../zynq7000" }
zynq7000-hal = { path = "../../zynq7000-hal" } zynq7000-hal = { path = "../../zynq7000-hal" }

View File

@ -144,7 +144,7 @@ async fn main(_spawner: Spawner) -> ! {
mio_led.toggle().unwrap(); mio_led.toggle().unwrap();
let measurements = l3gd20.all().unwrap(); let measurements = l3gd20.all().unwrap();
info!("L3GD20: {:?}", measurements); info!("L3GD20: {measurements:?}");
info!("L3GD20 Temp: {:?}", measurements.temp_celcius()); info!("L3GD20 Temp: {:?}", measurements.temp_celcius());
for led in emio_leds.iter_mut() { for led in emio_leds.iter_mut() {
led.toggle().unwrap(); led.toggle().unwrap();
@ -198,6 +198,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -185,7 +185,7 @@ pub async fn blocking_application(
let spi_dev = SpiWithHwCs::new(spi, spi::ChipSelect::Slave0, delay.clone()); let spi_dev = SpiWithHwCs::new(spi, spi::ChipSelect::Slave0, delay.clone());
let mut l3gd20 = l3gd20::spi::L3gd20::new(spi_dev).unwrap(); let mut l3gd20 = l3gd20::spi::L3gd20::new(spi_dev).unwrap();
let who_am_i = l3gd20.who_am_i().unwrap(); let who_am_i = l3gd20.who_am_i().unwrap();
info!("L3GD20 WHO_AM_I: 0x{:02X}", who_am_i); info!("L3GD20 WHO_AM_I: 0x{who_am_i:02X}");
let mut ticker = Ticker::every(Duration::from_millis(400)); let mut ticker = Ticker::every(Duration::from_millis(400));
@ -195,7 +195,7 @@ pub async fn blocking_application(
mio_led.toggle().unwrap(); mio_led.toggle().unwrap();
let measurements = l3gd20.all().unwrap(); let measurements = l3gd20.all().unwrap();
info!("L3GD20: {:?}", measurements); info!("L3GD20: {measurements:?}");
info!("L3GD20 Temp: {:?}", measurements.temp_celcius()); info!("L3GD20 Temp: {:?}", measurements.temp_celcius());
for led in emio_leds.iter_mut() { for led in emio_leds.iter_mut() {
led.toggle().unwrap(); led.toggle().unwrap();
@ -217,7 +217,7 @@ pub async fn non_blocking_application(
.await .await
.unwrap(); .unwrap();
let who_am_i = l3gd20.who_am_i().await.unwrap(); let who_am_i = l3gd20.who_am_i().await.unwrap();
info!("L3GD20 WHO_AM_I: 0x{:02X}", who_am_i); info!("L3GD20 WHO_AM_I: 0x{who_am_i:02X}");
let mut ticker = Ticker::every(Duration::from_millis(400)); let mut ticker = Ticker::every(Duration::from_millis(400));
@ -227,7 +227,7 @@ pub async fn non_blocking_application(
mio_led.toggle().unwrap(); mio_led.toggle().unwrap();
let measurements = l3gd20.all().await.unwrap(); let measurements = l3gd20.all().await.unwrap();
info!("L3GD20: {:?}", measurements); info!("L3GD20: {measurements:?}");
info!("L3GD20 Temp: {:?}", measurements.temp_celcius()); info!("L3GD20 Temp: {:?}", measurements.temp_celcius());
for led in emio_leds.iter_mut() { for led in emio_leds.iter_mut() {
led.toggle().unwrap(); led.toggle().unwrap();
@ -287,6 +287,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -259,6 +259,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -309,7 +309,7 @@ async fn main(spawner: Spawner) -> ! {
read_buf[i] = unsafe { uart_0_cons.dequeue_unchecked() }; read_buf[i] = unsafe { uart_0_cons.dequeue_unchecked() };
}); });
if read_bytes > 0 { if read_bytes > 0 {
info!("Received {} bytes on UART0", read_bytes); info!("Received {read_bytes} bytes on UART0");
info!( info!(
"Data: {:?}", "Data: {:?}",
core::str::from_utf8(&read_buf[0..read_bytes]).unwrap() core::str::from_utf8(&read_buf[0..read_bytes]).unwrap()
@ -321,7 +321,7 @@ async fn main(spawner: Spawner) -> ! {
read_buf[i] = unsafe { uartlite_cons.dequeue_unchecked() }; read_buf[i] = unsafe { uartlite_cons.dequeue_unchecked() };
}); });
if read_bytes > 0 { if read_bytes > 0 {
info!("Received {} bytes on UARTLITE", read_bytes); info!("Received {read_bytes} bytes on UARTLITE");
info!( info!(
"Data: {:?}", "Data: {:?}",
core::str::from_utf8(&read_buf[0..read_bytes]).unwrap() core::str::from_utf8(&read_buf[0..read_bytes]).unwrap()
@ -333,7 +333,7 @@ async fn main(spawner: Spawner) -> ! {
read_buf[i] = unsafe { uart16550_cons.dequeue_unchecked() }; read_buf[i] = unsafe { uart16550_cons.dequeue_unchecked() };
}); });
if read_bytes > 0 { if read_bytes > 0 {
info!("Received {} bytes on UART16550", read_bytes); info!("Received {read_bytes} bytes on UART16550");
info!( info!(
"Data: {:?}", "Data: {:?}",
core::str::from_utf8(&read_buf[0..read_bytes]).unwrap() core::str::from_utf8(&read_buf[0..read_bytes]).unwrap()
@ -344,7 +344,7 @@ async fn main(spawner: Spawner) -> ! {
} }
fn build_print_string(prefix: &str, base_str: &str) -> alloc::string::String { fn build_print_string(prefix: &str, base_str: &str) -> alloc::string::String {
format!("{} {}\n\r", prefix, base_str) format!("{prefix} {base_str}\n\r")
} }
#[embassy_executor::task] #[embassy_executor::task]
@ -490,7 +490,7 @@ pub fn on_interrupt_axi_16550() {
match int_id { match int_id {
axi_uart16550::registers::IntId2::ReceiverLineStatus => { axi_uart16550::registers::IntId2::ReceiverLineStatus => {
let errors = rx.on_interrupt_receiver_line_status(iir); let errors = rx.on_interrupt_receiver_line_status(iir);
warn!("Receiver line status error: {:?}", errors); warn!("Receiver line status error: {errors:?}");
} }
axi_uart16550::registers::IntId2::RxDataAvailable axi_uart16550::registers::IntId2::RxDataAvailable
| axi_uart16550::registers::IntId2::CharTimeout => { | axi_uart16550::registers::IntId2::CharTimeout => {
@ -565,6 +565,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -148,6 +148,6 @@ pub extern "C" fn _prefetch_handler() {
/// Panic handler /// Panic handler
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
error!("Panic: {:?}", info); error!("Panic: {info:?}");
loop {} loop {}
} }

View File

@ -11,7 +11,7 @@ keywords = ["no-std", "hal", "amd", "zynq7000", "xilinx", "bare-metal"]
categories = ["embedded", "no-std", "hardware-support"] categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
cortex-ar = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main" } cortex-ar = "0.2"
zynq7000 = { path = "../zynq7000" } zynq7000 = { path = "../zynq7000" }
arbitrary-int = "1.3" arbitrary-int = "1.3"

View File

@ -4,7 +4,7 @@ use zynq7000::gpio::{Gpio, MaskedOutput, MmioGpio};
use crate::slcr::Slcr; use crate::slcr::Slcr;
use super::{mio::MuxConf, PinIsOutputOnly}; use super::{PinIsOutputOnly, mio::MuxConf};
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum PinOffset { pub enum PinOffset {

View File

@ -172,7 +172,8 @@ impl Flex {
pub fn configure_as_output_open_drain(&mut self, level: PinState, with_internal_pullup: bool) { pub fn configure_as_output_open_drain(&mut self, level: PinState, with_internal_pullup: bool) {
self.mode = PinMode::OutputOpenDrain; self.mode = PinMode::OutputOpenDrain;
self.ll.configure_as_output_open_drain(level, with_internal_pullup); self.ll
.configure_as_output_open_drain(level, with_internal_pullup);
} }
/// If the pin is configured as an input pin, this function does nothing. /// If the pin is configured as an input pin, this function does nothing.

View File

@ -11,8 +11,8 @@ keywords = ["no-std", "arm", "cortex-a", "amd", "zynq7000"]
categories = ["embedded", "no-std", "hardware-support"] categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
cortex-a-rt = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main", optional = true, features = ["vfp-dp"] } cortex-a-rt = { version = "0.1", optional = true, features = ["vfp-dp"] }
cortex-ar = { git = "https://github.com/rust-embedded/cortex-ar", branch = "main" } cortex-ar = "0.2"
[features] [features]
default = ["rt"] default = ["rt"]

View File

@ -12,7 +12,7 @@ categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
static_assertions = "1.1" static_assertions = "1.1"
derive-mmio = { git = "https://github.com/us-irs/derive-mmio", branch = "inner-mmio-by-shared-ref", default-features = false } derive-mmio = { version = "0.5", default-features = false }
bitbybit = "1.3" bitbybit = "1.3"
arbitrary-int = "1.3" arbitrary-int = "1.3"
rustversion = "1" rustversion = "1"