forked from M-Labs/humpback-dds
scpi: add macro for command struct
This commit is contained in:
parent
148f1c7a4e
commit
c740386d6b
26
src/scpi.rs
26
src/scpi.rs
|
@ -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!();
|
||||
|
||||
|
|
Loading…
Reference in New Issue