don't serialize default stop mode
This commit is contained in:
parent
62567511fb
commit
54fedeeefa
@ -10,6 +10,10 @@ macro_rules! regex {
|
|||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_default<T: Default + PartialEq>(variant: &T) -> bool {
|
||||||
|
*variant == T::default()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||||
pub struct Chip {
|
pub struct Chip {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@ -116,6 +120,7 @@ pub mod chip {
|
|||||||
pub reset: Option<rcc::Reset>,
|
pub reset: Option<rcc::Reset>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub mux: Option<rcc::Mux>,
|
pub mux: Option<rcc::Mux>,
|
||||||
|
#[serde(default, skip_serializing_if = "crate::is_default")]
|
||||||
pub stop_mode: rcc::StopMode,
|
pub stop_mode: rcc::StopMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +145,9 @@ pub mod chip {
|
|||||||
pub field: String,
|
pub field: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize, Default)]
|
||||||
pub enum StopMode {
|
pub enum StopMode {
|
||||||
|
#[default]
|
||||||
Stop1, // Peripheral prevents chip from entering Stop1
|
Stop1, // Peripheral prevents chip from entering Stop1
|
||||||
Stop2, // Peripheral prevents chip from entering Stop2
|
Stop2, // Peripheral prevents chip from entering Stop2
|
||||||
Standby, // Peripheral does not prevent chip from entering Stop
|
Standby, // Peripheral does not prevent chip from entering Stop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user