### Adstp Enum Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.Adstp.html Enumeration for ADC trigger modes, defining possible states for ADC start triggers. ```APIDOC ## Adstp Enum This enum represents the trigger modes for ADC operations. ### Summary ```rust #[repr(u8)] pub enum Adstp { _RESERVED_0 = 0, STOP = 1, } ``` ### Variants #### `_RESERVED_0` * **Value**: `0` * **Description**: Reserved value, typically not used for standard operations. #### `STOP` * **Value**: `1` * **Description**: Indicates that the ADC should stop its current operation or be put into a stopped state. ``` -------------------------------- ### Generic Implementations: Any, Borrow, CloneToUninit (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.Align.html?search= Demonstrates blanket implementations for generic types. `Any` provides type information, `Borrow` allows immutable borrowing, `BorrowMut` allows mutable borrowing, and `CloneToUninit` (experimental) enables copying to uninitialized memory. ```rust fn type_id(&self) -> TypeId fn borrow(&self) -> &T fn borrow_mut(&mut self) -> &mut T unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Type Conversion Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Vcore.html Documentation for various type conversion traits implemented for generic types, including `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, `TryFrom`, and `TryInto`. ```APIDOC ## impl Any for T ### Description Provides a mechanism to get the `TypeId` of any type `T` that is `'static` and not `?Sized`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl Borrow for T ### Description Allows immutable borrowing of an owned value `T` as a reference `&T`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn borrow(&self) -> &T ### Description Immutably borrows from an owned value. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl BorrowMut for T ### Description Allows mutable borrowing of an owned value `T` as a mutable reference `&mut T`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn borrow_mut(&mut self) -> &mut T ### Description Mutably borrows from an owned value. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl From for T ### Description Provides a way to convert a value of type `T` into itself. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn from(t: T) -> T ### Description Returns the argument unchanged. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl Into for T ### Description Provides a way to convert a value of type `T` into a value of type `U`, provided that `U` implements `From`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn into(self) -> U ### Description Calls `U::from(self)`. The conversion behavior is determined by the `From for U` implementation. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl TryFrom for T ### Description Provides a fallible way to convert a value of type `U` into a value of type `T`, where `U` implements `Into`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### type Error = Infallible ### Description The type returned in the event of a conversion error. `Infallible` indicates that this conversion cannot fail. ### Method N/A (Associated type) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion from `U` to `T`. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## impl TryInto for T ### Description Provides a fallible way to convert a value of type `T` into a value of type `U`, where `U` implements `TryFrom`. ### Method N/A (Trait Implementation) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### type Error = >::Error ### Description The type returned in the event of a conversion error. ### Method N/A (Associated type) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion from `T` to `U`. ### Method N/A (Associated function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### RegularTrigger Trait Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/trait.RegularTrigger.html?search= Documentation for the RegularTrigger trait, which defines a method to get a signal number for triggers. ```APIDOC ## Trait: RegularTrigger ### Description This trait represents a regular trigger mechanism, often used in embedded systems for peripherals like ADCs. It provides a way to obtain a signal number required for configuring these triggers. ### Required Methods #### `fn signal(&self) -> u8` * **Description**: Returns the signal number associated with this trigger. This number is used to configure the trigger in hardware. Note that in some chip documentation, this might be referred to as a "channel" or "request number". * **Return Type**: `u8` - The signal number. ### Implementors * **`CONTINUOUS`**: This type implements the `RegularTrigger` trait, indicating it can be used as a regular trigger source. ``` -------------------------------- ### Generic Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Temperature.html?search=std%3A%3Avec Documentation for common generic trait implementations such as `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, `TryFrom`, and `TryInto`. ```APIDOC ## Generic Trait Implementations ### Description This section outlines several standard Rust trait implementations that are generically applied. ### Implemented Traits - **`Any`**: Provides a `type_id` method to get the `TypeId` of an object. - **`Borrow`**: Provides a `borrow` method for immutable borrowing. - **`BorrowMut`**: Provides a `borrow_mut` method for mutable borrowing. - **`From`**: Provides a `from` method for converting a type into itself. - **`Into`**: Provides an `into` method for converting a type into another type `U` if `U` implements `From`. - **`TryFrom`**: Provides a `try_from` method for fallible conversions from `U` to `T`. The error type is `Infallible`. - **`TryInto`**: Provides a `try_into` method for fallible conversions from `T` to `U`. The error type is determined by `U`'s `TryFrom` implementation. ``` -------------------------------- ### Type Conversion Utilities Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Temperature.html?search= Offers utility functions for type conversions, including getting the `TypeId` of a type and performing conversions between types. ```APIDOC ## GET /websites/embassy_dev_embassy-stm32_git_stm32c092kb_adc/type_id ### Description Gets the `TypeId` of the given type. ### Method GET ### Endpoint /websites/embassy_dev_embassy-stm32_git_stm32c092kb_adc/type_id ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body needed for this operation." } ``` ### Response #### Success Response (200) - **TypeId** (object) - The unique identifier for the type. #### Response Example ```json { "example": "{ \"id\": \"some_unique_id\" }" } ``` ``` ```APIDOC ## POST /websites/embassy_dev_embassy-stm32_git_stm32c092kb_adc/convert ### Description Performs type conversions using `From`, `Into`, `TryFrom`, and `TryInto` traits. ### Method POST ### Endpoint /websites/embassy_dev_embassy-stm32_git_stm32c092kb_adc/convert ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **source_type** (string) - The type of the value to convert. - **target_type** (string) - The desired type after conversion. - **value** (any) - The value to be converted. ### Request Example ```json { "source_type": "u32", "target_type": "bool", "value": 10 } ``` ### Response #### Success Response (200) - **converted_value** (any) - The value after successful conversion. #### Response Example ```json { "example": "true" } ``` ``` -------------------------------- ### From and Into Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.VrefInt.html?search= Documentation for the generic implementations of From and Into traits for type conversions. ```APIDOC ## From and Into Implementations ### Description These blanket implementations provide the `From` and `Into` traits for generic type conversions. ### `impl From for T` #### `fn from(t: T) -> T` Returns the argument unchanged. This is a trivial conversion where a type is converted into itself. ### `impl Into for T` where `U: From` #### `fn into(self) -> U` Calls `U::from(self)`. This method performs a conversion from type `T` to type `U`, provided that `U` implements `From`. ``` -------------------------------- ### Get TypeId of a Value Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Dac.html?search= The `type_id` function, part of the `Any` trait implementation, returns the `TypeId` of the object it's called on. This allows for runtime identification of types. ```rust #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more Source ``` -------------------------------- ### Initialize STM32 ADC Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Adc.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new ADC driver instance for a given peripheral and resolution. This is the first step to using the ADC. ```rust impl<'d, T: Instance> Adc<'d, T> pub fn new(adc: Peri<'d, T>, resolution: Resolution) -> Self ``` -------------------------------- ### Get Type ID - Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.AnyAdcChannel.html?search=std%3A%3Avec Implements the `type_id` method for any type `T` that is `'static + ?Sized`, as part of the blanket `Any` trait implementation. This method returns the `TypeId` of the instance. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get Hardware Channel Number - Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.AnyAdcChannel.html?search=std%3A%3Avec Retrieves the hardware channel number associated with an `AnyAdcChannel`. This method is part of the `AnyAdcChannel` implementation and returns a `u8` representing the channel. ```rust pub fn get_hw_channel(&self) -> u8 ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.VrefInt.html?search= Documentation for the generic implementations of TryFrom and TryInto traits for fallible type conversions. ```APIDOC ## TryFrom and TryInto Implementations ### Description These blanket implementations provide the `TryFrom` and `TryInto` traits for fallible generic type conversions. ### `impl TryFrom for T` where `U: Into` #### type Error = Infallible The type returned in the event of a conversion error. `Infallible` indicates that this conversion will never fail. #### `fn try_from(value: U) -> Result>::Error>` Performs the conversion from type `U` to type `T`. Since the error type is `Infallible`, this operation is guaranteed to succeed. ### `impl TryInto for T` where `U: TryFrom` #### type Error = >::Error The type returned in the event of a conversion error. This mirrors the error type of the corresponding `TryFrom` implementation. #### `fn try_into(self) -> Result>::Error>` Performs the conversion from type `T` to type `U` using the `TryFrom` implementation. This operation may fail, returning a `Result`. ``` -------------------------------- ### Get TypeId using Any Trait - Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.AnyAdcChannel.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the use of the `Any` trait's `type_id` method. This method returns the `TypeId` of the underlying type, which can be useful for runtime type introspection. ```rust fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ``` -------------------------------- ### Rust SampleTime Enum Blanket Implementations (Any, Borrow, From, Into, TryFrom, TryInto) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.SampleTime.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Illustrates blanket implementations for the SampleTime enum, providing generic functionality such as type identification (Any), borrowing, and various conversion utilities (From, Into, TryFrom, TryInto). ```rust impl Any for T impl Borrow for T impl From for T impl Into for T impl TryFrom for T impl TryInto for T ``` -------------------------------- ### Generic Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Vbat.html Details blanket implementations for common Rust traits like Any, Borrow, BorrowMut, From, Into, TryFrom, and TryInto, applicable to various types. ```APIDOC ## Generic Trait Implementations ### Description This section covers blanket implementations for several fundamental Rust traits, demonstrating their applicability across a wide range of types, including those related to the STM32C092KBC ADC peripheral. ### 1. `impl Any for T` - **Description**: Provides the `type_id` method for any type `T` that is `'static` and not `?Sized`. - **Method**: `type_id(&self) -> TypeId` - Gets the `TypeId` of `self`. ### 2. `impl Borrow for T` - **Description**: Allows immutable borrowing of a value of type `T`. - **Method**: `borrow(&self) -> &T` - Immutably borrows from an owned value. ### 3. `impl BorrowMut for T` - **Description**: Allows mutable borrowing of a value of type `T`. - **Method**: `borrow_mut(&mut self) -> &mut T` - Mutably borrows from an owned value. ### 4. `impl From for T` - **Description**: Provides a way to convert a value of type `T` into itself. - **Method**: `from(t: T) -> T` - Returns the argument unchanged. ### 5. `impl Into for T where U: From` - **Description**: Provides a way to convert a value of type `T` into type `U`, provided `U` implements `From`. - **Method**: `into(self) -> U` - Calls `U::from(self)`. ### 6. `impl TryFrom for T where U: Into` - **Description**: Provides a fallible way to convert a value of type `U` into type `T`, provided `U` implements `Into`. - **Associated Type**: `Error = Infallible` - The type returned in the event of a conversion error (in this case, `Infallible` indicates no errors are possible). - **Method**: `try_from(value: U) -> Result>::Error>` - Performs the conversion. ### 7. `impl TryInto for T where U: TryFrom` - **Description**: Provides a fallible way to convert a value of type `T` into type `U`, provided `U` implements `TryFrom`. - **Associated Type**: `Error = >::Error` - The type returned in the event of a conversion error. - **Method**: `try_into(self) -> Result>::Error>` - Performs the conversion. ``` -------------------------------- ### Implement Any Trait for Type Identification Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Vbat.html?search= This code implements the `Any` trait, which provides a way to get the `TypeId` of a given type. This is a fundamental trait for runtime type introspection in Rust. ```rust impl Any for T where T: 'static + ?Sized, Source #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. Read more Source ``` -------------------------------- ### Generic Type Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Vbat.html?search=std%3A%3Avec Provides documentation for blanket implementations of common Rust traits like `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, and `TryFrom`/`TryInto`. ```APIDOC ## impl Any for T ### Description Provides access to the `TypeId` of a type. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **TypeId** - The unique identifier for the type. #### Response Example ```json { "example": "TypeId::of::()" } ``` ## impl Borrow for T ### Description Provides immutable access to a value. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### fn borrow(&self) -> &T ### Description Immutably borrows from an owned value. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **&T** - An immutable reference to the value. #### Response Example ```json { "example": "&value" } ``` ## impl BorrowMut for T ### Description Provides mutable access to a value. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### fn borrow_mut(&mut self) -> &mut T ### Description Mutably borrows from an owned value. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **&mut T** - A mutable reference to the value. #### Response Example ```json { "example": "&mut value" } ``` ## impl From for T ### Description Provides a way to create a value from itself. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### fn from(t: T) -> T ### Description Returns the argument unchanged. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **T** - The input value. #### Response Example ```json { "example": "value" } ``` ## impl Into for T ### Description Provides a way to convert a value into another type. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### fn into(self) -> U ### Description Calls `U::from(self)`. This conversion is whatever the implementation of `From for U` chooses to do. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **U** - The converted value. #### Response Example ```json { "example": "converted_value" } ``` ## impl TryFrom for T ### Description Provides a fallible way to convert a value from one type to another. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### type Error = Infallible ### Description The type returned in the event of a conversion error. ### Method `type` ### Endpoint N/A (Associated Type within Trait Implementation) ### Parameters None ### Response N/A #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **Result** - Ok(T) on success, Err(Error) on failure. #### Response Example ```json { "example": "Ok(converted_value)" } ``` ## impl TryInto for T ### Description Provides a fallible way to convert a value into another type. ### Method `impl` ### Endpoint N/A (Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body for trait implementation" } ``` #### type Error = >::Error ### Description The type returned in the event of a conversion error. ### Method `type` ### Endpoint N/A (Associated Type within Trait Implementation) ### Parameters None ### Response N/A #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion. ### Method `fn` ### Endpoint N/A (Method within Trait Implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body" } ``` ### Response #### Success Response (200) - **Result** - Ok(U) on success, Err(Error) on failure. #### Response Example ```json { "example": "Ok(converted_value)" } ``` ``` -------------------------------- ### Implement Any trait for generic types in Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.VrefInt.html?search= This blanket implementation allows any type T that is 'static and not dynamically sized (?Sized) to implement the Any trait. It provides a method to get the TypeId of the instance. ```Rust impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId { // Implementation details omitted } } ``` -------------------------------- ### Get RegularTrigger Signal Number (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.CONTINUOUS.html?search=std%3A%3Avec Retrieves the signal number required to use the `CONTINUOUS` trigger mode. This number corresponds to the 'channel' or 'request number' in STMicroelectronics terminology, which can differ from their 'stream' and 'channel' naming conventions. ```rust impl RegularTrigger for CONTINUOUS { fn signal(&self) -> u8 { // Implementation details to return the signal number } } ``` -------------------------------- ### Generic Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.AnyAdcChannel.html Demonstrates blanket implementations for common traits like `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, `TryFrom`, and `TryInto` for generic types, including `AnyAdcChannel`. ```APIDOC ## GET /generic/type_id ### Description Gets the `TypeId` of the current instance. This is available through the blanket `Any` trait implementation. ### Method GET ### Endpoint `/generic/type_id` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```http GET /generic/type_id HTTP/1.1 Host: api.example.com Accept: application/json ``` ### Response #### Success Response (200) - **type_id** (TypeId) - The unique identifier for the type of the instance. #### Response Example ```json { "type_id": "" } ``` ## POST /generic/borrow ### Description Immutably borrows from an owned value. This is part of the `Borrow` trait implementation. ### Method POST ### Endpoint `/generic/borrow` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **owned_value** (T) - The owned value to borrow from. ### Request Example ```http POST /generic/borrow HTTP/1.1 Host: api.example.com Content-Type: application/json { "owned_value": "" } ``` ### Response #### Success Response (200) - **borrowed_value** (&T) - An immutable reference to the borrowed value. #### Response Example ```json { "borrowed_value": "" } ``` ## POST /generic/borrow_mut ### Description Mutably borrows from an owned value. This is part of the `BorrowMut` trait implementation. ### Method POST ### Endpoint `/generic/borrow_mut` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **owned_value** (T) - The owned value to borrow from. ### Request Example ```http POST /generic/borrow_mut HTTP/1.1 Host: api.example.com Content-Type: application/json { "owned_value": "" } ``` ### Response #### Success Response (200) - **borrowed_value** (&mut T) - A mutable reference to the borrowed value. #### Response Example ```json { "borrowed_value": "" } ``` ## POST /generic/from ### Description Converts the given value into the target type. This is part of the `From` trait implementation. ### Method POST ### Endpoint `/generic/from` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **value** (T) - The value to convert. ### Request Example ```http POST /generic/from HTTP/1.1 Host: api.example.com Content-Type: application/json { "value": "" } ``` ### Response #### Success Response (200) - **converted_value** (T) - The converted value. #### Response Example ```json { "converted_value": "" } ``` ## POST /generic/into ### Description Calls `U::from(self)` to perform the conversion. This is part of the `Into` trait implementation. ### Method POST ### Endpoint `/generic/into` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **self** (T) - The value to convert. ### Request Example ```http POST /generic/into HTTP/1.1 Host: api.example.com Content-Type: application/json { "self": "" } ``` ### Response #### Success Response (200) - **converted_value** (U) - The converted value. #### Response Example ```json { "converted_value": "" } ``` ## POST /generic/try_from ### Description Performs the conversion from `U` to `T`. This is part of the `TryFrom` trait implementation. ### Method POST ### Endpoint `/generic/try_from` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **value** (U) - The value to attempt conversion from. ### Request Example ```http POST /generic/try_from HTTP/1.1 Host: api.example.com Content-Type: application/json { "value": "" } ``` ### Response #### Success Response (200) - **result** (Result) - The result of the conversion attempt. #### Response Example ```json { "result": { "Ok": "" } } ``` ## POST /generic/try_into ### Description Performs the conversion from `T` to `U`. This is part of the `TryInto` trait implementation. ### Method POST ### Endpoint `/generic/try_into` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **self** (T) - The value to attempt conversion into. ### Request Example ```http POST /generic/try_into HTTP/1.1 Host: api.example.com Content-Type: application/json { "self": "" } ``` ### Response #### Success Response (200) - **result** (Result) - The result of the conversion attempt. #### Response Example ```json { "result": { "Ok": "" } } ``` ``` -------------------------------- ### ADC Initialization and Internal Channel Access Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Adc.html Provides methods for creating a new ADC driver instance and enabling the reading of internal voltage reference and temperature sensors. ```APIDOC ## impl<'d, T: Instance> Adc<'d, T> ### Description Implementation block for the ADC driver. ### Methods #### `new(adc: Peri<'d, T>, resolution: Resolution) -> Self` ##### Description Create a new ADC driver. ##### Method `new` #### `enable_vrefint(&self) -> VrefInt` ##### Description Enable reading the voltage reference internal channel. ##### Method `enable_vrefint` #### `enable_temperature(&self) -> Temperature` ##### Description Enable reading the temperature internal channel. ##### Method `enable_temperature` ``` -------------------------------- ### Get ADC Trigger Signal Number (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.CONTINUOUS.html Retrieves the signal number required for using a specific trigger as a RegularTrigger. This number corresponds to the 'channel' in some STM32 chips, while 'streams' are referred to as 'channels' in embassy-stm32. ```rust impl RegularTrigger for CONTINUOUS { fn signal(&self) -> u8 } ``` -------------------------------- ### Get Signal Number for CONTINUOUS Trigger (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.CONTINUOUS.html?search=u32+-%3E+bool Retrieves the signal number required to use the `CONTINUOUS` trigger as a `RegularTrigger`. Note that STMicroelectronics uses 'channel' and 'stream' differently; `embassy-stm32` consistently uses 'channel' and 'request number'. ```rust impl RegularTrigger for CONTINUOUS { fn signal(&self) -> u8 { // Implementation details to get the signal number } } ``` -------------------------------- ### Initialize STM32 ADC Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Adc.html?search=u32+-%3E+bool Creates a new ADC driver instance for a given STM32 microcontroller peripheral and resolution. This is the first step to using the ADC peripheral. ```rust impl<'d, T: Instance> Adc<'d, T> /// Create a new ADC driver. pub fn new(adc: Peri<'d, T>, resolution: Resolution) -> Self ``` -------------------------------- ### Borrow and BorrowMut Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.VrefInt.html?search= Documentation for the generic implementations of Borrow and BorrowMut traits. ```APIDOC ## Borrow and BorrowMut Implementations ### Description These blanket implementations provide the `Borrow` and `BorrowMut` traits for any type `T`. ### `impl Borrow for T` #### `fn borrow(&self) -> &T` Immutably borrows from an owned value. Returns a reference to the value. ### `impl BorrowMut for T` #### `fn borrow_mut(&mut self) -> &mut T` Mutably borrows from an owned value. Returns a mutable reference to the value. ``` -------------------------------- ### Get CONTINUOUS Trigger Signal (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.CONTINUOUS.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the signal number required to use the CONTINUOUS trigger. Note that STMicroelectronics sometimes refers to this as 'channel' and their 'channels' as 'streams'. The embassy-stm32 crate consistently uses 'channel' and 'request number'. ```rust impl RegularTrigger for CONTINUOUS { fn signal(&self) -> u8 { // Implementation details for getting the signal number } } ``` -------------------------------- ### ADC Initialization and Internal Channel Configuration Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Adc.html?search= Provides methods to create a new ADC driver instance and enable the reading of internal voltage reference and temperature sensors. ```APIDOC ## ADC Driver Initialization ### Description Creates a new ADC driver instance with a specified resolution. ### Method `new` ### Parameters - **adc** (Peri<'d, T>) - Required - The ADC peripheral instance. - **resolution** (Resolution) - Required - The desired ADC resolution. --- ## Enable Internal Channels ### Description Enables the reading of internal ADC channels. ### Method `enable_vrefint` ### Description Enables reading the voltage reference internal channel. ### Return Value VrefInt - An object representing the voltage reference internal channel. --- ### Method `enable_temperature` ### Description Enables reading the temperature internal channel. ### Return Value Temperature - An object representing the temperature internal channel. ``` -------------------------------- ### Scandir Enum: Bit Manipulation and Conversions (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.Scandir.html?search= Provides methods for converting between a u8 representation and the Scandir enum, likely for hardware register manipulation. It includes functions to get the bit representation and to create a Scandir value from bits. ```rust pub const fn from_bits(val: u8) -> Scandir pub const fn to_bits(self) -> u8 impl From for Scandir fn from(val: u8) -> Scandir ``` -------------------------------- ### Get DMA Request Number for RxDma (Rust) Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/trait.RxDma.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides the 'request' method within the RxDma trait. This method returns the DMA request number necessary for configuring the channel for receive operations. Note that STMicroelectronics uses 'channel' and 'stream' differently than this library. ```rust fn request(&self) -> Request; ``` -------------------------------- ### Initialize New ADC Driver Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Adc.html Creates a new instance of the ADC driver. It requires the peripheral instance and the desired resolution. This function is part of the Adc driver implementation. ```rust pub fn new(adc: Peri<'d, T>, resolution: Resolution) -> Self ``` -------------------------------- ### Rust: Get Max ADC Count from Resolution Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/fn.resolution_to_max_count.html?search= The `resolution_to_max_count` function in Rust calculates the maximum possible reading value for a given ADC resolution. It computes this value using the formula `2**n - 1`, where `n` is the resolution. This function is useful for understanding the range of ADC measurements. ```rust pub const fn resolution_to_max_count(res: Resolution) -> u32 { // Implementation would go here, likely involving bit shifts or pow function // For example: // (1 << res) - 1 // Or if Resolution is a u32 directly: // (1 << res) - 1 unimplemented!("ADC resolution to max count conversion not implemented") } ``` -------------------------------- ### Standard Rust Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.VrefInt.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E This section covers common Rust trait implementations provided for generic types, including `Any`, `Borrow`, `BorrowMut`, `From`, `Into`, `TryFrom`, and `TryInto`. ```APIDOC ## Standard Rust Trait Implementations ### `impl Any for T` Provides access to the `TypeId` of a type `T`. #### `fn type_id(&self) -> TypeId` Gets the `TypeId` of `self`. ### `impl Borrow for T` Allows immutable borrowing of a value. #### `fn borrow(&self) -> &T` Immutably borrows from an owned value. ### `impl BorrowMut for T` Allows mutable borrowing of a value. #### `fn borrow_mut(&mut self) -> &mut T` Mutably borrows from an owned value. ### `impl From for T` Allows conversion from a type to itself. #### `fn from(t: T) -> T` Returns the argument unchanged. ### `impl Into for T` Allows conversion into another type `U` if `U` implements `From`. #### `fn into(self) -> U` Calls `U::from(self)`. ### `impl TryFrom for T` Allows fallible conversion from type `U` to type `T`. #### `type Error = Infallible` The type returned in the event of a conversion error (in this case, the conversion is infallible). #### `fn try_from(value: U) -> Result>::Error>` Performs the conversion. ### `impl TryInto for T` Allows fallible conversion from type `T` to type `U`. #### `type Error = >::Error` The type returned in the event of a conversion error. #### `fn try_into(self) -> Result>::Error>` Performs the conversion. ``` -------------------------------- ### Generic Trait Implementations in Rust Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.Ckmode.html?search= Demonstrates various blanket implementations for generic types in Rust. These include implementations for Any, Borrow, BorrowMut, CloneToUninit, From, Into, TryFrom, and TryInto, providing common functionalities across different types. ```rust impl Any for T where T: 'static + ?Sized { /// Gets the `TypeId` of `self`. fn type_id(&self) -> TypeId; } impl Borrow for T where T: ?Sized { /// Immutably borrows from an owned value. fn borrow(&self) -> &T; } impl BorrowMut for T where T: ?Sized { /// Mutably borrows from an owned value. fn borrow_mut(&mut self) -> &mut T; } impl CloneToUninit for T where T: Clone { /// Performs copy-assignment from `self` to `dest`. unsafe fn clone_to_uninit(&self, dest: *mut u8); } impl From for T { /// Returns the argument unchanged. fn from(t: T) -> T; } impl Into for T where U: From { /// Calls `U::from(self)`. fn into(self) -> U; } impl TryFrom for T where U: Into { type Error = Infallible; /// Performs the conversion. fn try_from(value: U) -> Result>::Error>; } impl TryInto for T where U: TryFrom { type Error = >::Error; /// Performs the conversion. fn try_into(self) -> Result>::Error>; } ``` -------------------------------- ### Generic Trait Implementations Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/vals/enum.Dmacfg.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates blanket implementations of common Rust traits for generic types, showcasing flexibility and interoperability within the Rust ecosystem. ```rust // Blanket implementation for Any trait impl Any for T where T: 'static + ?Sized { fn type_id(&self) -> TypeId { // Gets the `TypeId` of `self`. // Implementation details... } } // Blanket implementation for Borrow trait impl Borrow for T where T: ?Sized { fn borrow(&self) -> &T { // Immutably borrows from an owned value. // Implementation details... } } // Blanket implementation for BorrowMut trait impl BorrowMut for T where T: ?Sized { fn borrow_mut(&mut self) -> &mut T { // Mutably borrows from an owned value. // Implementation details... } } // Blanket implementation for CloneToUninit trait (nightly-only) impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) { // Performs copy-assignment from `self` to `dest`. // Implementation details... } } // Blanket implementation for From for T trait impl From for T { fn from(t: T) -> T { // Returns the argument unchanged. // Implementation details... } } // Blanket implementation for Into for T trait impl Into for T where U: From { fn into(self) -> U { // Calls `U::from(self)`. // Implementation details... } } // Blanket implementation for TryFrom for T trait impl TryFrom for T where U: Into { type Error = Infallible; fn try_from(value: U) -> Result>::Error> { // Performs the conversion. // Implementation details... } } // Blanket implementation for TryInto for T trait impl TryInto for T where U: TryFrom { type Error = >::Error; fn try_into(self) -> Result>::Error> { // Performs the conversion. // Implementation details... } } ``` -------------------------------- ### Any Trait Implementation Source: https://docs.embassy.dev/embassy-stm32/git/stm32c092kb/adc/struct.Vcore.html?search= Documentation for the blanket implementation of the `Any` trait for generic types `T`. ```APIDOC ## impl Any for T ### Description Blanket implementation of the `Any` trait. ### Where Clause - `T`: Must be `'static + ?Sized`. ### Associated Functions #### fn type_id(&self) -> TypeId - **Description**: Gets the `TypeId` of `self`. - **Return Type**: `TypeId` ```