Use cfg_if in favour of multiple cfgs in set_rx_fifo_full_threshold function (#2670)
This commit is contained in:
parent
da59a4eb36
commit
a189eff517
@ -2324,14 +2324,17 @@ impl Info {
|
|||||||
/// - `esp32c3`, `esp32c2`, `esp32s2` **0x1FF**
|
/// - `esp32c3`, `esp32c2`, `esp32s2` **0x1FF**
|
||||||
/// - `esp32s3` **0x3FF**
|
/// - `esp32s3` **0x3FF**
|
||||||
fn set_rx_fifo_full_threshold(&self, threshold: u16) -> Result<(), ConfigError> {
|
fn set_rx_fifo_full_threshold(&self, threshold: u16) -> Result<(), ConfigError> {
|
||||||
#[cfg(esp32)]
|
cfg_if::cfg_if! {
|
||||||
const MAX_THRHD: u16 = 0x7F;
|
if #[cfg(esp32)] {
|
||||||
#[cfg(any(esp32c6, esp32h2))]
|
const MAX_THRHD: u16 = 0x7F;
|
||||||
const MAX_THRHD: u16 = 0xFF;
|
} else if #[cfg(any(esp32c6, esp32h2))] {
|
||||||
#[cfg(any(esp32c3, esp32c2, esp32s2))]
|
const MAX_THRHD: u16 = 0xFF;
|
||||||
const MAX_THRHD: u16 = 0x1FF;
|
} else if #[cfg(any(esp32c3, esp32c2, esp32s2))] {
|
||||||
#[cfg(esp32s3)]
|
const MAX_THRHD: u16 = 0x1FF;
|
||||||
const MAX_THRHD: u16 = 0x3FF;
|
} else if #[cfg(esp32s3)] {
|
||||||
|
const MAX_THRHD: u16 = 0x3FF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if threshold > MAX_THRHD {
|
if threshold > MAX_THRHD {
|
||||||
return Err(ConfigError::UnsupportedFifoThreshold);
|
return Err(ConfigError::UnsupportedFifoThreshold);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user