New release

This commit is contained in:
ivmarkov 2023-11-02 06:57:16 +00:00
parent 98d064f060
commit ff57aea396
4 changed files with 26 additions and 25 deletions

View File

@ -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/), 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). 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 ## [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 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 * Fix wrong TIMER11 index definition that declared TIMER11 as TIMER10 #331

View File

@ -1,6 +1,6 @@
[package] [package]
name = "esp-idf-hal" name = "esp-idf-hal"
version = "0.42.3" version = "0.42.4"
authors = ["sapir <yasapir@gmail.com>", "Ivan Markov <ivan.markov@gmail.com>"] authors = ["sapir <yasapir@gmail.com>", "Ivan Markov <ivan.markov@gmail.com>"]
edition = "2018" edition = "2018"
resolver = "2" resolver = "2"

View File

@ -1,6 +1,5 @@
use core::sync::atomic::{AtomicU64, Ordering};
use enumset::{EnumSet, EnumSetType}; use enumset::{EnumSet, EnumSetType};
use esp_idf_sys::*; use esp_idf_sys::*;
/// For backwards compatibility /// For backwards compatibility
@ -113,21 +112,20 @@ unsafe fn do_yield_signal(arg: *mut ()) {
*signaled = true *signaled = true
} }
static ISR_YIELDER: AtomicU64 = AtomicU64::new(0); static mut ISR_YIELDER: Option<(unsafe fn(*mut ()), *mut ())> = None;
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
#[inline(always)] #[inline(always)]
#[link_section = ".iram1.interrupt_get_isr_yielder"] #[link_section = ".iram1.interrupt_get_isr_yielder"]
pub(crate) unsafe fn get_isr_yielder() -> Option<(unsafe fn(*mut ()), *mut ())> { pub(crate) unsafe fn get_isr_yielder() -> Option<(unsafe fn(*mut ()), *mut ())> {
if active() { if active() {
let value = ISR_YIELDER.load(Ordering::SeqCst); free(|| {
if value == 0 { if let Some((func, arg)) = unsafe { ISR_YIELDER } {
None Some((func, arg))
} else { } else {
let func: fn(*mut ()) = core::mem::transmute((value >> 32) as usize); None
let arg = (value & 0xffffffff) as usize as *mut (); }
Some((func, arg)) })
}
} else { } else {
None None
} }
@ -151,20 +149,13 @@ pub unsafe fn set_isr_yielder(
yielder: Option<(unsafe fn(*mut ()), *mut ())>, yielder: Option<(unsafe fn(*mut ()), *mut ())>,
) -> Option<(unsafe fn(*mut ()), *mut ())> { ) -> Option<(unsafe fn(*mut ()), *mut ())> {
if active() { if active() {
let value = if let Some((func, arg)) = yielder { free(|| {
((func as usize as u64) << 32) | (arg as usize as u64) let previous = unsafe { ISR_YIELDER };
} else {
0
};
let value = ISR_YIELDER.swap(value, Ordering::SeqCst); unsafe { ISR_YIELDER = yielder };
if value == 0 {
None previous
} else { })
let func: fn(*mut ()) = core::mem::transmute((value >> 32) as usize);
let arg = (value & 0xffffffff) as usize as *mut ();
Some((func, arg))
}
} else { } else {
None None
} }

View File

@ -337,6 +337,7 @@ pub mod config {
pub struct SpiDriver<'d> { pub struct SpiDriver<'d> {
host: u8, host: u8,
max_transfer_size: usize, max_transfer_size: usize,
#[allow(dead_code)]
bus_async_lock: Mutex<EspRawMutex, ()>, bus_async_lock: Mutex<EspRawMutex, ()>,
_p: PhantomData<&'d mut ()>, _p: PhantomData<&'d mut ()>,
} }
@ -926,6 +927,7 @@ where
result result
} }
#[allow(dead_code)]
async fn run_async<'a, 'c, 'p, P, M>( async fn run_async<'a, 'c, 'p, P, M>(
&self, &self,
mut cs_pin: CsCtl<'c, 'p, P, M>, mut cs_pin: CsCtl<'c, 'p, P, M>,
@ -1269,6 +1271,7 @@ where
{ {
driver: UnsafeCell<SpiDeviceDriver<'d, T>>, driver: UnsafeCell<SpiDeviceDriver<'d, T>>,
lock: CriticalSection, lock: CriticalSection,
#[allow(dead_code)]
async_lock: Mutex<EspRawMutex, ()>, async_lock: Mutex<EspRawMutex, ()>,
} }
@ -1422,6 +1425,7 @@ where
.lock(move |device| device.run(cs_pin, operations)) .lock(move |device| device.run(cs_pin, operations))
} }
#[allow(dead_code)]
async fn run_async<'a>( async fn run_async<'a>(
&mut self, &mut self,
operations: impl Iterator<Item = Operation<'a, u8>> + 'a, operations: impl Iterator<Item = Operation<'a, u8>> + 'a,
@ -1799,6 +1803,7 @@ fn spi_transmit(
Ok(()) Ok(())
} }
#[allow(dead_code)]
async fn spi_transmit_async( async fn spi_transmit_async(
handle: spi_device_handle_t, handle: spi_device_handle_t,
transactions: impl Iterator<Item = spi_transaction_t>, transactions: impl Iterator<Item = spi_transaction_t>,
@ -1902,6 +1907,7 @@ fn data_mode_to_u8(data_mode: config::Mode) -> u8 {
| ((data_mode.phase == config::Phase::CaptureOnSecondTransition) as u8) | ((data_mode.phase == config::Phase::CaptureOnSecondTransition) as u8)
} }
#[allow(dead_code)]
async fn with_completion<F, D>(fut: F, dtor: D) -> F::Output async fn with_completion<F, D>(fut: F, dtor: D) -> F::Output
where where
F: Future, F: Future,