doc/api.txt
changeset 18 a6bc8818d069
parent 11 352d5517f1f2
equal deleted inserted replaced
17:ecc10b50b7a6 18:a6bc8818d069
     3 * outputs are addressed from 0..64
     3 * outputs are addressed from 0..64
     4 * values for outputs are {"on", 1} or {"off", 0}
     4 * values for outputs are {"on", 1} or {"off", 0}
     5     
     5     
     6 * set/clear single outputs (set_bit?)
     6 * set/clear single outputs (set_bit?)
     7 
     7 
     8     # $state:	"on", "off", 0, 1
       
     9     # $output:	0..63
     8     # $output:	0..63
       
     9     # $state:	true / false (in the sense of perl)
    10 
    10 
    11     set($state => $output, ...)
    11     set($output => $state);
    12     set($state => [$output, ...])
    12     set(@outputs => $state);
    13 
    13 
    14     Examples
    14     Examples
    15 
    15 
    16     # setting single outputs
    16     # setting single outputs
    17     set(on => 0, off => 1, on => 2, off => 3, ....., off => 7);
       
    18     set(on => [0, 2], off => [1, 3 .. 7]);
       
    19 
    17 
    20     # alternate form of the above 
    18     set($output => 0);
    21     set(1 => 0, 0 => 1, 1 => 2, 0 => 3, ...., 0 => 7);
    19     set($output1, $output2 => 0);
    22     set(1 => [0, 2], on => [1, 3 ... 7]);
    20     set($output1, $output2 => 0);
    23 
    21     set(1..30, 1);
    24 
    22 
    25     # explicitly switch on
    23     # explicitly switch on
    26     on(0, 2);
    24     on(0, 2);
    27     # .. or off single values
    25     # .. or off single values
    28     off(1, 3 ... 7);
    26     off(1, 3 ... 7);
    29 
    27 
    30 * read a single output (get_bit?)
    28 * read a single output (get_bit?)
    31 
    29 
    32     $result = get($output);
    30     $result = get($output);
    33     @result = get($output, ...);
    31     @result = get(@outputs);
    34 
    32 
    35     Examples
    33     Examples
    36 
    34 
    37     $result = get(0);
    35     $result = get(0);
    38     @result = get(0 .. 7);
    36     @result = get(0 .. 7);
    63     tie @outputs => "Quancom" $ip_address;
    61     tie @outputs => "Quancom" $ip_address;
    64     # or: @outputs = Quancom::outputs($ip_address);
    62     # or: @outputs = Quancom::outputs($ip_address);
    65 
    63 
    66     $outputs[0] = 1;
    64     $outputs[0] = 1;
    67     @outputs = (1, 0, 1, 0, 0, 0);
    65     @outputs = (1, 0, 1, 0, 0, 0);
       
    66     @outputs[1..30] = ....
    68 
    67 
    69     my $block0;
    68     my $block0;
    70     tie $block => "Quancom" $ip_address, $block, $len;
    69     tie $block => "Quancom" $ip_address, $block, $len;
    71     # or: $block = Quancom::block($ip_address, $block, $len);
    70     # or: $block = Quancom::block($ip_address, $block, $len);
    72 
    71