Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ bitflags = "2.6.0"
cipher = "0.3"
critical-section = "1.2.0"
cortex-m = "0.7"
embedded-hal-02 = {package = "embedded-hal", version = "0.2", features = ["unproven"]}
embedded-hal-1 = {package = "embedded-hal", version = "1.0.0"}
embedded-hal = "1.0.0"
embedded-hal-nb = "1.0.0"
embedded-io = "0.6"
fugit = "0.3"
Expand Down
37 changes: 0 additions & 37 deletions hal/src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use cortex_m::peripheral::syst::SystClkSource;

use crate::clock::GenericClockController;
use crate::ehal::delay::DelayNs;
use crate::ehal_02;
use crate::time::Hertz;

#[hal_cfg("rtc-d5x")]
Expand Down Expand Up @@ -94,39 +93,3 @@ impl DelayNs for Delay {
self.delay_us(ms * 1000);
}
}

impl ehal_02::blocking::delay::DelayMs<u32> for Delay {
fn delay_ms(&mut self, ms: u32) {
<Self as DelayNs>::delay_us(self, ms * 1_000);
}
}

impl ehal_02::blocking::delay::DelayMs<u16> for Delay {
fn delay_ms(&mut self, ms: u16) {
<Self as ehal_02::blocking::delay::DelayMs<u32>>::delay_ms(self, ms as u32);
}
}

impl ehal_02::blocking::delay::DelayMs<u8> for Delay {
fn delay_ms(&mut self, ms: u8) {
<Self as ehal_02::blocking::delay::DelayMs<u32>>::delay_ms(self, ms as u32);
}
}

impl ehal_02::blocking::delay::DelayUs<u32> for Delay {
fn delay_us(&mut self, us: u32) {
<Self as DelayNs>::delay_us(self, us);
}
}

impl ehal_02::blocking::delay::DelayUs<u16> for Delay {
fn delay_us(&mut self, us: u16) {
<Self as ehal_02::blocking::delay::DelayUs<u32>>::delay_us(self, us as u32);
}
}

impl ehal_02::blocking::delay::DelayUs<u8> for Delay {
fn delay_us(&mut self, us: u8) {
<Self as ehal_02::blocking::delay::DelayUs<u32>>::delay_us(self, us as u32);
}
}
47 changes: 0 additions & 47 deletions hal/src/gpio/dynpin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,50 +550,3 @@ impl StatefulOutputPin for DynPin {
self._is_set_low()
}
}

//==============================================================================
// Embedded HAL v0.2 traits
//==============================================================================

impl crate::ehal_02::digital::v2::OutputPin for DynPin {
type Error = Error;
#[inline]
fn set_high(&mut self) -> Result<(), Self::Error> {
self._set_high()
}
#[inline]
fn set_low(&mut self) -> Result<(), Self::Error> {
self._set_low()
}
}

impl crate::ehal_02::digital::v2::InputPin for DynPin {
type Error = Error;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
self._is_high()
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
self._is_low()
}
}

impl crate::ehal_02::digital::v2::ToggleableOutputPin for DynPin {
type Error = Error;
#[inline]
fn toggle(&mut self) -> Result<(), Self::Error> {
self._toggle()
}
}

impl crate::ehal_02::digital::v2::StatefulOutputPin for DynPin {
#[inline]
fn is_set_high(&self) -> Result<bool, Self::Error> {
self._is_set_high()
}
#[inline]
fn is_set_low(&self) -> Result<bool, Self::Error> {
self._is_set_low()
}
}
97 changes: 0 additions & 97 deletions hal/src/gpio/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,103 +969,6 @@ where
}
}

//==============================================================================
// Embedded HAL v0.2 traits
//==============================================================================

impl<I, C> crate::ehal_02::digital::v2::OutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,
{
type Error = Infallible;
#[inline]
fn set_high(&mut self) -> Result<(), Self::Error> {
self._set_high();
Ok(())
}
#[inline]
fn set_low(&mut self) -> Result<(), Self::Error> {
self._set_low();
Ok(())
}
}

impl<I> crate::ehal_02::digital::v2::InputPin for Pin<I, ReadableOutput>
where
I: PinId,
{
type Error = Infallible;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self._is_high())
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self._is_low())
}
}

impl<I, C> crate::ehal_02::digital::v2::InputPin for Pin<I, Input<C>>
where
I: PinId,
C: InputConfig,
{
type Error = Infallible;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self._is_high())
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self._is_low())
}
}

impl<I, C> crate::ehal_02::digital::v2::InputPin for Pin<I, Interrupt<C>>
where
I: PinId,
C: InterruptConfig,
{
type Error = Infallible;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self._is_high())
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self._is_low())
}
}

impl<I, C> crate::ehal_02::digital::v2::ToggleableOutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,
{
type Error = Infallible;
#[inline]
fn toggle(&mut self) -> Result<(), Self::Error> {
self._toggle();
Ok(())
}
}

impl<I, C> crate::ehal_02::digital::v2::StatefulOutputPin for Pin<I, Output<C>>
where
I: PinId,
C: OutputConfig,
{
#[inline]
fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self._is_set_high())
}
#[inline]
fn is_set_low(&self) -> Result<bool, Self::Error> {
Ok(self._is_set_low())
}
}

//==============================================================================
// Pin definitions
//==============================================================================
Expand Down
3 changes: 1 addition & 2 deletions hal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![no_std]

pub use embedded_hal_1 as ehal;
use embedded_hal_02 as ehal_02;
pub use embedded_hal as ehal;
pub use embedded_hal_nb as ehal_nb;
pub use embedded_io;
pub use fugit;
Expand Down
22 changes: 1 addition & 21 deletions hal/src/peripherals/eic/d11/pin.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use atsamd_hal_macros::hal_cfg;

use crate::ehal::digital::{ErrorType, InputPin};
use crate::ehal_02::digital::v2::InputPin as InputPin_02;
use crate::eic::*;
use crate::gpio::{
self, pin::*, AnyPin, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt,
};
use crate::gpio::{self, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt};
use core::convert::Infallible;

/// The pad macro defines the given EIC pin and implements EicPin for the
Expand Down Expand Up @@ -142,23 +139,6 @@ where
}
}

impl<P, C, Id, F> InputPin_02 for ExtInt<P, Id, F>
where
P: EicPin + AnyPin<Mode = Interrupt<C>>,
Id: ChId,
C: InterruptConfig,
{
type Error = Infallible;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
self.pin.is_high()
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
self.pin.is_low()
}
}

impl<P, Id, F> InputPin for ExtInt<P, Id, F>
where
Self: ErrorType,
Expand Down
22 changes: 1 addition & 21 deletions hal/src/peripherals/eic/d5x/pin.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use atsamd_hal_macros::hal_cfg;

use crate::ehal::digital::{ErrorType, InputPin};
use crate::ehal_02::digital::v2::InputPin as InputPin_02;
use crate::eic::*;
use crate::gpio::{
self, pin::*, AnyPin, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt,
};
use crate::gpio::{self, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt};
use core::convert::Infallible;

/// The pad macro defines the given EIC pin and implements EicPin for the
Expand Down Expand Up @@ -162,23 +159,6 @@ where
}
}

impl<P, C, Id, F> InputPin_02 for ExtInt<P, Id, F>
where
P: EicPin + AnyPin<Mode = Interrupt<C>>,
C: InterruptConfig,
Id: ChId,
{
type Error = Infallible;
#[inline]
fn is_high(&self) -> Result<bool, Self::Error> {
self.pin.is_high()
}
#[inline]
fn is_low(&self) -> Result<bool, Self::Error> {
self.pin.is_low()
}
}

impl<P, Id, F> InputPin for ExtInt<P, Id, F>
where
Self: ErrorType,
Expand Down
Loading
Loading