Refactored GPIO module
- The GPIO module uses type-level programming now - Implementation heavily based on the ATSAMD GPIO HAL: https://docs.rs/atsamd-hal/0.13.0/atsamd_hal/gpio/v2/index.html - Changes to API, but no passing of peripheral references necessary anymore. All examples and tests updated accordingly
This commit is contained in:
30
src/gpio/mod.rs
Normal file
30
src/gpio/mod.rs
Normal file
@ -0,0 +1,30 @@
|
||||
//! # GPIO module
|
||||
//!
|
||||
//! 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).
|
||||
//!
|
||||
//! This API provides two different submodules, [`pin`] and [`dynpin`],
|
||||
//! representing two different ways to handle GPIO pins. The default, [`pin`],
|
||||
//! 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
|
||||
//! state of each pin at run-time.
|
||||
//!
|
||||
//! The type-level API is strongly preferred. By representing the state of each
|
||||
//! pin within the type system, the compiler can detect logic errors at
|
||||
//! compile-time. Furthermore, the type-level API has absolutely zero run-time
|
||||
//! cost.
|
||||
//!
|
||||
//! If needed, [`dynpin`] can be used to erase the type-level differences
|
||||
//! between pins. However, by doing so, pins must now be tracked at run-time,
|
||||
//! and each pin has a non-zero memory footprint.
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! - [Blinky example](https://github.com/robamu-org/va108xx-hal-rs/blob/main/examples/blinky.rs)
|
||||
pub mod dynpins;
|
||||
pub use dynpins::*;
|
||||
|
||||
pub mod pins;
|
||||
pub use pins::*;
|
||||
|
||||
mod reg;
|
Reference in New Issue
Block a user