Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix defmt compatibility #2017

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ macro_rules! dma_circular_buffers_chunk_size {
macro_rules! dma_descriptors_chunk_size {
($tx_size:expr, $rx_size:expr, $chunk_size:expr) => {{
// these will check for size at compile time
const _: () = assert!($chunk_size <= 4092, "chunk size must be <= 4092");
const _: () = assert!($chunk_size > 0, "chunk size must be > 0");
const _: () = ::core::assert!($chunk_size <= 4092, "chunk size must be <= 4092");
const _: () = ::core::assert!($chunk_size > 0, "chunk size must be > 0");

static mut TX_DESCRIPTORS: [$crate::dma::DmaDescriptor;
($tx_size + $chunk_size - 1) / $chunk_size] =
Expand Down Expand Up @@ -473,8 +473,8 @@ macro_rules! dma_descriptors_chunk_size {
macro_rules! dma_circular_descriptors_chunk_size {
($tx_size:expr, $rx_size:expr, $chunk_size:expr) => {{
// these will check for size at compile time
const _: () = assert!($chunk_size <= 4092, "chunk size must be <= 4092");
const _: () = assert!($chunk_size > 0, "chunk size must be > 0");
const _: () = ::core::assert!($chunk_size <= 4092, "chunk size must be <= 4092");
const _: () = ::core::assert!($chunk_size > 0, "chunk size must be > 0");

const tx_descriptor_len: usize = if $tx_size > $chunk_size * 2 {
($tx_size + $chunk_size - 1) / $chunk_size
Expand Down
5 changes: 5 additions & 0 deletions hil-test/tests/i2s_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ async fn writer(tx_buffer: &'static mut [u8], i2s_tx: I2sTx<'static, I2S0, DmaCh
#[cfg(test)]
#[embedded_test::tests(executor = esp_hal_embassy::Executor::new())]
mod tests {
// defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not
// using defmt's non-const assert. Doing so would result in a compile error.
#[allow(unused_imports)]
use defmt::{assert_eq, *};

use super::*;

#[init]
Expand Down
5 changes: 4 additions & 1 deletion hil-test/tests/spi_half_duplex_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ struct Context {
#[cfg(test)]
#[embedded_test::tests]
mod tests {
use defmt::assert_eq;
// defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not
// using defmt's non-const assert. Doing so would result in a compile error.
#[allow(unused_imports)]
use defmt::{assert_eq, *};

use super::*;

Expand Down