Add option to `AtatEnum` when deriving to automatically derive default
Closed this issue · 0 comments
MathiasKoch commented
When deriving AtatEnum
for an enum, i think it would make sense to be able to mark the default value (factory-programmed value) as:
/// GPIO input value (for input function <gpio_mode>=1 only):
#[derive(Clone, PartialEq, AtatEnum)]
pub enum GpioInPull {
/// (default value): no resistor activated
#[at_arg(default, value = 0, position = 0)
NoPull,
/// pull up resistor active
#[at_arg(value = 1, position = 1)
PullUp,
/// pull down resistor active
#[at_arg(value = 2, position = 2)
PullDown,
}
Expanding the default
part of #[at_arg(default, value = 0, position = 0)
to:
impl Default for GpioInPull {
fn default() -> Self {
GpioInPull::NoPull
}
}