Skip to content

Commit 8a2277b

Browse files
committed
removed(hal)!: Remove embedded-hal v0.2 implementations (atsamd-rs#875)
1 parent 2134bd0 commit 8a2277b

File tree

24 files changed

+80
-905
lines changed

24 files changed

+80
-905
lines changed

hal/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ bitflags = "2.6.0"
3737
cipher = "0.3"
3838
critical-section = "1.2.0"
3939
cortex-m = "0.7"
40-
embedded-hal-02 = {package = "embedded-hal", version = "0.2", features = ["unproven"]}
41-
embedded-hal-1 = {package = "embedded-hal", version = "1.0.0"}
40+
embedded-hal = "1.0.0"
4241
embedded-hal-nb = "1.0.0"
4342
embedded-io = "0.6"
4443
fugit = "0.3"
@@ -53,7 +52,6 @@ rand_core = "0.9.1"
5352
seq-macro = "0.3"
5453
sorted-hlist = "0.2.0"
5554
typenum = "1.12.0"
56-
void = {version = "1.0", default-features = false}
5755

5856
#===============================================================================
5957
# Optional depdendencies

hal/src/delay.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use cortex_m::peripheral::syst::SystClkSource;
66

77
use crate::clock::GenericClockController;
88
use crate::ehal::delay::DelayNs;
9-
use crate::ehal_02;
109
use crate::time::Hertz;
1110

1211
#[hal_cfg("rtc-d5x")]
@@ -94,39 +93,3 @@ impl DelayNs for Delay {
9493
self.delay_us(ms * 1000);
9594
}
9695
}
97-
98-
impl ehal_02::blocking::delay::DelayMs<u32> for Delay {
99-
fn delay_ms(&mut self, ms: u32) {
100-
<Self as DelayNs>::delay_us(self, ms * 1_000);
101-
}
102-
}
103-
104-
impl ehal_02::blocking::delay::DelayMs<u16> for Delay {
105-
fn delay_ms(&mut self, ms: u16) {
106-
<Self as ehal_02::blocking::delay::DelayMs<u32>>::delay_ms(self, ms as u32);
107-
}
108-
}
109-
110-
impl ehal_02::blocking::delay::DelayMs<u8> for Delay {
111-
fn delay_ms(&mut self, ms: u8) {
112-
<Self as ehal_02::blocking::delay::DelayMs<u32>>::delay_ms(self, ms as u32);
113-
}
114-
}
115-
116-
impl ehal_02::blocking::delay::DelayUs<u32> for Delay {
117-
fn delay_us(&mut self, us: u32) {
118-
<Self as DelayNs>::delay_us(self, us);
119-
}
120-
}
121-
122-
impl ehal_02::blocking::delay::DelayUs<u16> for Delay {
123-
fn delay_us(&mut self, us: u16) {
124-
<Self as ehal_02::blocking::delay::DelayUs<u32>>::delay_us(self, us as u32);
125-
}
126-
}
127-
128-
impl ehal_02::blocking::delay::DelayUs<u8> for Delay {
129-
fn delay_us(&mut self, us: u8) {
130-
<Self as ehal_02::blocking::delay::DelayUs<u32>>::delay_us(self, us as u32);
131-
}
132-
}

hal/src/gpio/dynpin.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -550,50 +550,3 @@ impl StatefulOutputPin for DynPin {
550550
self._is_set_low()
551551
}
552552
}
553-
554-
//==============================================================================
555-
// Embedded HAL v0.2 traits
556-
//==============================================================================
557-
558-
impl crate::ehal_02::digital::v2::OutputPin for DynPin {
559-
type Error = Error;
560-
#[inline]
561-
fn set_high(&mut self) -> Result<(), Self::Error> {
562-
self._set_high()
563-
}
564-
#[inline]
565-
fn set_low(&mut self) -> Result<(), Self::Error> {
566-
self._set_low()
567-
}
568-
}
569-
570-
impl crate::ehal_02::digital::v2::InputPin for DynPin {
571-
type Error = Error;
572-
#[inline]
573-
fn is_high(&self) -> Result<bool, Self::Error> {
574-
self._is_high()
575-
}
576-
#[inline]
577-
fn is_low(&self) -> Result<bool, Self::Error> {
578-
self._is_low()
579-
}
580-
}
581-
582-
impl crate::ehal_02::digital::v2::ToggleableOutputPin for DynPin {
583-
type Error = Error;
584-
#[inline]
585-
fn toggle(&mut self) -> Result<(), Self::Error> {
586-
self._toggle()
587-
}
588-
}
589-
590-
impl crate::ehal_02::digital::v2::StatefulOutputPin for DynPin {
591-
#[inline]
592-
fn is_set_high(&self) -> Result<bool, Self::Error> {
593-
self._is_set_high()
594-
}
595-
#[inline]
596-
fn is_set_low(&self) -> Result<bool, Self::Error> {
597-
self._is_set_low()
598-
}
599-
}

hal/src/gpio/pin.rs

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -969,103 +969,6 @@ where
969969
}
970970
}
971971

972-
//==============================================================================
973-
// Embedded HAL v0.2 traits
974-
//==============================================================================
975-
976-
impl<I, C> crate::ehal_02::digital::v2::OutputPin for Pin<I, Output<C>>
977-
where
978-
I: PinId,
979-
C: OutputConfig,
980-
{
981-
type Error = Infallible;
982-
#[inline]
983-
fn set_high(&mut self) -> Result<(), Self::Error> {
984-
self._set_high();
985-
Ok(())
986-
}
987-
#[inline]
988-
fn set_low(&mut self) -> Result<(), Self::Error> {
989-
self._set_low();
990-
Ok(())
991-
}
992-
}
993-
994-
impl<I> crate::ehal_02::digital::v2::InputPin for Pin<I, ReadableOutput>
995-
where
996-
I: PinId,
997-
{
998-
type Error = Infallible;
999-
#[inline]
1000-
fn is_high(&self) -> Result<bool, Self::Error> {
1001-
Ok(self._is_high())
1002-
}
1003-
#[inline]
1004-
fn is_low(&self) -> Result<bool, Self::Error> {
1005-
Ok(self._is_low())
1006-
}
1007-
}
1008-
1009-
impl<I, C> crate::ehal_02::digital::v2::InputPin for Pin<I, Input<C>>
1010-
where
1011-
I: PinId,
1012-
C: InputConfig,
1013-
{
1014-
type Error = Infallible;
1015-
#[inline]
1016-
fn is_high(&self) -> Result<bool, Self::Error> {
1017-
Ok(self._is_high())
1018-
}
1019-
#[inline]
1020-
fn is_low(&self) -> Result<bool, Self::Error> {
1021-
Ok(self._is_low())
1022-
}
1023-
}
1024-
1025-
impl<I, C> crate::ehal_02::digital::v2::InputPin for Pin<I, Interrupt<C>>
1026-
where
1027-
I: PinId,
1028-
C: InterruptConfig,
1029-
{
1030-
type Error = Infallible;
1031-
#[inline]
1032-
fn is_high(&self) -> Result<bool, Self::Error> {
1033-
Ok(self._is_high())
1034-
}
1035-
#[inline]
1036-
fn is_low(&self) -> Result<bool, Self::Error> {
1037-
Ok(self._is_low())
1038-
}
1039-
}
1040-
1041-
impl<I, C> crate::ehal_02::digital::v2::ToggleableOutputPin for Pin<I, Output<C>>
1042-
where
1043-
I: PinId,
1044-
C: OutputConfig,
1045-
{
1046-
type Error = Infallible;
1047-
#[inline]
1048-
fn toggle(&mut self) -> Result<(), Self::Error> {
1049-
self._toggle();
1050-
Ok(())
1051-
}
1052-
}
1053-
1054-
impl<I, C> crate::ehal_02::digital::v2::StatefulOutputPin for Pin<I, Output<C>>
1055-
where
1056-
I: PinId,
1057-
C: OutputConfig,
1058-
{
1059-
#[inline]
1060-
fn is_set_high(&self) -> Result<bool, Self::Error> {
1061-
Ok(self._is_set_high())
1062-
}
1063-
#[inline]
1064-
fn is_set_low(&self) -> Result<bool, Self::Error> {
1065-
Ok(self._is_set_low())
1066-
}
1067-
}
1068-
1069972
//==============================================================================
1070973
// Pin definitions
1071974
//==============================================================================

hal/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![no_std]
22

3-
pub use embedded_hal_1 as ehal;
4-
use embedded_hal_02 as ehal_02;
3+
pub use embedded_hal as ehal;
54
pub use embedded_hal_nb as ehal_nb;
65
pub use embedded_io;
76
pub use fugit;

hal/src/peripherals/adc/d11.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
use atsamd_hal_macros::hal_cfg;
33

44
use crate::clock::GenericClockController;
5-
use crate::ehal_02::adc::{Channel, OneShot};
65
use crate::gpio::*;
76
use crate::pac::{self, adc, Pm};
87

hal/src/peripherals/adc/d5x.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use atsamd_hal_macros::hal_cfg;
44
use crate::clock::GenericClockController;
55
#[rustfmt::skip]
66
use crate::gpio::*;
7-
use crate::ehal_02::adc::{Channel, OneShot};
87
use crate::pac::gclk::genctrl::Srcselect::Dfll;
98
use crate::pac::gclk::pchctrl::Genselect;
109
use crate::pac::{adc0, Adc0, Adc1, Mclk};

hal/src/peripherals/eic/d11/pin.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use atsamd_hal_macros::hal_cfg;
22

33
use crate::ehal::digital::{ErrorType, InputPin};
4-
use crate::ehal_02::digital::v2::InputPin as InputPin_02;
54
use crate::eic::*;
6-
use crate::gpio::{
7-
self, pin::*, AnyPin, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt,
8-
};
5+
use crate::gpio::{self, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt};
96
use core::convert::Infallible;
107

118
/// The pad macro defines the given EIC pin and implements EicPin for the
@@ -142,23 +139,6 @@ where
142139
}
143140
}
144141

145-
impl<P, C, Id, F> InputPin_02 for ExtInt<P, Id, F>
146-
where
147-
P: EicPin + AnyPin<Mode = Interrupt<C>>,
148-
Id: ChId,
149-
C: InterruptConfig,
150-
{
151-
type Error = Infallible;
152-
#[inline]
153-
fn is_high(&self) -> Result<bool, Self::Error> {
154-
self.pin.is_high()
155-
}
156-
#[inline]
157-
fn is_low(&self) -> Result<bool, Self::Error> {
158-
self.pin.is_low()
159-
}
160-
}
161-
162142
impl<P, Id, F> InputPin for ExtInt<P, Id, F>
163143
where
164144
Self: ErrorType,

hal/src/peripherals/eic/d5x/pin.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use atsamd_hal_macros::hal_cfg;
22

33
use crate::ehal::digital::{ErrorType, InputPin};
4-
use crate::ehal_02::digital::v2::InputPin as InputPin_02;
54
use crate::eic::*;
6-
use crate::gpio::{
7-
self, pin::*, AnyPin, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt,
8-
};
5+
use crate::gpio::{self, FloatingInterrupt, PinMode, PullDownInterrupt, PullUpInterrupt};
96
use core::convert::Infallible;
107

118
/// The pad macro defines the given EIC pin and implements EicPin for the
@@ -162,23 +159,6 @@ where
162159
}
163160
}
164161

165-
impl<P, C, Id, F> InputPin_02 for ExtInt<P, Id, F>
166-
where
167-
P: EicPin + AnyPin<Mode = Interrupt<C>>,
168-
C: InterruptConfig,
169-
Id: ChId,
170-
{
171-
type Error = Infallible;
172-
#[inline]
173-
fn is_high(&self) -> Result<bool, Self::Error> {
174-
self.pin.is_high()
175-
}
176-
#[inline]
177-
fn is_low(&self) -> Result<bool, Self::Error> {
178-
self.pin.is_low()
179-
}
180-
}
181-
182162
impl<P, Id, F> InputPin for ExtInt<P, Id, F>
183163
where
184164
Self: ErrorType,

0 commit comments

Comments
 (0)