Skip to content

Commit

Permalink
New release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 27, 2023
1 parent 64d4111 commit 6ecb09b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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.2] - 2023-10-28
* Support for latest ESP IDF 5.2 dev (master)

## [0.42.1] - 2023-10-18
* Fix ambiguous name error #325 - a compilation issue when the NimBLE component is enabled in `esp-idf-sys`
* Fix compilation issues of the I2S driver for esp32h2 and esp32c2
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "esp-idf-hal"
version = "0.42.1"
version = "0.42.2"
authors = ["sapir <[email protected]>", "Ivan Markov <[email protected]>"]
edition = "2018"
resolver = "2"
Expand Down Expand Up @@ -42,7 +42,7 @@ embedded-hal-nb = "=1.0.0-rc.1"
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true }
embedded-io = "0.6"
embedded-io-async = { version = "0.6", optional = true }
esp-idf-sys = { version = "0.33.3", optional = true, default-features = false, features = ["native"] }
esp-idf-sys = { version = "0.33.5", optional = true, default-features = false, features = ["native"] }
critical-section = { version = "1.1.1", optional = true }
heapless = "0.7"
num_enum = { version = "0.7", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions src/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ impl<'d> CanDriver<'d> {
) -> Result<Self, EspError> {
crate::into_ref!(can, tx, rx);

#[allow(clippy::needless_update)]
let general_config = twai_general_config_t {
mode: config.mode.into(),
tx_io: tx.pin(),
Expand All @@ -398,6 +399,7 @@ impl<'d> CanDriver<'d> {
alerts_enabled: config.alerts.as_repr(),
clkout_divider: 0,
intr_flags: InterruptType::to_native(config.intr_flags) as _,
..Default::default()
};

let timing_config = config.timing.into();
Expand Down
2 changes: 2 additions & 0 deletions src/i2s/pdm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ pub(super) mod config {
))]
#[inline(always)]
pub(super) fn as_sdk(&self) -> i2s_pdm_rx_clk_config_t {
#[allow(clippy::needless_update)]
i2s_pdm_rx_clk_config_t {
sample_rate_hz: self.sample_rate_hz,
clk_src: self.clk_src.as_sdk(),
mclk_multiple: self.mclk_multiple.as_sdk(),
dn_sample_mode: self.downsample_mode.as_sdk(),
..Default::default()
}
}
}
Expand Down
40 changes: 34 additions & 6 deletions src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ use esp_idf_sys::*;
use crate::cpu::Core;
use crate::interrupt;

#[cfg(not(any(
esp_idf_version_major = "4",
esp_idf_version = "5.0",
esp_idf_version = "5.1"
)))]
const NO_AFFINITY: core::ffi::c_int = -1;

#[cfg(any(
esp_idf_version_major = "4",
esp_idf_version = "5.0",
esp_idf_version = "5.1"
))]
const NO_AFFINITY: core::ffi::c_uint = tskNO_AFFINITY;

/// Creates a FreeRTOS task.
///
/// This API is to be used only for niche use cases like where the `std` feature is not enabled, or one absolutely
Expand Down Expand Up @@ -46,7 +60,7 @@ pub unsafe fn create(
task_arg,
priority as _,
&mut task,
pin_to_core.map(Into::into).unwrap_or(tskNO_AFFINITY as _),
pin_to_core.map(Into::into).unwrap_or(NO_AFFINITY as _),
);

if created == 0 {
Expand Down Expand Up @@ -218,9 +232,24 @@ pub fn get_idle_task(core: crate::cpu::Core) -> TaskHandle_t {
}

#[cfg(not(any(esp32c3, esp32c2, esp32h2, esp32c5, esp32c6)))]
#[cfg(any(
esp_idf_version_major = "4",
esp_idf_version = "5.0",
esp_idf_version = "5.1"
))]
unsafe {
xTaskGetIdleTaskHandleForCPU(core as u32)
}

#[cfg(not(any(esp32c3, esp32c2, esp32h2, esp32c5, esp32c6)))]
#[cfg(not(any(
esp_idf_version_major = "4",
esp_idf_version = "5.0",
esp_idf_version = "5.1"
)))]
unsafe {
xTaskGetIdleTaskHandleForCore(core as i32)
}
}

/// Executes the supplied future on the current thread, thus blocking it until the future becomes ready.
Expand Down Expand Up @@ -257,6 +286,8 @@ pub mod thread {

use esp_idf_sys::*;

use super::NO_AFFINITY;

use crate::cpu::Core;

#[derive(Debug)]
Expand Down Expand Up @@ -294,10 +325,7 @@ pub mod thread {
stack_size: conf.stack_size as _,
prio: conf.priority as _,
inherit_cfg: conf.inherit,
pin_to_core: conf
.pin_to_core
.map(Into::into)
.unwrap_or(tskNO_AFFINITY as _),
pin_to_core: conf.pin_to_core.map(Into::into).unwrap_or(NO_AFFINITY as _),
}
}
}
Expand All @@ -318,7 +346,7 @@ pub mod thread {
stack_size: conf.stack_size as _,
priority: conf.prio as _,
inherit: conf.inherit_cfg,
pin_to_core: if conf.pin_to_core == tskNO_AFFINITY as _ {
pin_to_core: if conf.pin_to_core == NO_AFFINITY as _ {
None
} else {
Some(conf.pin_to_core.into())
Expand Down

0 comments on commit 6ecb09b

Please sign in to comment.