From f4f378ba4f7e9f106a985ce6ebee1eca2ed7e777 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 25 Jun 2024 10:47:33 +0200 Subject: [PATCH] doc fixes and improvements --- va108xx-hal/src/gpio/pins.rs | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/va108xx-hal/src/gpio/pins.rs b/va108xx-hal/src/gpio/pins.rs index 7ae32f9..dda846b 100644 --- a/va108xx-hal/src/gpio/pins.rs +++ b/va108xx-hal/src/gpio/pins.rs @@ -29,11 +29,11 @@ //! } //! ``` //! -//! A `PinId` identifies a pin by it's group (A, B, C or D) and pin number. Each -//! `PinId` instance is named according to its datasheet identifier, e.g. +//! A [PinId] identifies a pin by it's group (A or B) and pin number. Each +//! [PinId] instance is named according to its datasheet identifier, e.g. //! [PA2]. //! -//! A `PinMode` represents the various pin modes. The available `PinMode` +//! A [PinMode] represents the various pin modes. The available [PinMode] //! variants are [`Input`], [`Output`] and [`Alternate`], each with its own //! corresponding configurations. //! @@ -51,18 +51,18 @@ //! //! ``` //! let mut peripherals = Peripherals::take().unwrap(); -//! let pins = Pins::new(peripherals.PORT); +//! let pinsa = PinsA::new(peripherals.PORT); //! ``` //! //! Pins can be converted between modes using several different methods. //! -//! ``` +//! ```no_run //! // Use one of the literal function names -//! let pa27 = pins.pa27.into_floating_input(); +//! let pa0 = pinsa.pa0.into_floating_input(); //! // Use a generic method and one of the `PinMode` variant types -//! let pa27 = pins.pa27.into_mode::(); +//! let pa0 = pinsa.pa0.into_mode::(); //! // Specify the target type and use `From`/`Into` -//! let pa27: Pin = pins.pa27.into(); +//! let pa0: Pin = pinsa.pa27.into(); //! ``` //! //! # Embedded HAL traits @@ -70,18 +70,6 @@ //! This module implements all of the embedded HAL GPIO traits for each [`Pin`] //! in the corresponding [`PinMode`]s, namely: [`InputPin`], [`OutputPin`], //! and [`StatefulOutputPin`]. -//! -//! For example, you can control the logic level of an `OutputPin` like so -//! -//! ``` -//! use atsamd_hal::pac::Peripherals; -//! use atsamd_hal::gpio::Pins; -//! use crate::ehal_02::digital::v2::OutputPin; -//! -//! let mut peripherals = Peripherals::take().unwrap(); -//! let mut pins = Pins::new(peripherals.PORT); -//! pins.pa27.set_high(); -//! ``` use super::dynpins::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode}; use super::reg::RegisterInterface; use crate::{ -- 2.43.0