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/),
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

View File

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

View File

@ -1,6 +1,5 @@
use core::sync::atomic::{AtomicU64, Ordering};
use enumset::{EnumSet, EnumSetType};
use esp_idf_sys::*;
/// For backwards compatibility
@ -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
}
@ -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
};
free(|| {
let previous = unsafe { ISR_YIELDER };
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))
}
unsafe { ISR_YIELDER = yielder };
previous
})
} else {
None
}

View File

@ -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 ()>,
}
@ -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>,
@ -1269,6 +1271,7 @@ where
{
driver: UnsafeCell<SpiDeviceDriver<'d, T>>,
lock: CriticalSection,
#[allow(dead_code)]
async_lock: Mutex<EspRawMutex, ()>,
}
@ -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,
@ -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>,
@ -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,