Skip to content

Commit

Permalink
New release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Nov 2, 2023
1 parent 98d064f commit ff57aea
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.42.4] - 2023-11-02
* Remove dependency on `AtomicU64` which is no longer supported by the upstream `*-espidf` targets
* Fix some Clippy warnings in the `spi` driver

## [0.42.3] - 2023-10-29
* Fix Timer array index bug #331 - prevented the use of TIMER10 on devices that support only 2 Timers
* Fix wrong TIMER11 index definition that declared TIMER11 as TIMER10 #331
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "esp-idf-hal"
version = "0.42.3"
version = "0.42.4"
authors = ["sapir <[email protected]>", "Ivan Markov <[email protected]>"]
edition = "2018"
resolver = "2"
Expand Down
41 changes: 16 additions & 25 deletions src/interrupt.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::sync::atomic::{AtomicU64, Ordering};

use enumset::{EnumSet, EnumSetType};

use esp_idf_sys::*;

/// For backwards compatibility
Expand Down Expand Up @@ -113,21 +112,20 @@ unsafe fn do_yield_signal(arg: *mut ()) {
*signaled = true
}

static ISR_YIELDER: AtomicU64 = AtomicU64::new(0);
static mut ISR_YIELDER: Option<(unsafe fn(*mut ()), *mut ())> = None;

#[allow(clippy::type_complexity)]
#[inline(always)]
#[link_section = ".iram1.interrupt_get_isr_yielder"]
pub(crate) unsafe fn get_isr_yielder() -> Option<(unsafe fn(*mut ()), *mut ())> {
if active() {
let value = ISR_YIELDER.load(Ordering::SeqCst);
if value == 0 {
None
} else {
let func: fn(*mut ()) = core::mem::transmute((value >> 32) as usize);
let arg = (value & 0xffffffff) as usize as *mut ();
Some((func, arg))
}
free(|| {
if let Some((func, arg)) = unsafe { ISR_YIELDER } {
Some((func, arg))
} else {
None
}
})
} else {
None
}
Expand All @@ -151,20 +149,13 @@ pub unsafe fn set_isr_yielder(
yielder: Option<(unsafe fn(*mut ()), *mut ())>,
) -> Option<(unsafe fn(*mut ()), *mut ())> {
if active() {
let value = if let Some((func, arg)) = yielder {
((func as usize as u64) << 32) | (arg as usize as u64)
} else {
0
};

let value = ISR_YIELDER.swap(value, Ordering::SeqCst);
if value == 0 {
None
} else {
let func: fn(*mut ()) = core::mem::transmute((value >> 32) as usize);
let arg = (value & 0xffffffff) as usize as *mut ();
Some((func, arg))
}
free(|| {
let previous = unsafe { ISR_YIELDER };

unsafe { ISR_YIELDER = yielder };

previous
})
} else {
None
}
Expand Down
6 changes: 6 additions & 0 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ pub mod config {
pub struct SpiDriver<'d> {
host: u8,
max_transfer_size: usize,
#[allow(dead_code)]
bus_async_lock: Mutex<EspRawMutex, ()>,
_p: PhantomData<&'d mut ()>,
}
Expand Down Expand Up @@ -926,6 +927,7 @@ where
result
}

#[allow(dead_code)]
async fn run_async<'a, 'c, 'p, P, M>(
&self,
mut cs_pin: CsCtl<'c, 'p, P, M>,
Expand Down Expand Up @@ -1269,6 +1271,7 @@ where
{
driver: UnsafeCell<SpiDeviceDriver<'d, T>>,
lock: CriticalSection,
#[allow(dead_code)]
async_lock: Mutex<EspRawMutex, ()>,
}

Expand Down Expand Up @@ -1422,6 +1425,7 @@ where
.lock(move |device| device.run(cs_pin, operations))
}

#[allow(dead_code)]
async fn run_async<'a>(
&mut self,
operations: impl Iterator<Item = Operation<'a, u8>> + 'a,
Expand Down Expand Up @@ -1799,6 +1803,7 @@ fn spi_transmit(
Ok(())
}

#[allow(dead_code)]
async fn spi_transmit_async(
handle: spi_device_handle_t,
transactions: impl Iterator<Item = spi_transaction_t>,
Expand Down Expand Up @@ -1902,6 +1907,7 @@ fn data_mode_to_u8(data_mode: config::Mode) -> u8 {
| ((data_mode.phase == config::Phase::CaptureOnSecondTransition) as u8)
}

#[allow(dead_code)]
async fn with_completion<F, D>(fut: F, dtor: D) -> F::Output
where
F: Future,
Expand Down

0 comments on commit ff57aea

Please sign in to comment.