doc/api
changeset 11 352d5517f1f2
parent 10 d32454497beb
child 12 ad264ee5d5ba
equal deleted inserted replaced
10:d32454497beb 11:352d5517f1f2
     1 What do we need?
       
     2 
       
     3 * outputs are addressed from 0..64
       
     4 * values for outputs are {"on", 1} or {"off", 0}
       
     5     
       
     6 * set/clear single outputs (set_bit?)
       
     7 
       
     8     # $state:	"on", "off", 0, 1
       
     9     # $output:	0..63
       
    10 
       
    11     set($state => $output, ...)
       
    12     set($state => [$output, ...])
       
    13 
       
    14     Examples
       
    15 
       
    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 
       
    20     # alternate form of the above 
       
    21     set(1 => 0, 0 => 1, 1 => 2, 0 => 3, ...., 0 => 7);
       
    22     set(1 => [0, 2], on => [1, 3 ... 7]);
       
    23 
       
    24 
       
    25     # explicitly switch on
       
    26     on(0, 2);
       
    27     # .. or off single values
       
    28     off(1, 3 ... 7);
       
    29 
       
    30 * read a single output (get_bit?)
       
    31 
       
    32     $result = get($output);
       
    33     @result = get($output, ...);
       
    34 
       
    35     Examples
       
    36 
       
    37     $result = get(0);
       
    38     @result = get(0 .. 7);
       
    39 	
       
    40 * setting several outputs in a row (set_block, write_block?)
       
    41     
       
    42     # $block: 0 .. 7
       
    43     # $value: 8, 16, ... 64 bit integer
       
    44 
       
    45     # setting several outputs in a row, $output has to be
       
    46 
       
    47     write($value => $block);
       
    48 
       
    49     Examples
       
    50 
       
    51     write(0x05 => 0);
       
    52     write(5 => 0);
       
    53 
       
    54 # get several outputs in a row (get_block, read_block?)
       
    55 
       
    56     $result = read(0, 8);   # read 8 bit and return it as a number
       
    57 
       
    58