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

Update to latest release candidate of embedded-hal{-async,-nb} #994

Merged
merged 6 commits into from
Dec 8, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Simplifed RMT channels and channel creators (#958)
- Reworked construction of I2S driver instances (#983)
- S2 / S3: Don't require GPIO 18 to create a USB peripheral driver instance (#990)
- Updated to latest release candidate (`1.0.0-rc.2`) for `embedded-hal{-async,-nb}` (#994)

### Fixed

Expand Down
26 changes: 13 additions & 13 deletions esp-hal-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ defmt = { version = "=0.3.5", optional = true }
embedded-can = { version = "0.4.1", optional = true }
embedded-dma = "0.2.0"
embedded-hal = { version = "0.2.7", features = ["unproven"] }
embedded-hal-1 = { version = "=1.0.0-rc.1", optional = true, package = "embedded-hal" }
embedded-hal-nb = { version = "=1.0.0-rc.1", optional = true }
embedded-hal-1 = { version = "=1.0.0-rc.2", optional = true, package = "embedded-hal" }
embedded-hal-nb = { version = "=1.0.0-rc.2", optional = true }
embedded-io = { version = "0.6.1", optional = true }
enumset = "1.1.3"
esp-synopsys-usb-otg = { version = "0.3.2", optional = true, features = ["fs", "esp32sx"] }
fugit = "0.3.7"
heapless = "0.8"
log = { version = "0.4.20", optional = true }
nb = "1.1.0"
paste = "1.0.14"
portable-atomic = { version = "1.5.1", default-features = false }
procmacros = { version = "0.7.0", features = ["enum-dispatch", "ram"], package = "esp-hal-procmacros", path = "../esp-hal-procmacros" }
strum = { version = "0.25.0", default-features = false, features = ["derive"] }
void = { version = "1.0.2", default-features = false }
usb-device = { version = "0.2.9", optional = true }
enumset = "1.1.3"
portable-atomic = { version = "1.5.1", default-features = false }
usb-device = { version = "0.3.1", optional = true }

# async
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true }
embedded-io-async = { version = "0.6.0", optional = true }
embassy-executor = { version = "0.3.2", optional = true }
embassy-futures = { version = "0.1.0", optional = true }
embassy-sync = { version = "0.4.0", optional = true }
embassy-time = { version = "0.1.5", optional = true, features = ["nightly"] }
embedded-hal-async = { version = "=1.0.0-rc.2", optional = true }
embedded-io-async = { version = "0.6.1", optional = true }
embassy-executor = { version = "0.4.0", optional = true }
embassy-futures = { version = "0.1.1", optional = true }
embassy-sync = { version = "0.5.0", optional = true }
embassy-time = { version = "0.2.0", optional = true }

# RISC-V
esp-riscv-rt = { version = "0.5.0", optional = true, path = "../esp-riscv-rt" }
esp-riscv-rt = { version = "0.5.0", optional = true, path = "../esp-riscv-rt" }

# Xtensa
xtensa-lx = { version = "0.8.0", optional = true }
Expand All @@ -74,7 +74,7 @@ esp32s3 = { version = "0.23.0", features = ["critical-section"], optional = true

[build-dependencies]
basic-toml = "0.1.7"
serde = { version = "1.0.190", features = ["derive"] }
serde = { version = "1.0.193", features = ["derive"] }

[features]
esp32 = ["xtensa", "esp32/rt", "procmacros/esp32", "xtensa-lx/esp32", "xtensa-lx-rt/esp32"]
Expand Down
28 changes: 21 additions & 7 deletions esp-hal-common/src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ where
{
fn delay_ms(&mut self, ms: T) {
for _ in 0..ms.into() {
self.delay(1000u32);
self.delay_micros(1000u32);
}
}
}
Expand All @@ -49,14 +49,14 @@ where
T: Into<u32>,
{
fn delay_us(&mut self, us: T) {
self.delay(us.into());
self.delay_micros(us.into());
}
}

#[cfg(feature = "eh1")]
impl embedded_hal_1::delay::DelayUs for Delay {
fn delay_us(&mut self, us: u32) {
self.delay(us);
impl embedded_hal_1::delay::DelayNs for Delay {
fn delay_ns(&mut self, ns: u32) {
self.delay_nanos(ns);
}
}

Expand All @@ -77,12 +77,20 @@ mod delay {
}

/// Delay for the specified number of microseconds
pub fn delay(&self, us: u32) {
pub fn delay_micros(&self, us: u32) {
let t0 = SystemTimer::now();
let clocks = us as u64 * (self.freq / HertzU64::MHz(1));

while SystemTimer::now().wrapping_sub(t0) & SystemTimer::BIT_MASK <= clocks {}
}

/// Delay for the specified number of nanoseconds
pub fn delay_nanos(&self, ns: u32) {
let t0 = SystemTimer::now();
let clocks = ns as u64 * (self.freq / HertzU64::MHz(1)) / 1000;

while SystemTimer::now().wrapping_sub(t0) & SystemTimer::BIT_MASK <= clocks {}
}
}
}

Expand All @@ -100,9 +108,15 @@ mod delay {
}

/// Delay for the specified number of microseconds
pub fn delay(&self, us: u32) {
pub fn delay_micros(&self, us: u32) {
let clocks = us as u64 * (self.freq / HertzU64::MHz(1));
xtensa_lx::timer::delay(clocks as u32);
}

/// Delay for the specified number of nanoseconds
pub fn delay_nanos(&self, ns: u32) {
let clocks = ns as u64 * (self.freq / HertzU64::MHz(1)) / 1000;
xtensa_lx::timer::delay(clocks as u32);
}
}
}
3 changes: 2 additions & 1 deletion esp-hal-common/src/mcpwm/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,10 @@ impl<'d, Pin: OutputPin, PWM: PwmPeripheral, const OP: u8, const IS_A: bool>
embedded_hal_1::pwm::SetDutyCycle for &mut PwmPin<'d, Pin, PWM, OP, IS_A>
{
/// Get the max duty of the PwmPin
fn get_max_duty_cycle(&self) -> u16 {
fn max_duty_cycle(&self) -> u16 {
self.get_period()
}

/// Set the max duty of the PwmPin
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), core::convert::Infallible> {
self.set_timestamp(duty);
Expand Down
14 changes: 7 additions & 7 deletions esp32-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ categories = [
]

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
esp-hal-common = { version = "0.13.0", features = ["esp32"], path = "../esp-hal-common" }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false }
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-sync = "0.4.0"
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embassy-sync = "0.5.0"
embedded-graphics = "0.8.1"
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-alloc = "0.3.0"
esp-backtrace = { version = "0.9.0", features = ["esp32", "panic-handler", "exception-handler", "print-uart"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32"], path = "../esp-hal-smartled" }
Expand Down
12 changes: 6 additions & 6 deletions esp32c2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ categories = [

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32c2"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
critical-section = "1.1.2"
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embedded-graphics = "0.8.1"
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-backtrace = { version = "0.9.0", features = ["esp32c2", "panic-handler", "exception-handler", "print-uart"] }
esp-println = { version = "0.7.0", features = ["esp32c2"] }
heapless = "0.8"
Expand All @@ -48,7 +48,7 @@ crypto-bigint = { version = "0.5.3", default-features = false }
elliptic-curve = { version = "0.13.6", default-features = false, features = ["sec1"] }
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
embassy-sync = "0.4.0"
embassy-sync = "0.5.0"

[features]
default = ["rt", "vectored", "xtal-40mhz", "embassy-integrated-timers"]
Expand Down
12 changes: 6 additions & 6 deletions esp32c3-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ categories = [
[dependencies]
cfg-if = "1.0.0"
esp-hal-common = { version = "0.13.0", features = ["esp32c3"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false }
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embedded-can = "0.4.1"
embedded-graphics = "0.8.1"
embedded-hal = { version = "0.2.7", features = ["unproven"] }
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-backtrace = { version = "0.9.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32c3"], path = "../esp-hal-smartled" }
esp-println = { version = "0.7.0", features = ["esp32c3"] }
Expand All @@ -51,7 +51,7 @@ sha2 = { version = "0.10.8", default-features = false }
smart-leds = "0.3.0"
ssd1306 = "0.8.4"
static_cell = { version = "2.0.0", features = ["nightly"] }
embassy-sync = "0.4.0"
embassy-sync = "0.5.0"

[features]
default = ["rt", "vectored", "zero-rtc-bss", "embassy-integrated-timers"]
Expand Down
12 changes: 6 additions & 6 deletions esp32c6-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ categories = [

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32c6"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false}
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embedded-graphics = "0.8.1"
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-can = "0.4.1"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-backtrace = { version = "0.9.0", features = ["esp32c6", "panic-handler", "exception-handler", "print-uart"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32c6"], path = "../esp-hal-smartled" }
esp-println = { version = "0.7.0", features = ["esp32c6"] }
Expand All @@ -54,7 +54,7 @@ hex-literal = "0.4.1"
elliptic-curve = { version = "0.13.6", default-features = false, features = ["sec1"] }
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
embassy-sync = "0.4.0"
embassy-sync = "0.5.0"

[features]
default = ["rt", "vectored", "zero-rtc-bss", "embassy-integrated-timers"]
Expand Down
12 changes: 6 additions & 6 deletions esp32h2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ categories = [

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32h2"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false }
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embedded-graphics = "0.8.1"
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-can = "0.4.1"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-backtrace = { version = "0.9.0", features = ["esp32h2", "panic-handler", "exception-handler", "print-uart"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32h2"], path = "../esp-hal-smartled" }
esp-println = { version = "0.7.0", features = ["esp32h2"] }
Expand All @@ -54,7 +54,7 @@ hex-literal = "0.4.1"
elliptic-curve = { version = "0.13.6", default-features = false, features = ["sec1"] }
p192 = { version = "0.13.0", default-features = false, features = ["arithmetic"] }
p256 = { version = "0.13.2", default-features = false, features = ["arithmetic"] }
embassy-sync = "0.4.0"
embassy-sync = "0.5.0"

[features]
default = ["rt", "vectored", "zero-rtc-bss", "embassy-integrated-timers"]
Expand Down
12 changes: 6 additions & 6 deletions esp32s2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ categories = [

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32s2"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false }
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-sync = "0.4.0"
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embassy-sync = "0.5.0"
embedded-graphics = "0.8.1"
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-alloc = "0.3.0"
esp-backtrace = { version = "0.9.0", features = ["esp32s2", "panic-handler", "print-uart", "exception-handler"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32s2"], path = "../esp-hal-smartled" }
Expand Down
12 changes: 6 additions & 6 deletions esp32s3-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ categories = [

[dependencies]
esp-hal-common = { version = "0.13.0", features = ["esp32s3"], path = "../esp-hal-common" }
embassy-time = { version = "0.1.5", features = ["nightly"], optional = true }
embassy-time = { version = "0.2.0", optional = true }
r0 = { version = "1.0.0", optional = true }

[dev-dependencies]
aes = "0.8.3"
critical-section = "1.1.2"
crypto-bigint = { version = "0.5.3", default-features = false }
embassy-executor = { version = "0.3.2", features = ["nightly"] }
embassy-sync = "0.4.0"
embassy-executor = { version = "0.4.0", features = ["nightly"] }
embassy-sync = "0.5.0"
embedded-graphics = "0.8.1"
embedded-hal = { version = "0.2.7", features = ["unproven"] }
embedded-hal-1 = { version = "=1.0.0-rc.1", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.1"
embedded-hal-1 = { version = "=1.0.0-rc.2", package = "embedded-hal" }
embedded-hal-async = "=1.0.0-rc.2"
embedded-can = "0.4.1"
embedded-io-async = "0.6.0"
embedded-hal-bus = "0.1.0-rc.1"
embedded-hal-bus = "0.1.0-rc.2"
esp-alloc = "0.3.0"
esp-backtrace = { version = "0.9.0", features = ["esp32s3", "panic-handler", "exception-handler", "print-uart"] }
esp-hal-smartled = { version = "0.6.0", features = ["esp32s3"], path = "../esp-hal-smartled" }
Expand Down