2 Function: comedi_dio_bitfield2 -- read/write multiple digital channels
4 Param: comedi_t * device
5 Param: unsigned int subdevice
6 Param: unsigned int write_mask
7 Param: unsigned int * bits
8 Param: unsigned int base_channel
10 The function <function>comedi_dio_bitfield2</function>
11 allows multiple channels to
12 be read or written together on a digital input, output,
13 or configurable digital I/O device.
14 The parameter <parameter class="function">write_mask</parameter>
15 and the value pointed to by <parameter class="function">bits</parameter>
16 are interpreted as bit fields, with the least significant bit
17 representing channel <parameter class="function">base_channel</parameter>.
18 For each bit in <parameter class="function">write_mask</parameter> that is
19 set to 1, the corresponding bit in
20 <code language="C">*<parameter class="function">bits</parameter></code>
21 is written to the digital
22 output channel. After writing all the output channels, each
23 channel is read, and the result placed in the approprate bits in
24 <code language="C">*<parameter class="function">bits</parameter></code>.
25 The result of reading an output channel is the last value written to the
28 All the channels might not be read or written at the exact same time.
29 For example, the driver may need to sequentially write to
30 several registers in order to set all the digital channels specified
31 by the <parameter class="function">write_mask</parameter>
32 and <parameter class="function">base_channel</parameter> parameters.
34 If successful, <literal>0</literal> is returned, otherwise
35 <literal>-1</literal>.
37 Function: comedi_dio_config -- change input/output properties of channel
39 Param: comedi_t * device
40 Param: unsigned int subdevice
41 Param: unsigned int channel
42 Param: unsigned int direction
44 The function <function>comedi_dio_config</function> configures individual channels
45 in a digital I/O subdevice to be either input or output, depending
46 on the value of <parameter class="function">direction</parameter>. Valid directions are
47 <constant>COMEDI_INPUT</constant> or <constant>COMEDI_OUTPUT</constant>.
49 Depending on the characteristics of the hardware device, multiple
50 channels might be grouped together in hardware when
51 configuring the input/output direction. In this
52 case, a single call to <function>comedi_dio_config</function>
53 for any channel in the group will affect the entire group.
55 If successful, <literal>0</literal> is returned, otherwise
56 <literal>-1</literal>.
58 Function: comedi_dio_get_config -- query input/output properties of channel
60 Param: comedi_t * device
61 Param: unsigned int subdevice
62 Param: unsigned int channel
63 Param: unsigned int * direction
65 The function <function>comedi_dio_get_config</function> queries the input/output configuration of
67 in a digital I/O subdevice (see
68 <function><link linkend="func-ref-comedi-dio-config">comedi_dio_config</link></function>).
69 On success, <code language="C">*<parameter
70 class="function">direction</parameter></code> will
71 be set to either <constant>COMEDI_INPUT</constant> or
72 <constant>COMEDI_OUTPUT</constant>.
74 If successful, <literal>0</literal> is returned, otherwise
75 <literal>-1</literal>.
77 Function: comedi_dio_read -- read single bit from digital channel
79 Param: comedi_t * device
80 Param: unsigned int subdevice
81 Param: unsigned int channel
82 Param: unsigned int * bit
84 The function <function>comedi_dio_read</function> reads the channel
85 <parameter class="function">channel</parameter>
87 subdevice <parameter class="functioN">subdevice</parameter> of device
88 <parameter class="function">device</parameter>.
89 The data value that is
91 <code language="C">*<parameter class="function">bit</parameter></code>.
92 This function is equivalent to:
94 <link linkend="func-ref-comedi-data-read">comedi_data_read</link>(device, subdevice, channel, 0, 0, bit);
96 This function does not require a digital subdevice or a subdevice
97 with a maximum data value of 1 to work properly.
99 If you wish to read multiple digital channels at once, it is more efficient to
102 linkend="func-ref-comedi-dio-bitfield2">comedi_dio_bitfield2</link></function>
103 than to call this function multiple times.
105 Return values and errors are the same as
106 <function><link linkend="func-ref-comedi-data-read">comedi_data_read</link></function>.
108 Function: comedi_dio_write -- write single bit to digital channel
110 Param: comedi_t * device
111 Param: unsigned int subdevice
112 Param: unsigned int channel
113 Param: unsigned int bit
115 The function writes the value <parameter class="function">bit</parameter> to the channel
116 <parameter class="function">channel</parameter> belonging
117 to the subdevice <parameter class="function">subdevice</parameter> of device
118 <parameter class="function">device</parameter>. This function
121 <link linkend="func-ref-comedi-data-write">comedi_data_write</link>(device, subdevice, channel, 0, 0, bit);
123 This function does not require a digital subdevice or a subdevice
124 with a maximum data value of 1 to work properly.
126 If you wish to write multiple digital channels at once, it is more efficient to
129 linkend="func-ref-comedi-dio-bitfield2">comedi_dio_bitfield2</link></function>
130 than to call this function multiple times.
132 Return values and errors are the same as
133 <function><link linkend="func-ref-comedi-data-write">comedi_data_write</link></function>.