### Get Current SPI Configuration Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Retrieves the current configuration of the SPI peripheral. This is useful for inspecting the active settings without modifying them. ```rust pub fn get_current_config(&self) -> Config ``` -------------------------------- ### Create Async SPI Slave Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Initializes a new asynchronous SPI slave driver. Requires peripheral instances for SPI, SCK, MOSI, MISO, CS pins, TX/RX DMA, interrupt bindings, and an initial configuration. ```rust pub fn new_slave, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, miso: Peri<'d, impl MisoPin>, cs: Peri<'d, impl CsPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self ``` -------------------------------- ### CkPin Trait Documentation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.CkPin.html?search=std%3A%3Avec Documentation for the CkPin trait, which is used to get the AF number for SPI clock pins. ```APIDOC ## Trait: CkPin ### Description This trait provides a method to retrieve the AF (Alternate Function) number required to use a specific pin as a clock pin for SPI communication. ### Methods #### `fn af_num(&self) -> u8` **Description**: Get the AF number needed to use this pin as a CkPin. ### Dyn Compatibility This trait is **not** dyn compatible. In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe. ### Implementors This trait is implemented for several pins when used with SPI1, provided they are not using the `afio` peripheral. #### `impl CkPin for PA1` Available on **non-`afio`** only. #### `impl CkPin for PA5` Available on **non-`afio`** only. #### `impl CkPin for PB3` Available on **non-`afio`** only. #### `impl CkPin for PB6` Available on **non-`afio`** only. ``` -------------------------------- ### Create Async SPI Master Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Initializes a new asynchronous SPI master driver. Requires peripheral instances for SPI, SCK, MOSI, MISO pins, TX/RX DMA, interrupt bindings, and an initial configuration. ```rust pub fn new, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, miso: Peri<'d, impl MisoPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self ``` -------------------------------- ### SPI Async Master Driver Creation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html Provides constructors for creating asynchronous SPI master drivers using DMA. These include standard master, RX-only, and TX-only configurations. The constructors require peripheral instances, DMA channels, interrupt bindings, and configuration settings. ```rust pub fn new, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, miso: Peri<'d, impl MisoPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self Create a new SPI driver. pub fn new_rxonly, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, miso: Peri<'d, impl MisoPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self Create a new SPI driver, in RX-only mode (only MISO pin, no MOSI). pub fn new_txonly>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, tx_dma: Peri<'d, D1>, _irq: impl Binding> + 'd, config: Config, ) -> Self Create a new SPI driver, in TX-only mode (only MOSI pin, no MISO). ``` -------------------------------- ### Implement Any for T in Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Phase.html?search=u32+-%3E+bool Provides a way to get the `TypeId` of a trait object, allowing for runtime type identification. This is a blanket implementation for any type `T` that is `'static` and `?Sized`. ```rust impl Any for T { fn type_id(&self) -> TypeId; } ``` -------------------------------- ### Transmit SPI Data Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Direction.html This section describes the transmit functionality for SPI communication. Specific code examples for transmit operations are not provided in this text. -------------------------------- ### Instance Trait Documentation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.Instance.html Details the `Instance` trait, which is implemented by SPI peripherals. It outlines the trait's requirements and compatibility. ```APIDOC ## Trait: Instance ### Description Peripheral instance trait. This trait is implemented by SPI peripherals to provide access to their functionality. ### Dyn Compatibility This trait is **not** dyn compatible. In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe. ### Implementors - `SPI1` - `SPI2` ``` -------------------------------- ### Default Implementation for SPI Config Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Config.html?search= Enables the creation of a default SPI configuration, providing a standard set of parameters to initialize SPI communication. ```rust impl Default for Config { fn default() -> Self; } ``` -------------------------------- ### RxDma Trait Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.RxDma.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The RxDma trait is used to manage DMA requests for SPI peripherals. It provides methods to get the DMA request number and to remap the DMA channel. ```APIDOC ## Trait RxDma ### Description RxDma DMA request trait. This trait defines the interface for handling DMA requests when using a channel as a receiver for SPI data. ### Required Methods - **`request(&self) -> Request`**: Returns the DMA request number required for this channel. Note that STMicroelectronics sometimes refers to this as the 'channel', while calling 'streams' as channels. - **`remap(&self)`**: Remaps the DMA channel. The specific remapping behavior depends on the underlying hardware. ### Dyn Compatibility This trait is **not** dyn compatible (not object safe). ``` -------------------------------- ### Implement CloneToUninit Trait (Nightly) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Error.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E A nightly-only experimental API that allows copying data into uninitialized memory. This is an unsafe operation and should be used with extreme caution. ```rust unsafe impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) { // Performs copy-assignment from self to dest. } } ``` -------------------------------- ### Get DMA Request Number for RxDma Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.RxDma.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The 'request' method returns the DMA request number necessary for using a channel as an RxDma. Note that STMicroelectronics uses 'channel' and 'stream' differently than embassy-stm32. ```rust fn request(&self) -> Request; ``` -------------------------------- ### MosiPin Trait Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.MosiPin.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The MosiPin trait defines the interface for pins that can be used as the MOSI output in SPI communication. It requires implementing the `Pin` trait and provides a method to get the alternate function number. ```APIDOC ## Trait MosiPin ### Description Represents a pin that can be configured as the Master Out Slave In (MOSI) for SPI communication. This trait is part of the `embassy_stm32::spi` module. ### Method - `af_num(&self) -> u8` - Returns the alternate function number associated with this MOSI pin. ### Required Traits - `Pin` - `Copy` ### Example Usage (Conceptual) ```rust // Assuming MosiPin is implemented for a specific pin like PA7 on an STM32 microcontroller use embassy_stm32::spi::MosiPin; // This is a conceptual example and requires a concrete pin implementation // let mosi_pin = embassy_stm32::gpio::PA7; // let af_number = mosi_pin.af_num(); // println!("Alternate Function Number for MOSI pin: {}", af_number); ``` ``` -------------------------------- ### STM32 SPI Instances Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.Instance.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E A comprehensive list of SPI instances available for different STM32 microcontroller series. ```APIDOC ## STM32 SPI Instances ### Description This section lists the available SPI peripheral instances for various STM32 microcontroller families. Each entry represents a specific microcontroller model with SPI capabilities. ### Method N/A (Informational List) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## List of SPI Instances ### STM32L4 Series - stm32l486zg - stm32l496ae - stm32l496ag - stm32l496qe - stm32l496qg - stm32l496re - stm32l496rg - stm32l496ve - stm32l496vg - stm32l496wg - stm32l496ze - stm32l496zg - stm32l4a6ag - stm32l4a6qg - stm32l4a6rg - stm32l4a6vg - stm32l4a6zg - stm32l4p5ae - stm32l4p5ag - stm32l4p5ce - stm32l4p5cg - stm32l4p5qe - stm32l4p5qg - stm32l4p5re - stm32l4p5rg - stm32l4p5ve - stm32l4p5vg - stm32l4p5ze - stm32l4p5zg - stm32l4q5ag - stm32l4q5cg - stm32l4q5qg - stm32l4q5rg - stm32l4q5vg - stm32l4q5zg - stm32l4r5ag - stm32l4r5ai - stm32l4r5qg - stm32l4r5qi - stm32l4r5vg - stm32l4r5vi - stm32l4r5zg - stm32l4r5zi - stm32l4r7ai - stm32l4r7vi - stm32l4r7zi - stm32l4r9ag - stm32l4r9ai - stm32l4r9vg - stm32l4r9vi - stm32l4r9zg - stm32l4r9zi - stm32l4s5ai - stm32l4s5qi - stm32l4s5vi - stm32l4s5zi - stm32l4s7ai - stm32l4s7vi - stm32l4s7zi - stm32l4s9ai - stm32l4s9vi - stm32l4s9zi ### STM32L5 Series - stm32l552cc - stm32l552ce - stm32l552me - stm32l552qc - stm32l552qe - stm32l552rc - stm32l552re - stm32l552vc - stm32l552ve - stm32l552zc - stm32l552ze - stm32l562ce - stm32l562me - stm32l562qe - stm32l562re - stm32l562ve - stm32l562ze ### STM32N6 Series - stm32n645a0 - stm32n645b0 - stm32n645i0 - stm32n645l0 - stm32n645x0 - stm32n645z0 - stm32n647a0 - stm32n647b0 - stm32n647i0 - stm32n647l0 - stm32n647x0 - stm32n647z0 - stm32n655a0 - stm32n655b0 - stm32n655i0 - stm32n655l0 - stm32n655x0 - stm32n655z0 - stm32n657a0 - stm32n657b0 - stm32n657i0 - stm32n657l0 - stm32n657x0 - stm32n657z0 ### STM32U0 Series - stm32u031c6 - stm32u031c8 - stm32u031f4 - stm32u031f6 - stm32u031f8 - stm32u031g6 - stm32u031g8 - stm32u031k4 - stm32u031k6 - stm32u031k8 - stm32u031r6 - stm32u031r8 - stm32u073c8 - stm32u073cb - stm32u073cc - stm32u073h8 - stm32u073hb - stm32u073hc - stm32u073k8 - stm32u073kb - stm32u073kc - stm32u073m8 - stm32u073mb - stm32u073mc - stm32u073r8 - stm32u073rb - stm32u073rc - stm32u083cc - stm32u083hc - stm32u083kc - stm32u083mc - stm32u083rc ### STM32U3 Series - stm32u375ce - stm32u375cg - stm32u375ke - stm32u375kg - stm32u375re - stm32u375rg - stm32u375ve - stm32u375vg - stm32u385cg - stm32u385kg - stm32u385rg - stm32u385vg ### STM32U5 Series - stm32u535cb - stm32u535cc - stm32u535ce - stm32u535je - stm32u535nc - stm32u535ne - stm32u535rb - stm32u535rc - stm32u535re - stm32u535vc - stm32u535ve - stm32u545ce - stm32u545je - stm32u545ne - stm32u545re - stm32u545ve - stm32u575ag - stm32u575ai - stm32u575cg - stm32u575ci - stm32u575og - stm32u575oi - stm32u575qg - stm32u575qi - stm32u575rg - stm32u575ri - stm32u575vg - stm32u575vi - stm32u575zg - stm32u575zi - stm32u585ai - stm32u585ci - stm32u585oi - stm32u585qi - stm32u585ri - stm32u585vi - stm32u585zi - stm32u595ai - stm32u595aj - stm32u595qi - stm32u595qj - stm32u595ri - stm32u595rj - stm32u595vi - stm32u595vj - stm32u595zi - stm32u595zj - stm32u599bj - stm32u599ni - stm32u599nj - stm32u599vi - stm32u599vj - stm32u599zi - stm32u599zj - stm32u5a5aj - stm32u5a5qi - stm32u5a5qj - stm32u5a5rj - stm32u5a5vj - stm32u5a5zj - stm32u5a9bj - stm32u5a9nj - stm32u5a9vj - stm32u5a9zj - stm32u5f7vi - stm32u5f7vj - stm32u5f9bj - stm32u5f9nj - stm32u5f9vi - stm32u5f9vj - stm32u5f9zi - stm32u5f9zj - stm32u5g7vj - stm32u5g9bj - stm32u5g9nj - stm32u5g9vj - stm32u5g9zj ### STM32WB Series - stm32wb10cc - stm32wb15cc - stm32wb30ce - stm32wb35cc - stm32wb35ce - stm32wb50cg - stm32wb55cc - stm32wb55ce - stm32wb55cg - stm32wb55rc - stm32wb55re - stm32wb55rg - stm32wb55vc - stm32wb55ve - stm32wb55vg - stm32wb55vy - stm32wba50ke - stm32wba50kg - stm32wba52ce - stm32wba52cg - stm32wba52ke - stm32wba52kg - stm32wba54ce - stm32wba54cg - stm32wba54ke - stm32wba54kg - stm32wba55ce - stm32wba55cg - stm32wba55he - stm32wba55hg - stm32wba55ue - stm32wba55ug - stm32wba62cg - stm32wba62ci - stm32wba62mg - stm32wba62mi - stm32wba62pg - stm32wba62pi - stm32wba63cg - stm32wba63ci - stm32wba64cg - stm32wba64ci - stm32wba65cg - stm32wba65ci - stm32wba65mg - stm32wba65mi - stm32wba65pg - stm32wba65pi - stm32wba65rg - stm32wba65ri ### STM32WL Series - stm32wl54cc-cm0p - stm32wl54cc-cm4 - stm32wl54jc-cm0p - stm32wl54jc-cm4 - stm32wl55cc-cm0p - stm32wl55cc-cm4 - stm32wl55jc-cm0p - stm32wl55jc-cm4 ### STM32WLE Series - stm32wle4c8 - stm32wle4cb - stm32wle4cc - stm32wle4j8 - stm32wle4jb - stm32wle4jc - stm32wle5c8 - stm32wle5cb - stm32wle5cc - stm32wle5j8 - stm32wle5jb - stm32wle5jc ``` -------------------------------- ### Generic Type Conversions (From, Into, TryFrom, TryInto) in Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Polarity.html?search=std%3A%3Avec Illustrates generic implementations of From, Into, TryFrom, and TryInto traits. These enable flexible conversions between different types, facilitating interoperability within the Rust ecosystem. ```rust impl From for T { fn from(t: T) -> T { t } } impl Into for T where U: From, { fn into(self) -> U { U::from(self) } } // Note: TryFrom and TryInto implementations would be similar in structure, // but would involve Result types to handle potential conversion failures. ``` -------------------------------- ### Type Identity and Borrowing for Generic Types Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Mode.html?search=std%3A%3Avec Demonstrates blanket implementations for generic types. `Any` provides a way to get the `TypeId` of a value. `Borrow` and `BorrowMut` allow immutable and mutable borrowing, respectively. ```rust impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId } impl Borrow for T where T: ?Sized { fn borrow(&self) -> &T } impl BorrowMut for T where T: ?Sized { fn borrow_mut(&mut self) -> &mut T } ``` -------------------------------- ### Generic Type Conversions (From, Into, TryFrom, TryInto) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Mode.html?search= Demonstrates blanket implementations for generic type conversions. `From` and `Into` allow direct conversions, while `TryFrom` and `TryInto` provide fallible conversion mechanisms. ```rust impl From for T { fn from(t: T) -> T; } impl Into for T where U: From { fn into(self) -> U; } impl TryFrom for T where U: Into { type Error = Infallible; fn try_from(value: U) -> Result>::Error>; } impl TryInto for T where U: TryFrom { type Error = >::Error; fn try_into(self) -> Result>::Error>; } ``` -------------------------------- ### Get AF Number for CkPin (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.CkPin.html This function, `af_num`, is a required method for the `CkPin` trait. It returns the Alternate Function (AF) number necessary to configure a specific pin for SPI communication. ```rust fn af_num(&self) -> u8; ``` -------------------------------- ### Get AF Number for CkPin (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.CkPin.html?search=u32+-%3E+bool Retrieves the Alternate Function (AF) number required to configure a specific pin as a Clock (Ck) pin for an SPI peripheral. This method is part of the CkPin trait. ```rust fn af_num(&self) -> u8 ``` -------------------------------- ### Clone Implementation for SPI Config Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Config.html?search= Provides methods to duplicate and copy assignment for the SPI Config struct, allowing for easy duplication of configuration settings. ```rust impl Clone for Config { fn clone(&self) -> Config; fn clone_from(&mut self, source: &Self); } ``` -------------------------------- ### SPI Async Slave Driver Creation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html Defines a constructor for creating an asynchronous SPI slave driver utilizing DMA. This function requires peripheral instances for SPI, clock, MOSI, MISO, Chip Select, and DMA channels, along with interrupt bindings and configuration parameters. ```rust pub fn new_slave, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, miso: Peri<'d, impl MisoPin>, cs: Peri<'d, impl CsPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self Create a new SPI slave driver. ``` -------------------------------- ### Define SckPin Trait for SPI Clock Pins (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.SckPin.html Defines the `SckPin` trait in Rust, which requires implementing the `af_num` method to get the alternate function number for a pin to be used as an SPI clock. This trait is not dyn compatible. ```rust pub trait SckPin: Pin { // Required method fn af_num(&self) -> u8; } ``` -------------------------------- ### Define TxDma Trait for SPI DMA Transfers (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.TxDma.html?search= Defines the TxDma trait, which is required for using a DMA channel to transfer data with an SPI peripheral. It includes methods to get the DMA request number and remap the DMA channel. This trait is not dyn compatible. ```Rust pub trait TxDma: ChannelInstance { // Required methods fn request(&self) -> Request; fn remap(&self); } ``` -------------------------------- ### Generic CloneToUninit Implementation (Nightly Only) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.BitOrder.html?search= Implements the experimental `clone_to_uninit` method for types `T` that implement `Clone`. This nightly-only API allows copying data into uninitialized memory, requiring careful usage. ```rust impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) { // ... implementation details ... } } ``` -------------------------------- ### Clone Implementation for SPI Config Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Config.html Provides the ability to create a duplicate of an existing SPI configuration. This is useful for modifying configurations or passing them around without affecting the original. ```rust impl Clone for Config { fn clone(&self) -> Config { // ... implementation details ... } fn clone_from(&mut self, source: &Self) { // ... implementation details ... } } ``` -------------------------------- ### Define RxDma Trait for SPI DMA Requests (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.RxDma.html The RxDma trait defines the interface for DMA channels that can be used for receiving data with SPI peripherals. It requires implementations to provide a method for getting the DMA request number and another for remapping the DMA channel. ```rust pub trait RxDma: ChannelInstance { // Required methods fn request(&self) -> Request; fn remap(&self); } ``` -------------------------------- ### Create Async SPI Bidirectional Master Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Initializes a new asynchronous SPI master driver in bidirectional mode, specifically for transmit operations. Requires peripheral instances for SPI, SCK, SDIO pins, TX/RX DMA, interrupt bindings, and an initial configuration. ```rust pub fn new_bidi, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, sdio: Peri<'d, impl MosiPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self ``` -------------------------------- ### SPI Configuration Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Config.html?search=std%3A%3Avec Details the trait implementations available for the SPI configuration structure, including Clone, Default, and Copy. ```APIDOC ## Trait Implementations for Config ### `impl Clone for Config` - **`fn clone(&self) -> Config`**: Returns a duplicate of the configuration. - **`fn clone_from(&mut self, source: &Self)`**: Performs copy-assignment from a source configuration. ### `impl Default for Config` - **`fn default() -> Self`**: Returns the default configuration settings. ### `impl Copy for Config` Indicates that the `Config` struct can be copied implicitly. ``` -------------------------------- ### Generic Trait Implementations (CloneToUninit, From, Into) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Phase.html?search=std%3A%3Avec Showcases blanket implementations for `CloneToUninit`, `From`, and `Into`. `CloneToUninit` (nightly-only) allows copying to uninitialized memory. `From` for `T` returns the argument unchanged, and `Into` leverages `From` for conversions. ```rust impl CloneToUninit for T { unsafe fn clone_to_uninit(&self, dest: *mut u8) { // ... implementation details ... } } impl From for T { fn from(t: T) -> T { t } } impl Into for T where U: From { fn into(self) -> U { U::from(self) } } ``` -------------------------------- ### Implement CloneToUninit for T in Rust (Nightly) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Phase.html?search=u32+-%3E+bool An experimental, nightly-only API that performs copy-assignment from a `Clone` type to an uninitialized memory location. Requires `T: Clone`. ```rust unsafe impl CloneToUninit for T { unsafe fn clone_to_uninit(&self, dest: *mut u8); } ``` -------------------------------- ### Blanket Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/mode/struct.Slave.html Details various blanket implementations provided for generic types, including Any, Borrow, BorrowMut, From, Into, TryFrom, and TryInto. ```APIDOC ## Blanket Implementations ### impl Any for T where T: 'static + ?Sized, #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more ### impl Borrow for T where T: ?Sized, #### fn borrow(&self) -> &T Immutably borrows from an owned value. Read more ### impl BorrowMut for T where T: ?Sized, #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. Read more ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Into for T where U: From, #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### impl TryFrom for T where U: Into, #### type Error = Infallible The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T where U: TryFrom, #### type Error = >::Error The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### WsPin Trait Documentation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.WsPin.html?search= Documentation for the `WsPin` trait, including its required methods and dyn compatibility. ```APIDOC ## Trait: WsPin ### Description This trait defines the interface for pins that can be used with specific peripherals, such as SPI1. ### Required Methods #### `fn af_num(&self) -> u8` ##### Description Get the AF (Alternate Function) number needed to use this pin as a WsPin for a peripheral. ##### Method `&self` (immutable borrow) ##### Return Type `u8` - The AF number. ### Dyn Compatibility This trait is **not** dyn compatible. In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe. ``` -------------------------------- ### MosiPin Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.MosiPin.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Lists the available implementations of the MosiPin trait for specific pins and SPI peripherals. ```APIDOC ## MosiPin Implementations ### `impl MosiPin for PA2` **Description:** Implements `MosiPin` for pin PA2 when used with SPI1. Available on non-`afio` configurations only. ### `impl MosiPin for PA7` **Description:** Implements `MosiPin` for pin PA7 when used with SPI1. Available on non-`afio` configurations only. ### `impl MosiPin for PA12` **Description:** Implements `MosiPin` for pin PA12 when used with SPI1. Available on non-`afio` configurations only. ### `impl MosiPin for PB5` **Description:** Implements `MosiPin` for pin PB5 when used with SPI1. Available on non-`afio` configurations only. ### `impl MosiPin for PB6` **Description:** Implements `MosiPin` for pin PB6 when used with SPI1. Available on non-`afio` configurations only. ### `impl MosiPin for PA4` **Description:** Implements `MosiPin` for pin PA4 when used with SPI2. Available on non-`afio` configurations only. ### `impl MosiPin for PA10` **Description:** Implements `MosiPin` for pin PA10 when used with SPI2. Available on non-`afio` configurations only. ### `impl MosiPin for PB7` **Description:** Implements `MosiPin` for pin PB7 when used with SPI2. Available on non-`afio` configurations only. ``` -------------------------------- ### Generic Blanket Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/enum.Phase.html?search=std%3A%3Avec Details generic blanket implementations that apply to various types, including `Any`, `Borrow`, `BorrowMut`, `CloneToUninit`, `From`, `Into`, `TryFrom`, and `TryInto`. ```APIDOC ## Generic Blanket Implementations ### `impl Any for T` #### `fn type_id(&self) -> TypeId` **Description**: Gets the `TypeId` of `self`. ### `impl Borrow for T` #### `fn borrow(&self) -> &T` **Description**: Immutably borrows from an owned value. ### `impl BorrowMut for T` #### `fn borrow_mut(&mut self) -> &mut T` **Description**: Mutably borrows from an owned value. ### `impl CloneToUninit for T` #### `unsafe fn clone_to_uninit(&self, dest: *mut u8)` **Description**: Performs copy-assignment from `self` to `dest`. (Nightly-only experimental API) ### `impl From for T` #### `fn from(t: T) -> T` **Description**: Returns the argument unchanged. ### `impl Into for T where U: From` #### `fn into(self) -> U` **Description**: Calls `U::from(self)`. ### `impl TryFrom for T where U: Into` #### Associated type `Error = Infallible` **Description**: The type returned in the event of a conversion error. #### `fn try_from(value: U) -> Result>::Error>` **Description**: Performs the conversion. ### `impl TryInto for T where U: TryFrom` #### Associated type `Error = >::Error` **Description**: The type returned in the event of a conversion error. #### `fn try_into(self) -> Result>::Error>` **Description**: Performs the conversion. ``` -------------------------------- ### Create Blocking SPI Master Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Initializes a new blocking SPI master driver. Requires peripheral instances for SPI, SCK, MOSI, MISO pins, and an initial configuration. ```rust pub fn new_blocking( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, mosi: Peri<'d, impl MosiPin>, miso: Peri<'d, impl MisoPin>, config: Config, ) -> Self ``` -------------------------------- ### Create Async SPI RX-Only Master Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search= Initializes a new asynchronous SPI master driver in RX-only mode. This configuration only utilizes the MISO pin and requires TX/RX DMA and interrupt bindings. ```rust pub fn new_rxonly, D2: RxDma>( peri: Peri<'d, T>, sck: Peri<'d, impl SckPin>, miso: Peri<'d, impl MisoPin>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, _irq: impl Binding> + Binding> + 'd, config: Config, ) -> Self ``` -------------------------------- ### SPI Driver Initialization Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Spi.html?search=u32+-%3E+bool Creates a new SPI driver instance. Supports TX-only mode without a SCK pin, which can be useful for bit-banging non-SPI protocols. ```APIDOC ## `new_txonly_nosck` ### Description Creates a new SPI driver, in TX-only mode, without SCK pin. This can be useful for bit-banging non-SPI protocols. ### Method `pub fn new_txonly_nosck>( peri: Peri<'d, T>, mosi: Peri<'d, impl MosiPin>, tx_dma: Peri<'d, D1>, _irq: impl Binding> + 'd, config: Config, ) -> Self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust // Example usage (conceptual, actual implementation depends on context) let spi_driver = Spi::new_txonly_nosck(peri, mosi, tx_dma, irq, config); ``` ### Response #### Success Response (Self) Returns a new `Spi` instance configured for TX-only operation without SCK. #### Response Example ```rust // Spi instance ``` ``` -------------------------------- ### Standard Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/mode/struct.Slave.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E This section lists the standard Rust trait implementations available for the `Slave` type, including `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, `TryFrom`, and `TryInto`. These traits provide fundamental functionalities for type manipulation, conversion, and introspection. ```APIDOC ## Standard Trait Implementations for Slave ### Description Provides implementations of common Rust traits for the `Slave` type, enabling various standard operations and interoperability. ### Method N/A (Trait Implementations) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Implemented Traits: #### `impl Any for T` - **Description**: Allows for runtime type identification. - **Methods**: `type_id(&self) -> TypeId` #### `impl Borrow for T` - **Description**: Enables immutable borrowing. - **Methods**: `borrow(&self) -> &T` #### `impl BorrowMut for T` - **Description**: Enables mutable borrowing. - **Methods**: `borrow_mut(&mut self) -> &mut T` #### `impl From for T` - **Description**: Allows conversion from `T` to `T`. - **Methods**: `from(t: T) -> T` #### `impl Into for T where U: From` - **Description**: Allows conversion from `T` to `U` if `U` implements `From`. - **Methods**: `into(self) -> U` #### `impl TryFrom for T where U: Into` - **Description**: Allows fallible conversion from `U` to `T`. - **Error Type**: `type Error = Infallible` - **Methods**: `try_from(value: U) -> Result>::Error>` #### `impl TryInto for T where U: TryFrom` - **Description**: Allows fallible conversion from `T` to `U`. - **Error Type**: `type Error = >::Error` - **Methods**: `try_into(self) -> Result>::Error>` ``` -------------------------------- ### Copy Implementation for SPI Config Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/struct.Config.html?search= Indicates that the SPI Config struct can be copied by value, allowing for simple and efficient duplication of configuration instances. ```rust impl Copy for Config {} ``` -------------------------------- ### MisoPin Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/spi/trait.MisoPin.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Lists the available implementations of the MisoPin trait for different SPI peripherals and microcontroller pins. ```APIDOC ## Implementations of MisoPin ### `impl MisoPin for PA6` Available on **non-`afio`** only. ### `impl MisoPin for PA11` Available on **non-`afio`** only. ### `impl MisoPin for PB4` Available on **non-`afio`** only. ### `impl MisoPin for PB6` Available on **non-`afio`** only. ### `impl MisoPin for PA3` Available on **non-`afio`** only. ### `impl MisoPin for PA8` Available on **non-`afio`** only. ### `impl MisoPin for PA9` Available on **non-`afio`** only. ### `impl MisoPin for PB2` Available on **non-`afio`** only. ### `impl MisoPin for PB6` Available on **non-`afio`** only. ```