Merge pull request #3207 from diondokter/fix-opamp-lifetimes

Add extra lifetime to opamp-using structs
This commit is contained in:
Dario Nieuwenhuis 2024-07-25 15:14:10 +00:00 committed by GitHub
commit 8c4f044ae7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,11 +81,11 @@ impl<'d, T: Instance> OpAmp<'d, T> {
/// directly used as an ADC input. The opamp will be disabled when the /// directly used as an ADC input. The opamp will be disabled when the
/// [`OpAmpOutput`] is dropped. /// [`OpAmpOutput`] is dropped.
pub fn buffer_ext( pub fn buffer_ext(
&'d mut self, &mut self,
in_pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>, in_pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>,
out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin> + 'd, out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin>,
gain: OpAmpGain, gain: OpAmpGain,
) -> OpAmpOutput<'d, T> { ) -> OpAmpOutput<'_, T> {
into_ref!(in_pin); into_ref!(in_pin);
into_ref!(out_pin); into_ref!(out_pin);
in_pin.set_as_analog(); in_pin.set_as_analog();
@ -120,9 +120,9 @@ impl<'d, T: Instance> OpAmp<'d, T> {
/// [`OpAmpOutput`] is dropped. /// [`OpAmpOutput`] is dropped.
#[cfg(opamp_g4)] #[cfg(opamp_g4)]
pub fn buffer_dac( pub fn buffer_dac(
&'d mut self, &mut self,
out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin> + 'd, out_pin: impl Peripheral<P = impl OutputPin<T> + crate::gpio::Pin>,
) -> OpAmpOutput<'d, T> { ) -> OpAmpOutput<'_, T> {
into_ref!(out_pin); into_ref!(out_pin);
out_pin.set_as_analog(); out_pin.set_as_analog();
@ -148,10 +148,10 @@ impl<'d, T: Instance> OpAmp<'d, T> {
/// The opamp output will be disabled when it is dropped. /// The opamp output will be disabled when it is dropped.
#[cfg(opamp_g4)] #[cfg(opamp_g4)]
pub fn buffer_int( pub fn buffer_int(
&'d mut self, &mut self,
pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>, pin: impl Peripheral<P = impl NonInvertingPin<T> + crate::gpio::Pin>,
gain: OpAmpGain, gain: OpAmpGain,
) -> OpAmpInternalOutput<'d, T> { ) -> OpAmpInternalOutput<'_, T> {
into_ref!(pin); into_ref!(pin);
pin.set_as_analog(); pin.set_as_analog();