From 826150caa3209de02c079cdd75945c42014730ea Mon Sep 17 00:00:00 2001 From: Ashcon Mohseninia Date: Sat, 18 Oct 2025 21:36:48 +0100 Subject: [PATCH 1/2] Fix EIC Event system enable bit setting --- hal/src/peripherals/eic/d11/pin.rs | 4 +++- hal/src/peripherals/eic/d5x/pin.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hal/src/peripherals/eic/d11/pin.rs b/hal/src/peripherals/eic/d11/pin.rs index 1d78ef102a60..ab723f167642 100644 --- a/hal/src/peripherals/eic/d11/pin.rs +++ b/hal/src/peripherals/eic/d11/pin.rs @@ -59,7 +59,9 @@ where pub fn enable_event(&mut self) { self.chan.with_disable(|e| { e.evctrl() - .modify(|_, w| unsafe { w.bits(1 << P::ChId::ID) }); + .modify(|r, w| unsafe { w.bits(r.bits() | 1 << P::ChId::ID) }); + }); + } }); } diff --git a/hal/src/peripherals/eic/d5x/pin.rs b/hal/src/peripherals/eic/d5x/pin.rs index 2dd2bdac72f7..6252c1227ff1 100644 --- a/hal/src/peripherals/eic/d5x/pin.rs +++ b/hal/src/peripherals/eic/d5x/pin.rs @@ -65,7 +65,10 @@ where pub fn enable_event(&mut self) { self.chan.with_disable(|e| { e.evctrl() - .modify(|_, w| unsafe { w.bits(1 << P::ChId::ID) }); + .modify(|r, w| unsafe { w.bits(r.bits() | 1 << P::ChId::ID) }); + }); + } + }); } From d3759c9e30c243b5bc8c7e5d15257f16b5317d5e Mon Sep 17 00:00:00 2001 From: Ashcon Mohseninia Date: Sat, 18 Oct 2025 21:37:21 +0100 Subject: [PATCH 2/2] Add EIC Event system disable method --- hal/src/peripherals/eic/d11/pin.rs | 9 +++++++++ hal/src/peripherals/eic/d5x/pin.rs | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/hal/src/peripherals/eic/d11/pin.rs b/hal/src/peripherals/eic/d11/pin.rs index ab723f167642..e1b3ec8e3ae4 100644 --- a/hal/src/peripherals/eic/d11/pin.rs +++ b/hal/src/peripherals/eic/d11/pin.rs @@ -62,6 +62,15 @@ where .modify(|r, w| unsafe { w.bits(r.bits() | 1 << P::ChId::ID) }); }); } + + /// Disables the event output of the channel for the event system. + /// + /// Note that whilst this function is executed, the EIC peripheral is disabled + /// in order to write to the evctrl register + pub fn disable_event(&mut self) { + self.chan.with_disable(|e| { + e.evctrl() + .modify(|r, w| unsafe { w.bits(r.bits() & !(1 << P::ChId::ID)) }); }); } diff --git a/hal/src/peripherals/eic/d5x/pin.rs b/hal/src/peripherals/eic/d5x/pin.rs index 6252c1227ff1..fd2be7110af8 100644 --- a/hal/src/peripherals/eic/d5x/pin.rs +++ b/hal/src/peripherals/eic/d5x/pin.rs @@ -69,6 +69,14 @@ where }); } + /// Disables the event output of the channel for the event system. + /// + /// Note that whilst this function is executed, the EIC peripheral is disabled + /// in order to write to the evctrl register + pub fn disable_event(&mut self) { + self.chan.with_disable(|e| { + e.evctrl() + .modify(|r, w| unsafe { w.bits(r.bits() & !(1 << P::ChId::ID)) }); }); }