Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
golemparts committed Nov 9, 2022
1 parent 5c45691 commit 77890e9
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 55 deletions.
36 changes: 18 additions & 18 deletions src/gpio/hal.rs
Expand Up @@ -7,12 +7,12 @@ use embedded_hal::digital::{

use super::{InputPin, IoPin, Level, OutputPin, Pin};

/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ErrorType for Pin {
type Error = Infallible;
}

/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl InputPinHal for Pin {
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(Self::read(self) == Level::High)
Expand All @@ -23,12 +23,12 @@ impl InputPinHal for Pin {
}
}

/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ErrorType for InputPin {
type Error = Infallible;
}

/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl InputPinHal for InputPin {
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(Self::is_high(self))
Expand All @@ -39,12 +39,12 @@ impl InputPinHal for InputPin {
}
}

/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ErrorType for IoPin {
type Error = Infallible;
}

/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl InputPinHal for IoPin {
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(Self::is_high(self))
Expand All @@ -55,12 +55,12 @@ impl InputPinHal for IoPin {
}
}

/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ErrorType` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ErrorType for OutputPin {
type Error = Infallible;
}

/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `InputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl InputPinHal for OutputPin {
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(Self::is_set_high(self))
Expand All @@ -71,7 +71,7 @@ impl InputPinHal for OutputPin {
}
}

/// `OutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `OutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl OutputPinHal for OutputPin {
fn set_low(&mut self) -> Result<(), Self::Error> {
OutputPin::set_low(self);
Expand All @@ -86,7 +86,7 @@ impl OutputPinHal for OutputPin {
}
}

/// `OutputPin` trait implementation for `embedded-hal` v0.2.6.
/// `OutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::OutputPin for OutputPin {
type Error = Infallible;

Expand All @@ -99,7 +99,7 @@ impl embedded_hal_0::digital::v2::OutputPin for OutputPin {
}
}

/// `StatefulOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `StatefulOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl StatefulOutputPinHal for OutputPin {
fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(OutputPin::is_set_high(self))
Expand All @@ -110,7 +110,7 @@ impl StatefulOutputPinHal for OutputPin {
}
}

/// `ToggleableOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ToggleableOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ToggleableOutputPinHal for OutputPin {
fn toggle(&mut self) -> Result<(), Self::Error> {
OutputPin::toggle(self);
Expand All @@ -119,7 +119,7 @@ impl ToggleableOutputPinHal for OutputPin {
}
}

/// `OutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `OutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl OutputPinHal for IoPin {
fn set_low(&mut self) -> Result<(), Self::Error> {
IoPin::set_low(self);
Expand All @@ -134,7 +134,7 @@ impl OutputPinHal for IoPin {
}
}

/// `OutputPin` trait implementation for `embedded-hal` v0.2.6.
/// `OutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::OutputPin for IoPin {
type Error = Infallible;

Expand All @@ -147,7 +147,7 @@ impl embedded_hal_0::digital::v2::OutputPin for IoPin {
}
}

/// `StatefulOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `StatefulOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl StatefulOutputPinHal for IoPin {
fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(IoPin::is_high(self))
Expand All @@ -158,7 +158,7 @@ impl StatefulOutputPinHal for IoPin {
}
}

/// `ToggleableOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `ToggleableOutputPin` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl ToggleableOutputPinHal for IoPin {
fn toggle(&mut self) -> Result<(), Self::Error> {
IoPin::toggle(self);
Expand All @@ -167,7 +167,7 @@ impl ToggleableOutputPinHal for IoPin {
}
}

/// `PwmPin` trait implementation for `embedded-hal` v0.2.6.
/// `PwmPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::PwmPin for OutputPin {
type Duty = f64;

Expand Down Expand Up @@ -196,7 +196,7 @@ impl embedded_hal_0::PwmPin for OutputPin {
}
}

/// `PwmPin` trait implementation for `embedded-hal` v0.2.6.
/// `PwmPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::PwmPin for IoPin {
type Duty = f64;

Expand Down
22 changes: 11 additions & 11 deletions src/gpio/hal_unproven.rs
Expand Up @@ -11,7 +11,7 @@ use crate::gpio::Mode;

const NANOS_PER_SEC: f64 = 1_000_000_000.0;

/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::InputPin for Pin {
type Error = Infallible;

Expand All @@ -24,7 +24,7 @@ impl embedded_hal_0::digital::v2::InputPin for Pin {
}
}

/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::InputPin for InputPin {
type Error = Infallible;

Expand All @@ -37,7 +37,7 @@ impl embedded_hal_0::digital::v2::InputPin for InputPin {
}
}

/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::InputPin for IoPin {
type Error = Infallible;

Expand All @@ -50,7 +50,7 @@ impl embedded_hal_0::digital::v2::InputPin for IoPin {
}
}

/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `InputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::InputPin for OutputPin {
type Error = Infallible;

Expand All @@ -63,7 +63,7 @@ impl embedded_hal_0::digital::v2::InputPin for OutputPin {
}
}

/// Unproven `StatefulOutputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `StatefulOutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::StatefulOutputPin for IoPin {
fn is_set_high(&self) -> Result<bool, Self::Error> {
StatefulOutputPinHal::is_set_high(self)
Expand All @@ -74,7 +74,7 @@ impl embedded_hal_0::digital::v2::StatefulOutputPin for IoPin {
}
}

/// Unproven `StatefulOutputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `StatefulOutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::StatefulOutputPin for OutputPin {
fn is_set_high(&self) -> Result<bool, Self::Error> {
StatefulOutputPinHal::is_set_high(self)
Expand All @@ -85,7 +85,7 @@ impl embedded_hal_0::digital::v2::StatefulOutputPin for OutputPin {
}
}

/// Unproven `ToggleableOutputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `ToggleableOutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::ToggleableOutputPin for IoPin {
type Error = Infallible;

Expand All @@ -94,7 +94,7 @@ impl embedded_hal_0::digital::v2::ToggleableOutputPin for IoPin {
}
}

/// Unproven `ToggleableOutputPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `ToggleableOutputPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::ToggleableOutputPin for OutputPin {
type Error = Infallible;

Expand All @@ -103,7 +103,7 @@ impl embedded_hal_0::digital::v2::ToggleableOutputPin for OutputPin {
}
}

/// Unproven `Pwm` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `Pwm` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::Pwm for OutputPin {
type Duty = f64;
type Channel = ();
Expand Down Expand Up @@ -162,7 +162,7 @@ impl embedded_hal_0::Pwm for OutputPin {
}
}

/// Unproven `Pwm` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `Pwm` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::Pwm for IoPin {
type Duty = f64;
type Channel = ();
Expand Down Expand Up @@ -221,7 +221,7 @@ impl embedded_hal_0::Pwm for IoPin {
}
}

/// Unproven `IoPin` trait implementation for `embedded-hal` v0.2.6.
/// Unproven `IoPin` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::digital::v2::IoPin<IoPin, IoPin> for IoPin {
type Error = Infallible;

Expand Down
2 changes: 1 addition & 1 deletion src/gpio/soft_pwm.rs
Expand Up @@ -11,7 +11,7 @@ use libc::{self, sched_param, timespec, CLOCK_MONOTONIC, PR_SET_TIMERSLACK, SCHE

use super::{Error, GpioState, Result};

// Only call sleep_ns() if we have enough time remaining
// Only call sleep() if we have enough time remaining
const SLEEP_THRESHOLD: u64 = 250_000;
// Reserve some time for busy waiting
const BUSYWAIT_MAX: u64 = 200_000;
Expand Down
22 changes: 11 additions & 11 deletions src/hal.rs
Expand Up @@ -17,36 +17,36 @@ use void::Void;
#[derive(Debug, Default)]
pub struct Delay;

/// `Delay` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `Delay` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl Delay {
/// Constructs a new `Delay`.
pub fn new() -> Delay {
Delay {}
}
}

/// `DelayMs<u8>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayMs<u8>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayMs<u8> for Delay {
fn delay_ms(&mut self, ms: u8) {
DelayUs::delay_ms(self, ms as u32).unwrap()
}
}

/// `DelayMs<u16>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayMs<u16>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayMs<u16> for Delay {
fn delay_ms(&mut self, ms: u16) {
DelayUs::delay_ms(self, ms as u32).unwrap()
}
}

/// `DelayMs<u32>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayMs<u32>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayMs<u32> for Delay {
fn delay_ms(&mut self, ms: u32) {
DelayUs::delay_ms(self, ms).unwrap()
}
}

/// `DelayMs<u64>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayMs<u64>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayMs<u64> for Delay {
fn delay_ms(&mut self, mut ms: u64) {
while ms > (u32::MAX as u64) {
Expand All @@ -58,21 +58,21 @@ impl embedded_hal_0::blocking::delay::DelayMs<u64> for Delay {
}
}

/// `DelayUs<u8>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayUs<u8>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayUs<u8> for Delay {
fn delay_us(&mut self, us: u8) {
DelayUs::delay_us(self, us as u32).unwrap()
}
}

/// `DelayUs<u16>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayUs<u16>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayUs<u16> for Delay {
fn delay_us(&mut self, us: u16) {
DelayUs::delay_us(self, us as u32).unwrap()
}
}

/// `DelayUs` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `DelayUs` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl DelayUs for Delay {
type Error = Infallible;

Expand All @@ -87,14 +87,14 @@ impl DelayUs for Delay {
}
}

/// `DelayUs<u32>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayUs<u32>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayUs<u32> for Delay {
fn delay_us(&mut self, us: u32) {
DelayUs::delay_us(self, us).unwrap()
}
}

/// `DelayUs<u64>` trait implementation for `embedded-hal` v0.2.6.
/// `DelayUs<u64>` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::delay::DelayUs<u64> for Delay {
fn delay_us(&mut self, mut us: u64) {
while us > (u32::MAX as u64) {
Expand Down Expand Up @@ -144,7 +144,7 @@ impl Default for Timer {
}
}

/// `CountDown` trait implementation for `embedded-hal` v0.2.6.
/// `CountDown` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::timer::CountDown for Timer {
type Time = Duration;

Expand Down
8 changes: 4 additions & 4 deletions src/i2c/hal.rs
Expand Up @@ -2,7 +2,7 @@ use embedded_hal::i2c::{self, ErrorType, I2c as I2cHal, Operation as I2cOperatio

use super::{Error, I2c};

/// `Write` trait implementation for `embedded-hal` v0.2.6.
/// `Write` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::i2c::Write for I2c {
type Error = Error;

Expand All @@ -11,7 +11,7 @@ impl embedded_hal_0::blocking::i2c::Write for I2c {
}
}

/// `Read` trait implementation for `embedded-hal` v0.2.6.
/// `Read` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::i2c::Read for I2c {
type Error = Error;

Expand All @@ -20,7 +20,7 @@ impl embedded_hal_0::blocking::i2c::Read for I2c {
}
}

/// `WriteRead` trait implementation for `embedded-hal` v0.2.6.
/// `WriteRead` trait implementation for `embedded-hal` v0.2.7.
impl embedded_hal_0::blocking::i2c::WriteRead for I2c {
type Error = Error;

Expand Down Expand Up @@ -54,7 +54,7 @@ impl i2c::Error for Error {
}
}

/// `I2c` trait implementation for `embedded-hal` v1.0.0-alpha.7.
/// `I2c` trait implementation for `embedded-hal` v1.0.0-alpha.9.
impl I2cHal for I2c {
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error> {
self.set_slave_address(u16::from(address))?;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -4,7 +4,7 @@
//!
//! The library can be used in conjunction with a variety of platform-agnostic
//! drivers through its `embedded-hal` trait implementations. Both `embedded-hal`
//! v0.2.6 and v1.0.0-alpha.7 are supported.
//! v0.2.7 and v1.0.0-alpha.9 are supported.
//!
//! RPPAL requires Raspberry Pi OS or any similar, recent, Linux distribution.
//! Both `gnu` and `musl` libc targets are supported. RPPAL is compatible with the
Expand Down

0 comments on commit 77890e9

Please sign in to comment.