Struct Peri Copy item path Source pub struct Peri<'a, T>{ }Expand description An exclusive reference to a peripheral.
This is functionally the same as a &'a mut T. There’s a few advantages in having
a dedicated struct instead:
Memory efficiency: Peripheral singletons are typically either zero-sized (for concrete
peripherals like PA9 or SPI4) or very small (for example AnyPin, which is 1 byte).
However &mut T is always 4 bytes for 32-bit targets, even if T is zero-sized.
Peripheral stores a copy of T instead, so it’s the same size.
Code size efficiency. If the user uses the same driver with both SPI4 and &mut SPI4,
the driver code would be monomorphized two times. With Peri, the driver is generic
over a lifetime only. SPI4 becomes Peri<'static, SPI4>, and &mut SPI4 becomes
Peri<'a, SPI4>. Lifetimes don’t cause monomorphization.
Unsafely clone (duplicate) a peripheral singleton.
§ Safety
This returns an owned clone of the peripheral. You must manually ensure
only one copy of the peripheral is in use at a time. For example, don’t
create two SPI drivers on SPI1, because they will “fight” each other.
You should strongly prefer using reborrow() instead. It returns a
Peri that borrows self, which allows the borrow checker
to enforce this at compile time.
Reborrow into a “child” Peri.
self will stay borrowed until the child Peripheral is dropped.
Map the inner peripheral using Into.
This converts from Peri<'a, T> to Peri<'a, U>, using an
Into impl to convert from T to U.
For example, this can be useful to.into() GPIO pins: converting from Peri<’a, PB11>toPeri<’a, AnyPin>`.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Type-erase the channel. The pin (if any) is configured for the ADC once, here.
Borrow the channel, type-erased. The pin (if any) is configured for the ADC.
Formats the value using the given formatter.
Read more The resulting type after dereferencing.
Dereferences the value.
Formats the value using the given formatter.
Read more Writes the defmt representation of self to fmt.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
🔬 This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.