Update embedded-hal to 1.0.0-rc.3
This commit is contained in:
parent
2c3d399220
commit
d81395fab3
41 changed files with 238 additions and 203 deletions
|
@ -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]
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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"] }
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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" }
|
||||
|
||||
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -105,18 +105,18 @@ impl<'d, T: Pin> Input<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
self.pin.is_high()
|
||||
}
|
||||
|
||||
#[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()
|
||||
}
|
||||
|
||||
|
@ -357,19 +357,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()
|
||||
}
|
||||
|
||||
|
@ -434,19 +434,19 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
|
|||
|
||||
/// Is the output level high?
|
||||
#[inline]
|
||||
pub fn is_set_high(&self) -> bool {
|
||||
pub fn is_set_high(&mut self) -> bool {
|
||||
!self.is_set_low()
|
||||
}
|
||||
|
||||
/// Is the output level low?
|
||||
#[inline]
|
||||
pub fn is_set_low(&self) -> bool {
|
||||
pub fn is_set_low(&mut self) -> bool {
|
||||
self.pin.is_set_as_output()
|
||||
}
|
||||
|
||||
/// 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()
|
||||
}
|
||||
|
||||
|
@ -457,18 +457,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
self.pin.is_high()
|
||||
}
|
||||
|
||||
#[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.is_high().into()
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,12 @@ impl<'d, T: Pin> Flex<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn is_set_as_output(&self) -> bool {
|
||||
pub fn is_set_as_output(&mut self) -> bool {
|
||||
self.ref_is_set_as_output()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn ref_is_set_as_output(&self) -> bool {
|
||||
(self.pin.sio_oe().value().read() & self.bit()) != 0
|
||||
}
|
||||
|
||||
|
@ -600,18 +605,23 @@ impl<'d, T: Pin> Flex<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
!self.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.sio_in().read() & self.bit() == 0
|
||||
}
|
||||
|
||||
/// Returns current pin level
|
||||
#[inline]
|
||||
pub fn get_level(&self) -> Level {
|
||||
pub fn get_level(&mut self) -> Level {
|
||||
self.is_high().into()
|
||||
}
|
||||
|
||||
|
@ -638,19 +648,24 @@ impl<'d, T: Pin> Flex<'d, T> {
|
|||
|
||||
/// Is the output level high?
|
||||
#[inline]
|
||||
pub fn is_set_high(&self) -> bool {
|
||||
pub fn is_set_high(&mut self) -> bool {
|
||||
!self.is_set_low()
|
||||
}
|
||||
|
||||
/// Is the output level low?
|
||||
#[inline]
|
||||
pub fn is_set_low(&self) -> bool {
|
||||
pub fn is_set_low(&mut self) -> bool {
|
||||
self.ref_is_set_low()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn ref_is_set_low(&self) -> bool {
|
||||
(self.pin.sio_out().value().read() & self.bit()) == 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()
|
||||
}
|
||||
|
||||
|
@ -912,11 +927,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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -934,11 +949,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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -954,11 +969,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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -978,11 +993,11 @@ mod eh02 {
|
|||
|
||||
impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
Ok(!self.pin.ref_is_set_as_output())
|
||||
}
|
||||
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
Ok(self.pin.ref_is_set_as_output())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -998,11 +1013,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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1020,11 +1035,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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1042,11 +1057,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())
|
||||
}
|
||||
}
|
||||
|
@ -1066,11 +1081,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())
|
||||
}
|
||||
}
|
||||
|
@ -1096,11 +1111,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> {
|
|||
}
|
||||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'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())
|
||||
}
|
||||
}
|
||||
|
@ -1112,11 +1127,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai
|
|||
}
|
||||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'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())
|
||||
}
|
||||
}
|
||||
|
@ -1126,11 +1141,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> {
|
|||
}
|
||||
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
@ -1146,11 +1161,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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver" }
|
|||
embassy-executor = { version = "0.4.0", path = "../embassy-executor", 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-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" }
|
||||
|
||||
embedded-storage = "0.3.1"
|
||||
embedded-storage-async = { version = "0.4.1" }
|
||||
|
|
|
@ -97,15 +97,15 @@ impl<'d, T: GpioPin> ExtiInput<'d, T> {
|
|||
Self { pin }
|
||||
}
|
||||
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
self.pin.is_high()
|
||||
}
|
||||
|
||||
pub fn is_low(&self) -> bool {
|
||||
pub fn is_low(&mut self) -> bool {
|
||||
self.pin.is_low()
|
||||
}
|
||||
|
||||
pub fn get_level(&self) -> Level {
|
||||
pub fn get_level(&mut self) -> Level {
|
||||
self.pin.get_level()
|
||||
}
|
||||
|
||||
|
@ -142,11 +142,11 @@ impl<'d, T: GpioPin> embedded_hal_02::digital::v2::InputPin for ExtiInput<'d, T>
|
|||
type Error = Infallible;
|
||||
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
Ok(!self.pin.pin.ref_is_low())
|
||||
}
|
||||
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
Ok(self.pin.pin.ref_is_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,11 +155,11 @@ impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> {
|
|||
}
|
||||
|
||||
impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,36 +142,46 @@ impl<'d, T: Pin> Flex<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
!self.is_low()
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
!self.ref_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 {
|
||||
let state = self.pin.block().idr().read().idr(self.pin.pin() as _);
|
||||
state == vals::Idr::LOW
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_level(&self) -> Level {
|
||||
pub fn get_level(&mut self) -> Level {
|
||||
self.is_high().into()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_set_high(&self) -> bool {
|
||||
!self.is_set_low()
|
||||
pub fn is_set_high(&mut self) -> bool {
|
||||
!self.ref_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()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn ref_is_set_low(&self) -> bool {
|
||||
let state = self.pin.block().odr().read().odr(self.pin.pin() as _);
|
||||
state == vals::Odr::LOW
|
||||
}
|
||||
|
||||
/// 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()
|
||||
}
|
||||
|
||||
|
@ -310,17 +320,17 @@ impl<'d, T: Pin> Input<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
self.pin.is_high()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_low(&self) -> bool {
|
||||
pub fn is_low(&mut self) -> bool {
|
||||
self.pin.is_low()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_level(&self) -> Level {
|
||||
pub fn get_level(&mut self) -> Level {
|
||||
self.pin.get_level()
|
||||
}
|
||||
}
|
||||
|
@ -399,19 +409,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()
|
||||
}
|
||||
|
||||
|
@ -453,18 +463,18 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_high(&self) -> bool {
|
||||
pub fn is_high(&mut self) -> bool {
|
||||
!self.pin.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()
|
||||
}
|
||||
|
||||
|
@ -488,19 +498,19 @@ impl<'d, T: Pin> OutputOpenDrain<'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()
|
||||
}
|
||||
|
||||
|
@ -777,12 +787,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Input<'d, T> {
|
|||
|
||||
#[inline]
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
Ok(!self.pin.ref_is_low())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
Ok(self.pin.ref_is_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -805,13 +815,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Output<'d, T> {
|
|||
impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
Ok(!self.pin.ref_is_set_low())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
Ok(self.pin.ref_is_set_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -843,13 +853,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d,
|
|||
impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
Ok(!self.pin.ref_is_set_low())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
Ok(self.pin.ref_is_set_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -867,12 +877,12 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Flex<'d, T> {
|
|||
|
||||
#[inline]
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
Ok(!self.ref_is_low())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
Ok(self.ref_is_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,13 +905,13 @@ impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Flex<'d, T> {
|
|||
impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
Ok(!self.ref_is_set_low())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
Ok(self.ref_is_set_low())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -920,12 +930,12 @@ 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> {
|
||||
#[inline]
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
}
|
||||
}
|
||||
|
@ -948,13 +958,13 @@ 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> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
}
|
||||
}
|
||||
|
@ -972,12 +982,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d, T> {
|
|||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> {
|
||||
#[inline]
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
}
|
||||
}
|
||||
|
@ -996,13 +1006,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> {
|
|||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
}
|
||||
}
|
||||
|
@ -1016,12 +1026,12 @@ impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrai
|
|||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
|
||||
#[inline]
|
||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_high())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_low())
|
||||
}
|
||||
}
|
||||
|
@ -1051,13 +1061,13 @@ impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> {
|
|||
|
||||
impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
|
||||
#[inline]
|
||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_high())
|
||||
}
|
||||
|
||||
/// Is the output pin set as low?
|
||||
#[inline]
|
||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
|
||||
Ok(self.is_set_low())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## 0.1.3 - 2023-08-28
|
||||
|
||||
- Update `embedded-hal-async` to `1.0.0-rc.2`
|
||||
- Update `embedded-hal v1` to `1.0.0-rc.2`
|
||||
- Update `embedded-hal-async` to `1.0.0-rc.3`
|
||||
- Update `embedded-hal v1` to `1.0.0-rc.3`
|
||||
|
||||
## 0.1.2 - 2023-07-05
|
||||
|
||||
|
|
|
@ -235,8 +235,8 @@ defmt = { version = "0.3", optional = true }
|
|||
log = { version = "0.4.14", optional = true }
|
||||
|
||||
embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
|
||||
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" }
|
||||
|
||||
futures-util = { version = "0.3.17", default-features = false }
|
||||
critical-section = "1.1"
|
||||
|
|
|
@ -36,9 +36,9 @@ rand = { version = "0.8.4", default-features = false }
|
|||
embedded-storage = "0.3.1"
|
||||
usbd-hid = "0.6.0"
|
||||
serde = { version = "1.0.136", default-features = false }
|
||||
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 = { 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"] }
|
||||
num-integer = { version = "0.1.45", default-features = false }
|
||||
microfft = "0.5.0"
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ smart-leds = "0.3.0"
|
|||
heapless = "0.8"
|
||||
usbd-hid = "0.6.1"
|
||||
|
||||
embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" }
|
||||
embedded-hal-async = "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 = "1.0.0-rc.3"
|
||||
embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] }
|
||||
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
||||
embedded-storage = { version = "0.3" }
|
||||
static_cell = { version = "2", features = ["nightly"]}
|
||||
|
|
|
@ -17,7 +17,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Use PIN_28, Pin34 on J0 for RP Pico, as a input.
|
||||
// You need to add your own button.
|
||||
let button = Input::new(p.PIN_28, Pull::Up);
|
||||
let mut button = Input::new(p.PIN_28, Pull::Up);
|
||||
|
||||
loop {
|
||||
if button.is_high() {
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Up);
|
||||
let mut button = Input::new(p.PC13, Pull::Up);
|
||||
|
||||
loop {
|
||||
if button.is_high() {
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PA0, Pull::Down);
|
||||
let mut button = Input::new(p.PA0, Pull::Down);
|
||||
let mut led1 = Output::new(p.PE9, Level::High, Speed::Low);
|
||||
let mut led2 = Output::new(p.PE15, Level::High, Speed::Low);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Down);
|
||||
let mut button = Input::new(p.PC13, Pull::Down);
|
||||
let mut led1 = Output::new(p.PB0, Level::High, Speed::Low);
|
||||
let _led2 = Output::new(p.PB7, Level::High, Speed::Low);
|
||||
let mut led3 = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Down);
|
||||
let mut button = Input::new(p.PC13, Pull::Down);
|
||||
let mut led1 = Output::new(p.PB0, Level::High, Speed::Low);
|
||||
let _led2 = Output::new(p.PB7, Level::High, Speed::Low);
|
||||
let mut led3 = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Up);
|
||||
let mut button = Input::new(p.PC13, Pull::Up);
|
||||
|
||||
loop {
|
||||
if button.is_high() {
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Down);
|
||||
let mut button = Input::new(p.PC13, Pull::Down);
|
||||
|
||||
loop {
|
||||
if button.is_high() {
|
||||
|
|
|
@ -19,8 +19,8 @@ defmt-rtt = "0.4"
|
|||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
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-async = { version = "0.6.1" }
|
||||
embedded-nal-async = { version = "0.7.1" }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
|
|
|
@ -19,8 +19,8 @@ defmt-rtt = "0.4"
|
|||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
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-nal-async = { version = "0.7.1" }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
|
|
|
@ -12,7 +12,7 @@ async fn main(_spawner: Spawner) {
|
|||
let p = embassy_stm32::init(Default::default());
|
||||
info!("Hello World!");
|
||||
|
||||
let button = Input::new(p.PB2, Pull::Up);
|
||||
let mut button = Input::new(p.PB2, Pull::Up);
|
||||
let mut led1 = Output::new(p.PA5, Level::High, Speed::Low);
|
||||
let mut led2 = Output::new(p.PB5, Level::High, Speed::Low);
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ defmt-rtt = "0.4"
|
|||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
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"] }
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
heapless = { version = "0.8", default-features = false }
|
||||
|
|
|
@ -12,7 +12,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PC13, Pull::Up);
|
||||
let mut button = Input::new(p.PC13, Pull::Up);
|
||||
|
||||
loop {
|
||||
if button.is_high() {
|
||||
|
|
|
@ -114,8 +114,8 @@ async fn main(spawner: Spawner) {
|
|||
let led_uc4_blue = Output::new(dp.PG15, Level::High, Speed::Low);
|
||||
|
||||
// Read the uc_cfg switches
|
||||
let uc_cfg0 = Input::new(dp.PB2, Pull::None);
|
||||
let uc_cfg1 = Input::new(dp.PF11, Pull::None);
|
||||
let mut uc_cfg0 = Input::new(dp.PB2, Pull::None);
|
||||
let mut uc_cfg1 = Input::new(dp.PF11, Pull::None);
|
||||
let _uc_cfg2 = Input::new(dp.PG6, Pull::None);
|
||||
let _uc_cfg3 = Input::new(dp.PG11, Pull::None);
|
||||
|
||||
|
@ -133,8 +133,8 @@ async fn main(spawner: Spawner) {
|
|||
|
||||
// Setup IO and SPI for the SPE chip
|
||||
let spe_reset_n = Output::new(dp.PC7, Level::Low, Speed::Low);
|
||||
let spe_cfg0 = Input::new(dp.PC8, Pull::None);
|
||||
let spe_cfg1 = Input::new(dp.PC9, Pull::None);
|
||||
let mut spe_cfg0 = Input::new(dp.PC8, Pull::None);
|
||||
let mut spe_cfg1 = Input::new(dp.PC9, Pull::None);
|
||||
let _spe_ts_capt = Output::new(dp.PC6, Level::Low, Speed::Low);
|
||||
|
||||
let spe_int = Input::new(dp.PB11, Pull::None);
|
||||
|
|
|
@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) {
|
|||
let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh);
|
||||
let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh);
|
||||
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);
|
||||
let ready = Input::new(p.PE1, Pull::Up);
|
||||
let mut ready = Input::new(p.PE1, Pull::Up);
|
||||
|
||||
cortex_m::asm::delay(100_000);
|
||||
reset.set_high();
|
||||
|
|
|
@ -25,7 +25,7 @@ async fn main(_spawner: Spawner) {
|
|||
let _wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh);
|
||||
let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh);
|
||||
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);
|
||||
let ready = Input::new(p.PE1, Pull::Up);
|
||||
let mut ready = Input::new(p.PE1, Pull::Up);
|
||||
|
||||
cortex_m::asm::delay(100_000);
|
||||
reset.set_high();
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() -> ! {
|
|||
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
|
||||
let button = Input::new(p.PA0, Pull::Up);
|
||||
let mut button = Input::new(p.PA0, Pull::Up);
|
||||
let mut led1 = Output::new(p.PB15, Level::High, Speed::Low);
|
||||
let mut led2 = Output::new(p.PB9, Level::High, Speed::Low);
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
|
|||
embassy-net = { version = "0.2.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] }
|
||||
embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] }
|
||||
embassy-net-enc28j60 = { version = "0.1.0", path = "../../embassy-net-enc28j60", features = ["defmt"] }
|
||||
embedded-hal-async = { version = "1.0.0-rc.2" }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.2", features = ["async"] }
|
||||
embedded-hal-async = { version = "1.0.0-rc.3" }
|
||||
embedded-hal-bus = { version = "0.1.0-rc.3", features = ["async"] }
|
||||
static_cell = { version = "2", features = [ "nightly" ] }
|
||||
perf-client = { path = "../perf-client" }
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ defmt-rtt = "0.4"
|
|||
cortex-m = { version = "0.7.6" }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
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"] }
|
||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||
embedded-io-async = { version = "0.6.1" }
|
||||
|
|
|
@ -16,10 +16,10 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test initial output
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::None);
|
||||
let mut b = Input::new(&mut b, Pull::None);
|
||||
|
||||
{
|
||||
let a = Output::new(&mut a, Level::Low);
|
||||
let mut a = Output::new(&mut a, Level::Low);
|
||||
delay();
|
||||
assert!(b.is_low());
|
||||
assert!(!b.is_high());
|
||||
|
@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input no pull
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::None);
|
||||
let mut b = Input::new(&mut b, Pull::None);
|
||||
// no pull, the status is undefined
|
||||
|
||||
let mut a = Output::new(&mut a, Level::Low);
|
||||
|
@ -77,7 +77,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input pulldown
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::Down);
|
||||
let mut b = Input::new(&mut b, Pull::Down);
|
||||
delay();
|
||||
assert!(b.is_low());
|
||||
|
||||
|
@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input pullup
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::Up);
|
||||
let mut b = Input::new(&mut b, Pull::Up);
|
||||
delay();
|
||||
assert!(b.is_high());
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test output from A
|
||||
{
|
||||
let pin1 = Input::new(&mut p9, Pull::None);
|
||||
let mut pin1 = Input::new(&mut p9, Pull::None);
|
||||
let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone());
|
||||
Timer::after_millis(1).await;
|
||||
assert_eq!(pin1.is_low(), invert_a);
|
||||
|
@ -59,7 +59,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test output from B
|
||||
{
|
||||
let pin2 = Input::new(&mut p11, Pull::None);
|
||||
let mut pin2 = Input::new(&mut p11, Pull::None);
|
||||
let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone());
|
||||
Timer::after_millis(1).await;
|
||||
assert_ne!(pin2.is_low(), invert_a);
|
||||
|
@ -73,8 +73,8 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test output from A+B
|
||||
{
|
||||
let pin1 = Input::new(&mut p9, Pull::None);
|
||||
let pin2 = Input::new(&mut p11, Pull::None);
|
||||
let mut pin1 = Input::new(&mut p9, Pull::None);
|
||||
let mut pin2 = Input::new(&mut p11, Pull::None);
|
||||
let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone());
|
||||
Timer::after_millis(1).await;
|
||||
assert_eq!(pin1.is_low(), invert_a);
|
||||
|
|
|
@ -63,8 +63,8 @@ defmt-rtt = "0.4"
|
|||
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7.0"
|
||||
embedded-hal = "0.2.6"
|
||||
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" }
|
||||
micromath = "2.0.0"
|
||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||
rand_core = { version = "0.6", default-features = false }
|
||||
|
|
|
@ -20,10 +20,10 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test initial output
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::None);
|
||||
let mut b = Input::new(&mut b, Pull::None);
|
||||
|
||||
{
|
||||
let a = Output::new(&mut a, Level::Low, Speed::Low);
|
||||
let mut a = Output::new(&mut a, Level::Low, Speed::Low);
|
||||
delay();
|
||||
assert!(b.is_low());
|
||||
assert!(!b.is_high());
|
||||
|
@ -68,7 +68,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input no pull
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::None);
|
||||
let mut b = Input::new(&mut b, Pull::None);
|
||||
// no pull, the status is undefined
|
||||
|
||||
let mut a = Output::new(&mut a, Level::Low, Speed::Low);
|
||||
|
@ -81,7 +81,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input pulldown
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::Down);
|
||||
let mut b = Input::new(&mut b, Pull::Down);
|
||||
delay();
|
||||
assert!(b.is_low());
|
||||
|
||||
|
@ -95,7 +95,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test input pullup
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::Up);
|
||||
let mut b = Input::new(&mut b, Pull::Up);
|
||||
delay();
|
||||
assert!(b.is_high());
|
||||
|
||||
|
@ -109,7 +109,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
// Test output open drain
|
||||
{
|
||||
let b = Input::new(&mut b, Pull::Down);
|
||||
let mut b = Input::new(&mut b, Pull::Down);
|
||||
// no pull, the status is undefined
|
||||
|
||||
let mut a = OutputOpenDrain::new(&mut a, Level::Low, Speed::Low, Pull::None);
|
||||
|
|
Loading…
Reference in a new issue