Skip to content

Commit

Permalink
Update embedded-hal documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
golemparts committed Jan 15, 2024
1 parent 6486f80 commit cc9dc58
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 70 deletions.
56 changes: 16 additions & 40 deletions src/gpio/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,9 @@ macro_rules! impl_eq {
/// various `into_` methods available on `Pin` configures the appropriate mode, and
/// provides access to additional methods relevant to the selected pin mode.
///
/// The `unproven` `embedded-hal` [`digital::InputPin`] trait implementation for `Pin` can be enabled
/// by specifying the optional `hal-unproven` feature in the dependency declaration for
/// the `rppal` crate.
/// The `embedded-hal` trait implementations for `Pin` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [`digital::InputPin`]: ../../embedded_hal/digital/trait.InputPin.html
/// [`Gpio::get`]: struct.Gpio.html#method.get
/// [`InputPin`]: struct.InputPin.html
/// [`OutputPin`]: struct.OutputPin.html
Expand Down Expand Up @@ -407,18 +405,16 @@ impl_eq!(Pin);
///
/// `InputPin`s are constructed by converting a [`Pin`] using [`Pin::into_input`],
/// [`Pin::into_input_pullup`] or [`Pin::into_input_pulldown`]. The pin's mode is
/// automatically set to [`Input`].
/// automatically set to [`Mode::Input`].
///
/// An `InputPin` can be used to read a pin's logic level, or (a)synchronously poll for
/// interrupt trigger events.
///
/// The `unproven` `embedded-hal` [`digital::InputPin`] trait implementation for `InputPin` can be enabled
/// by specifying the optional `hal-unproven` feature in the dependency declaration for
/// the `rppal` crate.
/// The `embedded-hal` trait implementations for `InputPin` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [`digital::InputPin`]: ../../embedded_hal/digital/trait.InputPin.html
/// [`Pin`]: struct.Pin.html
/// [`Input`]: enum.Mode.html#variant.Input
/// [`Mode::Input`]: enum.Mode.html#variant.Input
/// [`Pin::into_input`]: struct.Pin.html#method.into_input
/// [`Pin::into_input_pullup`]: struct.Pin.html#method.into_input_pullup
/// [`Pin::into_input_pulldown`]: struct.Pin.html#method.into_input_pulldown
Expand Down Expand Up @@ -562,21 +558,13 @@ impl_eq!(InputPin);
///
/// An `OutputPin` can be used to change a pin's output state.
///
/// The `embedded-hal` [`digital::OutputPin`] and [`PwmPin`] trait implementations for `OutputPin`
/// can be enabled by specifying the optional `hal` feature in the dependency
/// declaration for the `rppal` crate.
/// The `embedded-hal` trait implementations for `OutputPin` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// The `unproven` `embedded-hal` [`digital::InputPin`], [`digital::StatefulOutputPin`],
/// [`digital::ToggleableOutputPin`] and [`Pwm`] trait implementations for `OutputPin` can be enabled
/// by specifying the optional `hal-unproven` feature in the dependency declaration for
/// the `rppal` crate.
///
/// [`digital::InputPin`]: ../../embedded_hal/digital/trait.InputPin.html
/// [`digital::StatefulOutputPin`]: ../../embedded_hal/digital/trait.StatefulOutputPin.html
/// [`digital::ToggleableOutputPin`]: ../../embedded_hal/digital/trait.ToggleableOutputPin.html
/// [`Pwm`]: ../../embedded_hal/trait.Pwm.html
/// [`digital::OutputPin`]: ../../embedded_hal/digital/trait.OutputPin.html
/// [`PwmPin`]: ../../embedded_hal/trait.PwmPin.html
/// [`Pin`]: struct.Pin.html
/// [`Mode::Output`]: enum.Mode.html#variant.Output
/// [`Pin::into_output_low`]: struct.Pin.html#method.into_output_low
/// [`Pin::into_output_high`]: struct.Pin.html#method.into_output_high
#[derive(Debug)]
pub struct OutputPin {
pin: Pin,
Expand Down Expand Up @@ -665,26 +653,14 @@ impl_eq!(OutputPin);
/// An `IoPin` can be reconfigured for any available mode. Depending on the
/// mode, some methods may not have any effect. For instance, calling a method that
/// alters the pin's output state won't cause any changes when the pin's mode is set
/// to [`Input`].
///
/// The `embedded-hal` [`digital::OutputPin`] and [`PwmPin`] trait implementations for `IoPin`
/// can be enabled by specifying the optional `hal` feature in the dependency
/// declaration for the `rppal` crate.
/// to [`Mode::Input`].
///
/// The `unproven` `embedded-hal` [`digital::InputPin`], [`digital::StatefulOutputPin`],
/// [`digital::ToggleableOutputPin`] and [`Pwm`] trait implementations for `IoPin` can be enabled
/// by specifying the optional `hal-unproven` feature in the dependency declaration for
/// the `rppal` crate.
/// The `embedded-hal` trait implementations for `IoPin` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [`digital::InputPin`]: ../../embedded_hal/digital/trait.InputPin.html
/// [`digital::StatefulOutputPin`]: ../../embedded_hal/digital/trait.StatefulOutputPin.html
/// [`digital::ToggleableOutputPin`]: ../../embedded_hal/digital/trait.ToggleableOutputPin.html
/// [`Pwm`]: ../../embedded_hal/trait.Pwm.html
/// [`Pin`]: struct.Pin.html
/// [`Input`]: enum.Mode.html#variant.Input
/// [`Mode::Input`]: enum.Mode.html#variant.Input
/// [`Pin::into_io`]: struct.Pin.html#method.into_io
/// [`digital::OutputPin`]: ../../embedded_hal/digital/trait.OutputPin.html
/// [`PwmPin`]: ../../embedded_hal/trait.PwmPin.html
#[derive(Debug)]
pub struct IoPin {
pin: Pin,
Expand Down
9 changes: 2 additions & 7 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,11 @@ pub type Result<T> = result::Result<T, Error>;
/// through its various protocols. More details can be found in the latest SMBus
/// [specification].
///
/// The `embedded-hal` [`blocking::i2c::Read`], [`blocking::i2c::Write`] and
/// [`blocking::i2c::WriteRead`] trait implementations for `I2c` can be enabled
/// by specifying the optional `hal`
/// feature in the dependency declaration for the `rppal` crate.
/// The `embedded-hal` trait implementations for `I2c` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [here]: index.html#i2c-buses
/// [specification]: http://smbus.org/specs/SMBus_3_1_20180319.pdf
/// [`blocking::i2c::Read`]: ../../embedded_hal/blocking/i2c/trait.Read.html
/// [`blocking::i2c::Write`]: ../../embedded_hal/blocking/i2c/trait.Write.html
/// [`blocking::i2c::WriteRead`]: ../../embedded_hal/blocking/i2c/trait.WriteRead.html
#[derive(Debug)]
pub struct I2c {
bus: u8,
Expand Down
11 changes: 2 additions & 9 deletions src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,10 @@ impl fmt::Display for Polarity {
/// Before using `Pwm`, make sure the selected PWM channel has been configured
/// and activated. More information can be found [here].
///
/// The `embedded-hal` [`PwmPin`] trait implementation for `Pwm` can be enabled
/// by specifying the optional `hal` feature in the dependency declaration for
/// the `rppal` crate.
///
/// The `unproven` `embedded-hal` [`Pwm`] trait implementation for `Pwm` can be enabled
/// by specifying the optional `hal-unproven` feature in the dependency declaration for
/// the `rppal` crate.
/// The `embedded-hal` trait implementations for `Pwm` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [here]: index.html
/// [`PwmPin`]: ../../embedded_hal/trait.PwmPin.html
/// [`Pwm`]: ../../embedded_hal/trait.Pwm.html
#[derive(Debug)]
pub struct Pwm {
channel: Channel,
Expand Down
9 changes: 2 additions & 7 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,10 @@ impl fmt::Display for BitOrder {
/// Before using `Spi`, make sure your Raspberry Pi has the necessary SPI buses
/// and Slave Select pins enabled. More information can be found [here].
///
/// The `embedded-hal` [`blocking::spi::Transfer<u8>`], [`blocking::spi::Write<u8>`]
/// and [`spi::FullDuplex<u8>`] trait
/// implementations for `Spi` can be enabled by specifying the optional `hal`
/// feature in the dependency declaration for the `rppal` crate.
/// The `embedded-hal` trait implementations for `Spi` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
///
/// [here]: index.html
/// [`blocking::spi::Transfer<u8>`]: ../../embedded_hal/blocking/spi/trait.Transfer.html
/// [`blocking::spi::Write<u8>`]: ../../embedded_hal/blocking/spi/trait.Write.html
/// [`spi::FullDuplex<u8>`]: ../../embedded_hal/spi/trait.FullDuplex.html
pub struct Spi {
spidev: File,
// Stores the last read value. Used for embedded_hal::spi::FullDuplex.
Expand Down
9 changes: 2 additions & 7 deletions src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,8 @@ struct UartInner {
/// Provides access to the Raspberry Pi's UART peripherals and any USB to
/// serial adapters.
///
/// The `embedded-hal` [`serial::Read`], [`serial::Write`] and [`blocking::serial::Write`] trait
/// implementations for `Uart` can be enabled by specifying the optional `hal` feature in the
/// dependency declaration for the `rppal` crate.
///
/// [`serial::Read`]: ../../embedded_hal/serial/trait.Read.html
/// [`serial::Write`]: ../../embedded_hal/serial/trait.Write.html
/// [`blocking::serial::Write`]: ../../embedded_hal/blocking/serial/trait.Write.html
/// The `embedded-hal` trait implementations for `Uart` can be enabled by specifying
/// the optional `hal` feature in the dependency declaration for the `rppal` crate.
#[derive(Debug)]
pub struct Uart {
inner: UartInner,
Expand Down

0 comments on commit cc9dc58

Please sign in to comment.