74 lines
1.8 KiB
Plaintext
74 lines
1.8 KiB
Plaintext
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
|
driver he3_polanal = {
|
|
debug_threshold = 0;
|
|
protocol = std;
|
|
class = instrument;
|
|
simulation_group = rfgen_simulation;
|
|
group polariser = {
|
|
var spin = {
|
|
type = text;
|
|
readable = 10;
|
|
read_command = 'polariser';
|
|
read_function = rdValue;
|
|
writeable = 1;
|
|
write_command = 'polariser';
|
|
check_function = chkWrite;
|
|
allowed = "+,-,0"
|
|
}
|
|
}
|
|
group analyser = {
|
|
var spin = {
|
|
type = text;
|
|
readable = 10;
|
|
read_command = 'analyser';
|
|
read_function = rdValue;
|
|
writeable = 1;
|
|
write_command = 'analyser';
|
|
check_function = chkWrite;
|
|
allowed = "+,-,0"
|
|
}
|
|
}
|
|
code chkWrite = {%%
|
|
rdValue ${tc_root}
|
|
%%}
|
|
|
|
code rdValue = {%%
|
|
set dlist [split ${data}]
|
|
if {[llength ${dlist}] < 2} {
|
|
sct geterror "Syntax Error: '${data}'"
|
|
error "[sct geterror]"
|
|
}
|
|
set my_name [basename [pathname [sct]]]
|
|
if {![string equal -nocase "[lindex ${dlist} 0]" "${my_name}"]} {
|
|
error "[lindex ${dlist} 0] is not ${my_name}"
|
|
}
|
|
if {[string match "*Not Active*" "${data}"]} {
|
|
set data 0
|
|
} elseif {[string match -nocase "*Error:*" "${data}"]} {
|
|
sct geterror "${data}"
|
|
error "[sct geterror]"
|
|
} else {
|
|
set data [lindex ${dlist} 1]
|
|
}
|
|
%%}
|
|
|
|
code setValue = {%%
|
|
set cmd "${cmd_str}"
|
|
if {[string equal -nocase [sct target] "dn"]} {
|
|
set cmd "${cmd_str} -"
|
|
}
|
|
if {[string equal -nocase [sct target] "down"]} {
|
|
set cmd "${cmd_str} -"
|
|
}
|
|
if {[sct target] == "-" || [sct target] == -1} {
|
|
set cmd "${cmd_str} -"
|
|
}
|
|
if {[string equal -nocase [sct target] "up"]} {
|
|
set cmd "${cmd_str} +"
|
|
}
|
|
if {[sct target] == "+" || [sct target] == 1} {
|
|
set cmd "${cmd_str} +"
|
|
}
|
|
%%}
|
|
}
|