Skip to content

Commit

Permalink
Miscellaneous pre-release fixes (esp-rs#883)
Browse files Browse the repository at this point in the history
* Temporarily disable async `SYSTIMER` implementation, remove mention from `CHANGELOG.md`

* Remove a couple files which are not required

* Fix warning for `sha` examples

* Fix warning for non-C3 devices

* s/interrupt_clear/clear_interrupt/
  • Loading branch information
jessebraham authored and katyo committed Nov 6, 2023
1 parent 0304a10 commit 067b640
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 47 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add UART support for splitting into TX and RX (#754)
- Async support for I2S (#801)
- Async support for PARL_IO (#807)
- Implement `embeded_hal_async::delay::DelayUs` trait for `SYSTIMER` alarms (#812)
- This trait is NOT implemented when the `embassy-time-systick` feature is enabled!
- ETM driver, GPIO ETM (#819)
- (G)DMA AES support (#821)
- SYSTIMER ETM functionality (#828)
Expand Down
1 change: 0 additions & 1 deletion esp-hal-common/.gitignore

This file was deleted.

10 changes: 5 additions & 5 deletions esp-hal-common/src/embassy/time_driver_systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl EmbassyTimer {

fn on_interrupt(&self, id: usize) {
critical_section::with(|cs| {
self.interrupt_clear(id);
self.clear_interrupt(id);
self.trigger_alarm(id, cs);
})
}
Expand Down Expand Up @@ -96,11 +96,11 @@ impl EmbassyTimer {
})
}

fn interrupt_clear(&self, id: usize) {
fn clear_interrupt(&self, id: usize) {
match id {
0 => self.alarm0.interrupt_clear(),
1 => self.alarm1.interrupt_clear(),
2 => self.alarm2.interrupt_clear(),
0 => self.alarm0.clear_interrupt(),
1 => self.alarm1.clear_interrupt(),
2 => self.alarm2.clear_interrupt(),
_ => {}
}
}
Expand Down
7 changes: 3 additions & 4 deletions esp-hal-common/src/rtc_cntl/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
use core::{cell::RefCell, time::Duration};

use crate::{
gpio::{RTCPin, RTCPinWithResistors},
Rtc,
};
#[cfg(esp32c3)]
use crate::gpio::RTCPinWithResistors;
use crate::{gpio::RTCPin, Rtc};

#[cfg_attr(esp32, path = "rtc/esp32_sleep.rs")]
#[cfg_attr(esp32s3, path = "rtc/esp32s3_sleep.rs")]
Expand Down
2 changes: 1 addition & 1 deletion esp-hal-common/src/sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! ## Example
//! ```no_run
//! let source_data = "HELLO, ESPRESSIF!".as_bytes();
//! let mut remaining = source_data.clone();
//! let mut remaining = source_data;
//! let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA256);
//!
//! // Short hashes can be created by decreasing the output buffer to the desired
Expand Down
8 changes: 5 additions & 3 deletions esp-hal-common/src/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<T, const CHANNEL: u8> Alarm<T, CHANNEL> {
}
}

pub fn interrupt_clear(&self) {
pub fn clear_interrupt(&self) {
let systimer = unsafe { &*SYSTIMER::ptr() };
match CHANNEL {
0 => systimer.int_clr.write(|w| w.target0_int_clr().set_bit()),
Expand Down Expand Up @@ -272,7 +272,9 @@ impl<T> Alarm<T, 2> {
// interferes with the embassy time driver, which also uses the
// `SYSTIMER` peripheral. Until we come up with a solution, do not
// implement this trait if the `embassy-time-systick` feature is enabled.
#[cfg(all(feature = "async", not(feature = "embassy-time-systick")))]
// #[cfg(all(feature = "async", not(feature = "embassy-time-systick")))]
// HACK: disable `asynch` module *always* until we come up with a solution
#[cfg(not(systimer))]
mod asynch {
use core::{
pin::Pin,
Expand All @@ -295,7 +297,7 @@ mod asynch {

impl<'a, const N: u8> AlarmFuture<'a, N> {
pub(crate) fn new(alarm: &'a Alarm<Periodic, N>) -> Self {
alarm.interrupt_clear();
alarm.clear_interrupt();
alarm.enable_interrupt(true);

Self {
Expand Down
6 changes: 0 additions & 6 deletions esp-riscv-rt/build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion esp32-hal/examples/sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> ! {
let _clocks = ClockControl::boot_defaults(system.clock_control).freeze();

let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes();
let mut remaining = source_data.clone();
let mut remaining = source_data;
let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512);

// Short hashes can be created by decreasing the output buffer to the desired
Expand Down
8 changes: 4 additions & 4 deletions esp32c2-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> ! {

let alarm0 = syst.alarm0.into_periodic();
alarm0.set_period(1u32.secs());
alarm0.interrupt_clear();
alarm0.clear_interrupt();
alarm0.enable_interrupt(true);

let alarm1 = syst.alarm1;
Expand Down Expand Up @@ -85,7 +85,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -97,7 +97,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -109,6 +109,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}
8 changes: 4 additions & 4 deletions esp32c3-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> ! {

let alarm0 = syst.alarm0.into_periodic();
alarm0.set_period(1u32.secs());
alarm0.interrupt_clear();
alarm0.clear_interrupt();
alarm0.enable_interrupt(true);

let alarm1 = syst.alarm1;
Expand Down Expand Up @@ -85,7 +85,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -97,7 +97,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -109,6 +109,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}
8 changes: 4 additions & 4 deletions esp32c6-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> ! {

let alarm0 = syst.alarm0.into_periodic();
alarm0.set_period(1u32.secs());
alarm0.interrupt_clear();
alarm0.clear_interrupt();
alarm0.enable_interrupt(true);

let alarm1 = syst.alarm1;
Expand Down Expand Up @@ -85,7 +85,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -97,7 +97,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -109,6 +109,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}
8 changes: 4 additions & 4 deletions esp32h2-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> ! {

let alarm0 = syst.alarm0.into_periodic();
alarm0.set_period(1u32.secs());
alarm0.interrupt_clear();
alarm0.clear_interrupt();
alarm0.enable_interrupt(true);

let alarm1 = syst.alarm1;
Expand Down Expand Up @@ -85,7 +85,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -97,7 +97,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -109,6 +109,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}
2 changes: 1 addition & 1 deletion esp32s2-hal/examples/sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> ! {
let _clocks = ClockControl::boot_defaults(system.clock_control).freeze();

let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes();
let mut remaining = source_data.clone();
let mut remaining = source_data;
let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512);

// Short hashes can be created by decreasing the output buffer to the desired
Expand Down
6 changes: 3 additions & 3 deletions esp32s2-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -96,7 +96,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -108,6 +108,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}
2 changes: 1 addition & 1 deletion esp32s3-hal/examples/sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> ! {
let _clocks = ClockControl::boot_defaults(system.clock_control).freeze();

let source_data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".as_bytes();
let mut remaining = source_data.clone();
let mut remaining = source_data;
let mut hasher = Sha::new(peripherals.SHA, ShaMode::SHA512);

// Short hashes can be created by decreasing the output buffer to the desired
Expand Down
6 changes: 3 additions & 3 deletions esp32s3-hal/examples/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn SYSTIMER_TARGET0() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -96,7 +96,7 @@ fn SYSTIMER_TARGET1() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

Expand All @@ -108,6 +108,6 @@ fn SYSTIMER_TARGET2() {
.borrow_ref_mut(cs)
.as_mut()
.unwrap()
.interrupt_clear()
.clear_interrupt()
});
}

0 comments on commit 067b640

Please sign in to comment.