diff --git a/src/scpi.rs b/src/scpi.rs index ce7a202..672cada 100644 --- a/src/scpi.rs +++ b/src/scpi.rs @@ -131,7 +131,31 @@ impl Command for HelloWorldCommand { } } -pub struct Channel1SwitchCommand {} +macro_rules! declare_channel_commands { + ($($header: ident),*) => { + mashup! { + $( + m["channel0" $header] = Channel0 $header Command; + m["channel1" $header] = Channel1 $header Command; + m["channel2" $header] = Channel2 $header Command; + m["channel3" $header] = Channel3 $header Command; + )* + } + + m! { + $( + pub struct "channel0" $header {} + pub struct "channel1" $header {} + pub struct "channel2" $header {} + pub struct "channel3" $header {} + )* + } + }; +} + +declare_channel_commands!(Switch); + +// pub struct Channel1SwitchCommand {} impl Command for Channel1SwitchCommand { nquery!();