conv.comp.in
来自「CNC 的开放码,EMC2 V2.2.8版」· IN 代码 · 共 25 行
IN
25 行
component conv_@IN@_@OUT@ "Convert a value from @IN@ to @OUT@";pin in @IN@ in_;pin out @OUT@ out;@CC@ pin out bit out_of_range "TRUE when 'in' is not in the range of @OUT@";@CC@ param rw bit clamp """If TRUE, then clamp to the range of @OUT@. If FALSE, then allow the value to "wrap around".""";function _ @FP@ "Update 'out' based on 'in'";license "GPL";;;FUNCTION(_) { hal_@IN@_t in = in_;@CC@ if(clamp) {#if @MAX@ != 0@CC@ if(in > @MAX@) { out = @MAX@; out_of_range = 1; return; }#endif#if @MIN@ != -1@CC@ if(in < @MIN@) { out = @MIN@; out_of_range = 1; return; }#endif@CC@ out = in; out_of_range = 0;@CC@ } else { out = in;@CC@ if(out != in) out_of_range = 1;@CC@ }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?