aboutsummaryrefslogtreecommitdiff
path: root/embassy-mcxa/src/gpio.rs
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2025-12-18 13:55:57 +0000
committerGitHub <[email protected]>2025-12-18 13:55:57 +0000
commitb5b49cbcf3a991bf6d434b0870da50f3ee722612 (patch)
treedd1c673cbe1e2512c785173762f8d63e472c5e8b /embassy-mcxa/src/gpio.rs
parentf85337064c724f8fdb855e847345908e4c7384e9 (diff)
parentd6c65cd0e4b651b1b07e1583562dfccfd5db22b1 (diff)
Merge pull request #5071 from jamesmunns/james/bad-sosc
[MCXA]: Add support for SOSC/clk_in
Diffstat (limited to 'embassy-mcxa/src/gpio.rs')
-rw-r--r--embassy-mcxa/src/gpio.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/embassy-mcxa/src/gpio.rs b/embassy-mcxa/src/gpio.rs
index 65f8df985..29d66656d 100644
--- a/embassy-mcxa/src/gpio.rs
+++ b/embassy-mcxa/src/gpio.rs
@@ -81,7 +81,7 @@ fn GPIO4() {
81 irq_handler(4, crate::pac::Gpio4::ptr()); 81 irq_handler(4, crate::pac::Gpio4::ptr());
82} 82}
83 83
84pub(crate) unsafe fn init() { 84pub(crate) unsafe fn interrupt_init() {
85 use embassy_hal_internal::interrupt::InterruptExt; 85 use embassy_hal_internal::interrupt::InterruptExt;
86 86
87 crate::pac::interrupt::GPIO0.enable(); 87 crate::pac::interrupt::GPIO0.enable();
@@ -320,8 +320,12 @@ impl GpioPin for AnyPin {}
320 320
321macro_rules! impl_pin { 321macro_rules! impl_pin {
322 ($peri:ident, $port:expr, $pin:expr, $block:ident) => { 322 ($peri:ident, $port:expr, $pin:expr, $block:ident) => {
323 impl_pin!(crate::peripherals, $peri, $port, $pin, $block);
324 };
325
326 ($perip:path, $peri:ident, $port:expr, $pin:expr, $block:ident) => {
323 paste! { 327 paste! {
324 impl SealedPin for crate::peripherals::$peri { 328 impl SealedPin for $perip::$peri {
325 fn pin_port(&self) -> usize { 329 fn pin_port(&self) -> usize {
326 $port * 32 + $pin 330 $port * 32 + $pin
327 } 331 }
@@ -372,15 +376,15 @@ macro_rules! impl_pin {
372 } 376 }
373 } 377 }
374 378
375 impl GpioPin for crate::peripherals::$peri {} 379 impl GpioPin for $perip::$peri {}
376 380
377 impl From<crate::peripherals::$peri> for AnyPin { 381 impl From<$perip::$peri> for AnyPin {
378 fn from(value: crate::peripherals::$peri) -> Self { 382 fn from(value: $perip::$peri) -> Self {
379 value.degrade() 383 value.degrade()
380 } 384 }
381 } 385 }
382 386
383 impl crate::peripherals::$peri { 387 impl $perip::$peri {
384 /// Convenience helper to obtain a type-erased handle to this pin. 388 /// Convenience helper to obtain a type-erased handle to this pin.
385 pub fn degrade(&self) -> AnyPin { 389 pub fn degrade(&self) -> AnyPin {
386 AnyPin::new(self.port(), self.pin(), self.gpio(), self.port_reg(), self.pcr_reg()) 390 AnyPin::new(self.port(), self.pin(), self.gpio(), self.port_reg(), self.pcr_reg())
@@ -453,8 +457,8 @@ impl_pin!(P1_26, 1, 26, Gpio1);
453impl_pin!(P1_27, 1, 27, Gpio1); 457impl_pin!(P1_27, 1, 27, Gpio1);
454impl_pin!(P1_28, 1, 28, Gpio1); 458impl_pin!(P1_28, 1, 28, Gpio1);
455impl_pin!(P1_29, 1, 29, Gpio1); 459impl_pin!(P1_29, 1, 29, Gpio1);
456impl_pin!(P1_30, 1, 30, Gpio1); 460impl_pin!(crate::internal_peripherals, P1_30, 1, 30, Gpio1);
457impl_pin!(P1_31, 1, 31, Gpio1); 461impl_pin!(crate::internal_peripherals, P1_31, 1, 31, Gpio1);
458 462
459impl_pin!(P2_0, 2, 0, Gpio2); 463impl_pin!(P2_0, 2, 0, Gpio2);
460impl_pin!(P2_1, 2, 1, Gpio2); 464impl_pin!(P2_1, 2, 1, Gpio2);