Add Debug and defmt::Format to the public types of rp2040_hal::gpio::dynpin (#431)

This commit is contained in:
Wilfried Chauveau 2022-08-25 05:54:26 +01:00 committed by GitHub
parent cd9570e7c4
commit 47d8f4fc21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,8 @@ use hal::digital::v2::{InputPin, OutputPin, StatefulOutputPin, ToggleableOutputP
//============================================================================== //==============================================================================
/// Value-level `enum` for disabled configurations /// Value-level `enum` for disabled configurations
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DynDisabled { pub enum DynDisabled {
Floating, Floating,
@ -97,7 +98,8 @@ pub enum DynDisabled {
} }
/// Value-level `enum` for input configurations /// Value-level `enum` for input configurations
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DynInput { pub enum DynInput {
Floating, Floating,
@ -107,7 +109,8 @@ pub enum DynInput {
} }
/// Value-level `enum` for output configurations /// Value-level `enum` for output configurations
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DynOutput { pub enum DynOutput {
PushPull, PushPull,
@ -115,7 +118,8 @@ pub enum DynOutput {
} }
/// Value-level `enum` for output configurations /// Value-level `enum` for output configurations
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DynFunction { pub enum DynFunction {
Spi, Spi,
@ -134,7 +138,8 @@ pub enum DynFunction {
//============================================================================== //==============================================================================
/// Value-level `enum` representing pin modes /// Value-level `enum` representing pin modes
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DynPinMode { pub enum DynPinMode {
Disabled(DynDisabled), Disabled(DynDisabled),
@ -210,20 +215,20 @@ dyn_function!(Spi, Xip, Uart, I2C, Pwm, Pio0, Pio1, Clock, UsbAux);
//============================================================================== //==============================================================================
/// Value-level `enum` for pin groups /// Value-level `enum` for pin groups
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)]
pub enum DynGroup { pub enum DynGroup {
/// .
Bank0, Bank0,
/// .
Qspi, Qspi,
} }
/// Value-level `struct` representing pin IDs /// Value-level `struct` representing pin IDs
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)]
pub struct DynPinId { pub struct DynPinId {
/// .
pub group: DynGroup, pub group: DynGroup,
/// .
pub num: u8, pub num: u8,
} }
@ -270,6 +275,7 @@ impl DynRegisters {
/// [`DynPin`]s are not tracked and verified at compile-time, so run-time /// [`DynPin`]s are not tracked and verified at compile-time, so run-time
/// operations are fallible. This `enum` represents the corresponding errors. /// operations are fallible. This `enum` represents the corresponding errors.
#[derive(Debug)] #[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error { pub enum Error {
/// The pin did not have the correct ID or mode for the requested operation /// The pin did not have the correct ID or mode for the requested operation
InvalidPinType, InvalidPinType,