From 65de070c8f5c98d0a6510ec90cf89b98289e6139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Tue, 27 Aug 2024 09:47:27 +0200 Subject: [PATCH] Merge impl blocks --- esp-hal/src/rsa/mod.rs | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/esp-hal/src/rsa/mod.rs b/esp-hal/src/rsa/mod.rs index 31140a20dc1..50ba5b99330 100644 --- a/esp-hal/src/rsa/mod.rs +++ b/esp-hal/src/rsa/mod.rs @@ -47,26 +47,6 @@ pub struct Rsa<'d, DM: crate::Mode> { phantom: PhantomData, } -impl<'d, DM: crate::Mode> Rsa<'d, DM> { - fn internal_set_interrupt_handler(&mut self, handler: InterruptHandler) { - unsafe { - crate::interrupt::bind_interrupt(crate::peripherals::Interrupt::RSA, handler.handler()); - crate::interrupt::enable(crate::peripherals::Interrupt::RSA, handler.priority()) - .unwrap(); - } - } - - fn wait_for_idle(&self) { - while !self.is_idle() {} - self.clear_interrupt(); - } - - fn read_results(&self, outbuf: &mut [u32; N]) { - self.wait_for_idle(); - self.read_out(outbuf); - } -} - impl<'d> Rsa<'d, crate::Blocking> { /// Create a new instance in [crate::Blocking] mode. /// @@ -150,6 +130,24 @@ impl<'d, DM: crate::Mode> Rsa<'d, DM> { ); } } + + fn internal_set_interrupt_handler(&mut self, handler: InterruptHandler) { + unsafe { + crate::interrupt::bind_interrupt(crate::peripherals::Interrupt::RSA, handler.handler()); + crate::interrupt::enable(crate::peripherals::Interrupt::RSA, handler.priority()) + .unwrap(); + } + } + + fn wait_for_idle(&self) { + while !self.is_idle() {} + self.clear_interrupt(); + } + + fn read_results(&self, outbuf: &mut [u32; N]) { + self.wait_for_idle(); + self.read_out(outbuf); + } } /// Defines the input size of an RSA operation.