Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Changes for embedded-hal alpha6 #10

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ default = [ "std", "util", "driver-pal/hal-cp2130", "driver-pal/hal-linux" ]


[dependencies]
embedded-hal = "1.0.0-alpha.5"
embedded-hal = { version= "=1.0.0-alpha.6" }

radio = "0.10.0"
modular-bitfield = "0.11.2"
log = "0.4.14"
Expand All @@ -26,7 +27,7 @@ humantime = { version = "2.1.0", optional = true }
tracing = { version = "0.1.25", optional = true }
tracing-subscriber = { version = "0.2.16", optional = true }
serde = { version = "1.0.130", optional = true }
defmt = { version = "0.2.3", optional = true }
defmt = { version = "0.3.0", optional = true }
anyhow = { version = "1.0.44", optional = true }

[dev-dependencies]
Expand Down
10 changes: 7 additions & 3 deletions src/base.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use core::fmt::Debug;

use embedded_hal::{delay::blocking::*, digital::blocking::*, spi::blocking::*};

#[cfg(not(feature="defmt"))]
use log::{trace};
#[cfg(feature="defmt")]
use defmt::trace;

use crate::{Error};

Expand Down Expand Up @@ -44,7 +48,7 @@ where
Rst: OutputPin<Error = PinErr>,
//SlpTr: OutputPin<Error = PinErr>,
//Irq: InputPin<Error = PinErr>,
Delay: DelayMs<u32, Error = DelayErr> + DelayUs<u32, Error = DelayErr>,
Delay: DelayUs<Error = DelayErr>,
SpiErr: Debug,
PinErr: Debug,
DelayErr: Debug,
Expand Down Expand Up @@ -72,7 +76,7 @@ where
cmd: &[u8],
data: &mut [u8],
) -> Result<(), Error<SpiErr, PinErr, DelayErr>> {
let mut t = [Operation::Write(&cmd), Operation::Transfer(data)];
let mut t = [Operation::Write(&cmd), Operation::TransferInplace(data)];

self.cs.set_low().map_err(Error::Pin)?;

Expand All @@ -86,7 +90,7 @@ where
}

fn reset(&mut self) -> Result<(), Error<SpiErr, PinErr, DelayErr>> {
// Deassert CS pin (active high)
// Deassert CS pin (active low)
self.cs.set_high().map_err(Error::Pin)?;

// Assert reset pin (active low)
Expand Down
Loading