smaller tweaks and updates
This commit is contained in:
parent
2fc9829961
commit
6c9d9f7dfa
@ -3,10 +3,10 @@
|
|||||||
//! The implementation of this GPIO module is heavily based on the
|
//! The implementation of this GPIO module is heavily based on the
|
||||||
//! [ATSAMD HAL implementation](https://docs.rs/atsamd-hal/0.13.0/atsamd_hal/gpio/v2/index.html).
|
//! [ATSAMD HAL implementation](https://docs.rs/atsamd-hal/0.13.0/atsamd_hal/gpio/v2/index.html).
|
||||||
//!
|
//!
|
||||||
//! This API provides two different submodules, [`pin`] and [`dynpin`],
|
//! This API provides two different submodules, [`pins`] and [`dynpins`],
|
||||||
//! representing two different ways to handle GPIO pins. The default, [`pin`],
|
//! representing two different ways to handle GPIO pins. The default, [`pins`],
|
||||||
//! is a type-level API that tracks the state of each pin at compile-time. The
|
//! is a type-level API that tracks the state of each pin at compile-time. The
|
||||||
//! alternative, [`dynpin`] is a type-erased, value-level API that tracks the
|
//! alternative, [`dynpins`] is a type-erased, value-level API that tracks the
|
||||||
//! state of each pin at run-time.
|
//! state of each pin at run-time.
|
||||||
//!
|
//!
|
||||||
//! The type-level API is strongly preferred. By representing the state of each
|
//! The type-level API is strongly preferred. By representing the state of each
|
||||||
@ -14,7 +14,7 @@
|
|||||||
//! compile-time. Furthermore, the type-level API has absolutely zero run-time
|
//! compile-time. Furthermore, the type-level API has absolutely zero run-time
|
||||||
//! cost.
|
//! cost.
|
||||||
//!
|
//!
|
||||||
//! If needed, [`dynpin`] can be used to erase the type-level differences
|
//! If needed, [`dynpins`] can be used to erase the type-level differences
|
||||||
//! between pins. However, by doing so, pins must now be tracked at run-time,
|
//! between pins. However, by doing so, pins must now be tracked at run-time,
|
||||||
//! and each pin has a non-zero memory footprint.
|
//! and each pin has a non-zero memory footprint.
|
||||||
//!
|
//!
|
||||||
|
@ -84,15 +84,8 @@
|
|||||||
//! This module also provides additional, type-level tools to work with GPIO
|
//! This module also provides additional, type-level tools to work with GPIO
|
||||||
//! pins.
|
//! pins.
|
||||||
//!
|
//!
|
||||||
//! The [`OptionalPinId`] and [`OptionalPin`] traits use the [`OptionalKind`]
|
//! The [`AnyPin`] trait defines an [`AnyKind`] type class
|
||||||
//! pattern to act as type-level versions of [`Option`] for `PinId` and `Pin`
|
|
||||||
//! respectively. And the [`AnyPin`] trait defines an [`AnyKind`] type class
|
|
||||||
//! for all `Pin` types.
|
//! for all `Pin` types.
|
||||||
//!
|
|
||||||
//! [type classes]: crate::typelevel#type-classes
|
|
||||||
//! [type-level enum]: crate::typelevel#type-level-enum
|
|
||||||
//! [`OptionalKind`]: crate::typelevel#optionalkind-trait-pattern
|
|
||||||
//! [`AnyKind`]: crate::typelevel#anykind-trait-pattern
|
|
||||||
|
|
||||||
use super::dynpins::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
use super::dynpins::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
||||||
use super::reg::RegisterInterface;
|
use super::reg::RegisterInterface;
|
||||||
@ -115,14 +108,12 @@ pub enum PinState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// GPIO error type
|
/// GPIO error type
|
||||||
///
|
|
||||||
/// [`DynPin`]s are not tracked and verified at compile-time, so run-time
|
|
||||||
/// operations are fallible. This `enum` represents the corresponding errors.
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum PinError {
|
pub enum PinError {
|
||||||
/// 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.
|
||||||
|
/// [`DynPin`](crate::gpio::DynPin)s are not tracked and verified at compile-time, so run-time
|
||||||
|
/// operations are fallible.
|
||||||
InvalidPinType,
|
InvalidPinType,
|
||||||
InputDisabledForOutput,
|
|
||||||
IsMasked,
|
IsMasked,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user