scpi: add macro for command struct

This commit is contained in:
occheung 2020-09-04 17:52:37 +08:00
parent 148f1c7a4e
commit c740386d6b
1 changed files with 25 additions and 1 deletions

View File

@ -131,7 +131,31 @@ impl<T: Device> Command<T> 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<T: Device + UrukulTraits> Command<T> for Channel1SwitchCommand {
nquery!();