Skip to content

Commit

Permalink
Update embedded-hal to 1.0.0-rc.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Dec 14, 2023
1 parent 2c3d399 commit d81395f
Show file tree
Hide file tree
Showing 41 changed files with 238 additions and 203 deletions.
2 changes: 1 addition & 1 deletion cyw43/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cortex-m = "0.7.6"
cortex-m-rt = "0.7.0"
futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }

embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.2" }
embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-rc.3" }
num_enum = { version = "0.5.7", default-features = false }

[package.metadata.embassy_docs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {defmt_rtt as _, panic_probe as _};
fn main() -> ! {
let p = embassy_stm32::init(Default::default());
let mut led = Output::new(p.PB14, Level::High, Speed::VeryHigh);
let button = Input::new(p.PC13, Pull::Up);
let mut button = Input::new(p.PC13, Pull::Up);

loop {
if button.is_low() {
Expand Down
4 changes: 2 additions & 2 deletions embassy-embedded-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ embassy-time = { version = "0.2", path = "../embassy-time", optional = true }
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
"unproven",
] }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embedded-storage = "0.3.1"
embedded-storage-async = { version = "0.4.1" }
nb = "1.0.0"
Expand Down
8 changes: 4 additions & 4 deletions embassy-net-adin1110/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ edition = "2021"
heapless = "0.8"
defmt = { version = "0.3", optional = true }
log = { version = "0.4", default-features = false, optional = true }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal-bus = { version = "=0.1.0-rc.2", features = ["async"] }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embedded-hal-bus = { version = "=0.1.0-rc.3", features = ["async"] }
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
embassy-time = { version = "0.2", path = "../embassy-time" }
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
bitfield = "0.14.0"

[dev-dependencies]
embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "c5c4dca18e043e6386aee02173f61a65fea3981e", features = ["embedded-hal-async", "eh1"] }
embedded-hal-mock = { git = "https://github.com/Dirbaio/embedded-hal-mock", rev = "b5a2274759a8c484f4fae71a22f8a083fdd9d5da", features = ["embedded-hal-async", "eh1"] }
crc = "3.0.1"
env_logger = "0.10"
critical-section = { version = "1.1.2", features = ["std"] }
Expand Down
4 changes: 2 additions & 2 deletions embassy-net-enc28j60/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
embedded-hal = { version = "1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal = { version = "1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embassy-net-driver = { version = "0.2.0", path = "../embassy-net-driver" }
embassy-time = { version = "0.2", path = "../embassy-time" }
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
Expand Down
4 changes: 2 additions & 2 deletions embassy-net-esp-hosted/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ embassy-sync = { version = "0.5.0", path = "../embassy-sync"}
embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel"}

embedded-hal = { version = "1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal = { version = "1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }

noproto = { git="https://github.com/embassy-rs/noproto", rev = "f5e6d1f325b6ad4e344f60452b09576e24671f62", default-features = false, features = ["derive"] }
#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions embassy-net-wiznet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[dependencies]
embedded-hal = { version = "1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal = { version = "1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embassy-net-driver-channel = { version = "0.2.0", path = "../embassy-net-driver-channel" }
embassy-time = { version = "0.2", path = "../embassy-time" }
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
Expand Down
5 changes: 2 additions & 3 deletions embassy-nrf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" }

embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embedded-io = { version = "0.6.0" }
embedded-io-async = { version = "0.6.1" }

Expand All @@ -120,4 +120,3 @@ nrf52840-pac = { version = "0.12.0", optional = true }
nrf5340-app-pac = { version = "0.12.0", optional = true }
nrf5340-net-pac = { version = "0.12.0", optional = true }
nrf9160-pac = { version = "0.12.0", optional = true }

67 changes: 39 additions & 28 deletions embassy-nrf/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ impl<'d, T: Pin> Input<'d, T> {

/// Test if current pin level is high.
#[inline]
pub fn is_high(&self) -> bool {
pub fn is_high(&mut self) -> bool {
self.pin.is_high()
}

/// Test if current pin level is low.
#[inline]
pub fn is_low(&self) -> bool {
pub fn is_low(&mut self) -> bool {
self.pin.is_low()
}

/// Returns current pin level
#[inline]
pub fn get_level(&self) -> Level {
pub fn get_level(&mut self) -> Level {
self.pin.get_level()
}
}
Expand Down Expand Up @@ -160,19 +160,19 @@ impl<'d, T: Pin> Output<'d, T> {

/// Is the output pin set as high?
#[inline]
pub fn is_set_high(&self) -> bool {
pub fn is_set_high(&mut self) -> bool {
self.pin.is_set_high()
}

/// Is the output pin set as low?
#[inline]
pub fn is_set_low(&self) -> bool {
pub fn is_set_low(&mut self) -> bool {
self.pin.is_set_low()
}

/// What level output is set to
#[inline]
pub fn get_output_level(&self) -> Level {
pub fn get_output_level(&mut self) -> Level {
self.pin.get_output_level()
}
}
Expand Down Expand Up @@ -277,19 +277,24 @@ impl<'d, T: Pin> Flex<'d, T> {

/// Test if current pin level is high.
#[inline]
pub fn is_high(&self) -> bool {
pub fn is_high(&mut self) -> bool {
!self.is_low()
}

/// Test if current pin level is low.
#[inline]
pub fn is_low(&self) -> bool {
pub fn is_low(&mut self) -> bool {
self.ref_is_low()
}

#[inline]
pub(crate) fn ref_is_low(&self) -> bool {
self.pin.block().in_.read().bits() & (1 << self.pin.pin()) == 0
}

/// Returns current pin level
#[inline]
pub fn get_level(&self) -> Level {
pub fn get_level(&mut self) -> Level {
self.is_high().into()
}

Expand All @@ -316,19 +321,25 @@ impl<'d, T: Pin> Flex<'d, T> {

/// Is the output pin set as high?
#[inline]
pub fn is_set_high(&self) -> bool {
pub fn is_set_high(&mut self) -> bool {
!self.is_set_low()
}

/// Is the output pin set as low?
#[inline]
pub fn is_set_low(&self) -> bool {
pub fn is_set_low(&mut self) -> bool {
self.ref_is_set_low()
}

/// Is the output pin set as low?
#[inline]
pub(crate) fn ref_is_set_low(&self) -> bool {
self.pin.block().out.read().bits() & (1 << self.pin.pin()) == 0
}

/// What level output is set to
#[inline]
pub fn get_output_level(&self) -> Level {
pub fn get_output_level(&mut self) -> Level {
self.is_set_high().into()
}
}
Expand Down Expand Up @@ -498,11 +509,11 @@ mod eh02 {
type Error = Infallible;

fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high())
Ok(!self.pin.ref_is_low())
}

fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self.is_low())
Ok(self.pin.ref_is_low())
}
}

Expand All @@ -520,11 +531,11 @@ mod eh02 {

impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high())
Ok(!self.pin.ref_is_set_low())
}

fn is_set_low(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_low())
Ok(self.pin.ref_is_set_low())
}
}

Expand All @@ -535,11 +546,11 @@ mod eh02 {
type Error = Infallible;

fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_high())
Ok(!self.ref_is_low())
}

fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self.is_low())
Ok(self.ref_is_low())
}
}

Expand All @@ -557,11 +568,11 @@ mod eh02 {

impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_high())
Ok(!self.ref_is_set_low())
}

fn is_set_low(&self) -> Result<bool, Self::Error> {
Ok(self.is_set_low())
Ok(self.ref_is_set_low())
}
}
}
Expand All @@ -571,11 +582,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> {
}

impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> {
fn is_high(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_high())
}

fn is_low(&self) -> Result<bool, Self::Error> {
fn is_low(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_low())
}
}
Expand All @@ -595,11 +606,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
}

impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> {
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_set_high())
}

fn is_set_low(&self) -> Result<bool, Self::Error> {
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_set_low())
}
}
Expand All @@ -612,11 +623,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> {
///
/// If the pin is not in input mode the result is unspecified.
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
fn is_high(&self) -> Result<bool, Self::Error> {
fn is_high(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_high())
}

fn is_low(&self) -> Result<bool, Self::Error> {
fn is_low(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_low())
}
}
Expand All @@ -632,11 +643,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
}

impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
fn is_set_high(&self) -> Result<bool, Self::Error> {
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_set_high())
}

fn is_set_low(&self) -> Result<bool, Self::Error> {
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
Ok(self.is_set_low())
}
}
10 changes: 5 additions & 5 deletions embassy-nrf/src/gpiote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl<'d, C: Channel, T: GpioPin> Drop for OutputChannel<'d, C, T> {

impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> {
/// Create a new GPIOTE output channel driver.
pub fn new(ch: impl Peripheral<P = C> + 'd, pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self {
pub fn new(ch: impl Peripheral<P = C> + 'd, mut pin: Output<'d, T>, polarity: OutputChannelPolarity) -> Self {
into_ref!(ch);
let g = regs();
let num = ch.number();
Expand Down Expand Up @@ -481,11 +481,11 @@ mod eh02 {
type Error = Infallible;

fn is_high(&self) -> Result<bool, Self::Error> {
Ok(self.pin.is_high())
Ok(!self.pin.pin.ref_is_low())
}

fn is_low(&self) -> Result<bool, Self::Error> {
Ok(self.pin.is_low())
Ok(self.pin.pin.ref_is_low())
}
}
}
Expand All @@ -495,11 +495,11 @@ impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::ErrorType for InputCha
}

impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> {
fn is_high(&self) -> Result<bool, Self::Error> {
fn is_high(&mut self) -> Result<bool, Self::Error> {
Ok(self.pin.is_high())
}

fn is_low(&self) -> Result<bool, Self::Error> {
fn is_low(&mut self) -> Result<bool, Self::Error> {
Ok(self.pin.is_low())
}
}
Expand Down
6 changes: 3 additions & 3 deletions embassy-rp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ fixed = "1.23.1"
rp-pac = { version = "6" }

embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
embedded-hal-async = { version = "=1.0.0-rc.2" }
embedded-hal-nb = { version = "=1.0.0-rc.2" }
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.3" }
embedded-hal-async = { version = "=1.0.0-rc.3" }
embedded-hal-nb = { version = "=1.0.0-rc.3" }

pio-proc = {version= "0.2" }
pio = {version= "0.2.1" }
Expand Down
Loading

0 comments on commit d81395f

Please sign in to comment.