rsiot/components_config/uart_general/
parity.rs1#[allow(missing_docs)]
6#[derive(Clone, Copy, Debug, Default)]
7pub enum Parity {
8 #[default]
9 None,
10 Even,
11 Odd,
12}
13#[cfg(feature = "cmp_esp")]
16impl From<Parity> for esp_idf_svc::hal::uart::config::Parity {
17 fn from(value: Parity) -> Self {
18 match value {
19 Parity::None => Self::ParityNone,
20 Parity::Even => Self::ParityEven,
21 Parity::Odd => Self::ParityOdd,
22 }
23 }
24}
25
26impl From<Parity> for f64 {
27 fn from(value: Parity) -> Self {
28 match value {
29 Parity::None => 0.0,
30 Parity::Even | Parity::Odd => 1.0,
31 }
32 }
33}