mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-30 05:40:39 +00:00
Fix new clippy lints introduced in 1.78 & 1.79 (#1776)
* Fix new clippy lints introduced in 1.78 & 1.79 * Patch semihosting
This commit is contained in:
parent
eb54168228
commit
e75d43d3f0
@ -205,7 +205,7 @@ impl<ADCI> AdcCalScheme<ADCI> for () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A helper trait to get access to ADC calibration efuses.
|
/// A helper trait to get access to ADC calibration efuses.
|
||||||
#[cfg(not(esp32h2))]
|
#[cfg(not(any(esp32, esp32s2, esp32h2)))]
|
||||||
trait AdcCalEfuse {
|
trait AdcCalEfuse {
|
||||||
/// Get ADC calibration init code
|
/// Get ADC calibration init code
|
||||||
///
|
///
|
||||||
|
@ -413,14 +413,13 @@ mod vectored {
|
|||||||
// this has no effect on level interrupts, but the interrupt may be an edge one
|
// this has no effect on level interrupts, but the interrupt may be an edge one
|
||||||
// so we clear it anyway
|
// so we clear it anyway
|
||||||
clear(core, cpu_intr);
|
clear(core, cpu_intr);
|
||||||
|
let prio: Priority =
|
||||||
let configured_interrupts = get_configured_interrupts(core, status, unsafe {
|
unsafe { core::mem::transmute(INTERRUPT_TO_PRIORITY[cpu_intr as usize - 1] as u8) };
|
||||||
core::mem::transmute(INTERRUPT_TO_PRIORITY[cpu_intr as usize - 1] as u8)
|
let configured_interrupts = get_configured_interrupts(core, status, prio);
|
||||||
});
|
|
||||||
|
|
||||||
for interrupt_nr in configured_interrupts.iterator() {
|
for interrupt_nr in configured_interrupts.iterator() {
|
||||||
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
||||||
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
||||||
handle_interrupt(interrupt, context);
|
handle_interrupt(interrupt, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,7 +476,7 @@ mod vectored {
|
|||||||
|
|
||||||
for interrupt_nr in configured_interrupts.iterator() {
|
for interrupt_nr in configured_interrupts.iterator() {
|
||||||
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
||||||
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
||||||
handle_interrupt(level, interrupt, save_frame);
|
handle_interrupt(level, interrupt, save_frame);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -487,7 +487,7 @@ mod vectored {
|
|||||||
|
|
||||||
for interrupt_nr in configured_interrupts.iterator() {
|
for interrupt_nr in configured_interrupts.iterator() {
|
||||||
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
// Don't use `Interrupt::try_from`. It's slower and placed in flash
|
||||||
let interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
let interrupt: Interrupt = unsafe { core::mem::transmute(interrupt_nr as u16) };
|
||||||
handle_interrupt(level, interrupt, save_frame);
|
handle_interrupt(level, interrupt, save_frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,12 @@ pub struct Stack<const SIZE: usize> {
|
|||||||
pub mem: MaybeUninit<[u8; SIZE]>,
|
pub mem: MaybeUninit<[u8; SIZE]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const SIZE: usize> Default for Stack<SIZE> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::len_without_is_empty)]
|
#[allow(clippy::len_without_is_empty)]
|
||||||
impl<const SIZE: usize> Stack<SIZE> {
|
impl<const SIZE: usize> Stack<SIZE> {
|
||||||
/// Construct a stack of length SIZE, uninitialized
|
/// Construct a stack of length SIZE, uninitialized
|
||||||
|
@ -84,6 +84,12 @@ pub struct Stack<const SIZE: usize> {
|
|||||||
pub mem: MaybeUninit<[u8; SIZE]>,
|
pub mem: MaybeUninit<[u8; SIZE]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const SIZE: usize> Default for Stack<SIZE> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::len_without_is_empty)]
|
#[allow(clippy::len_without_is_empty)]
|
||||||
impl<const SIZE: usize> Stack<SIZE> {
|
impl<const SIZE: usize> Stack<SIZE> {
|
||||||
/// Construct a stack of length SIZE, uninitialized
|
/// Construct a stack of length SIZE, uninitialized
|
||||||
|
@ -225,7 +225,8 @@ impl<'a> Ieee802154<'a> {
|
|||||||
pub fn set_tx_done_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
|
pub fn set_tx_done_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
|
||||||
critical_section::with(|cs| {
|
critical_section::with(|cs| {
|
||||||
let mut tx_done_callback = TX_DONE_CALLBACK.borrow_ref_mut(cs);
|
let mut tx_done_callback = TX_DONE_CALLBACK.borrow_ref_mut(cs);
|
||||||
tx_done_callback.replace(unsafe { core::mem::transmute(callback) });
|
let cb: &'static mut (dyn FnMut() + Send) = unsafe { core::mem::transmute(callback) };
|
||||||
|
tx_done_callback.replace(cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +242,8 @@ impl<'a> Ieee802154<'a> {
|
|||||||
pub fn set_rx_available_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
|
pub fn set_rx_available_callback(&mut self, callback: &'a mut (dyn FnMut() + Send)) {
|
||||||
critical_section::with(|cs| {
|
critical_section::with(|cs| {
|
||||||
let mut rx_available_callback = RX_AVAILABLE_CALLBACK.borrow_ref_mut(cs);
|
let mut rx_available_callback = RX_AVAILABLE_CALLBACK.borrow_ref_mut(cs);
|
||||||
rx_available_callback.replace(unsafe { core::mem::transmute(callback) });
|
let cb: &'static mut (dyn FnMut() + Send) = unsafe { core::mem::transmute(callback) };
|
||||||
|
rx_available_callback.replace(cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,9 @@ nb = "1.1.0"
|
|||||||
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
|
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
|
||||||
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
|
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
semihosting = { git = "https://github.com/taiki-e/semihosting", tag = "v0.1.10" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["async", "embassy", "embassy-time-timg0"]
|
default = ["async", "embassy", "embassy-time-timg0"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user