Compare functions by their address (#3650)

* Compare functions by their address

* Remove traits
This commit is contained in:
Dániel Buga 2025-06-17 18:43:51 +02:00 committed by GitHub
parent 6e74add2a0
commit 150b57f03f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 4 deletions

View File

@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- `InterruptHandler` no longer implements `PartialEq`, `Eq` or `Hash`. (#3650)
## [v1.0.0-beta.1] - 2025-06-03

View File

@ -94,11 +94,9 @@ impl CFnPtr {
pub(crate) fn bind_default_interrupt_handler() {
// We first check if a handler is set in the vector table.
if let Some(handler) = interrupt::bound_handler(Interrupt::GPIO) {
let handler = handler as *const unsafe extern "C" fn();
// We only allow binding the default handler if nothing else is bound.
// This prevents silently overwriting RTIC's interrupt handler, if using GPIO.
if !core::ptr::eq(handler, DEFAULT_INTERRUPT_HANDLER.handler() as _) {
if !core::ptr::fn_addr_eq(handler, DEFAULT_INTERRUPT_HANDLER.handler()) {
// The user has configured an interrupt handler they wish to use.
info!("Not using default GPIO interrupt handler: already bound in vector table");
return;

View File

@ -122,7 +122,7 @@ pub trait InterruptConfigurable: crate::private::Sealed {
multi_core,
doc = "**Note**: Interrupts are handled on the core they were setup on, if a driver is initialized on core 0, and moved to core 1, core 0 will still handle the interrupt."
)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct InterruptHandler {
f: extern "C" fn(),