summaryrefslogtreecommitdiffstats
path: root/libk8055/libk8055.cpp
blob: 2d58da71fe8965ee9ce69625a850b5a2cf5d230d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
 * This file is part of the libk8055 Library.
 *
 * The libk8055 Library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * The libk8055 Library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the
 * Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * http://opensource.org/licenses/
 *
 * Copyright (C) 2011 by Jérémy Zurcher
 *
 */

#include "k8055++.h"

K8055::K8055() {
}

K8055::~K8055() {
    k8055_close_device( &dev );
}

int K8055::read( void ) {
    return k8055_read( &dev );
}

int K8055::write( void ) {
    return k8055_write( &dev );
}

int K8055::digital_outputs( void ) {
    return k8055_digital_outputs( &dev );
}

int K8055::digital_output_1( void ) {
    return k8055_digital_output_1( &dev );
}

int K8055::digital_output_2( void ) {
    return k8055_digital_output_2( &dev );
}

int K8055::digital_output_3( void ) {
    return k8055_digital_output_3( &dev );
}

int K8055::digital_output_4( void ) {
    return k8055_digital_output_4( &dev );
}

int K8055::digital_output_5( void ) {
    return k8055_digital_output_5( &dev );
}

int K8055::analog_output_1( void ) {
    return k8055_analog_output_1( &dev );
}

int K8055::analog_output_2( void ) {
    return k8055_analog_input_2( &dev );
}

int K8055::digital_input_1( void ) {
    return k8055_digital_input_1( &dev );
}

int K8055::digital_input_2( void ) {
    return k8055_digital_input_2( &dev );
}

int K8055::digital_input_3( void ) {
    return k8055_digital_input_3( &dev );
}

int K8055::digital_input_4( void ) {
    return k8055_digital_input_4( &dev );
}

int K8055::digital_input_5( void ) {
    return k8055_digital_input_5( &dev );
}

int K8055::analog_input_1( void ) {
    return k8055_analog_input_1( &dev );
}

int K8055::analog_input_2( void ) {
    return k8055_analog_input_2( &dev );
}

int K8055::counter_1( void ) {
    return k8055_counter_1( &dev );
}

int K8055::counter_2( void ) {
    return k8055_counter_2( &dev );
}

char* K8055::Version( void ) {
    return k8055_version();
}

int K8055::SearchDevices( void ) {
    return k8055_search_devices(0);
}

int K8055::OpenDevice( int board_address ) {
    return k8055_open_device( &dev, board_address );
}

int K8055::CloseDevice() {
    return k8055_close_device( &dev );
}

int K8055::SetAnalogChannel( int channel ) {
    return k8055_set_analog_channel( &dev, channel );
}

int K8055::ClearAnalogChannel( int channel ) {
    return k8055_clear_analog_channel( &dev, channel );
}

int K8055::ReadAnalogChannel( int channel ) {
    return k8055_read_analog_channel( &dev, channel );
}

int K8055::WriteAnalogChannel( int channel, int data ) {
    return k8055_write_analog_channel( &dev, channel, data );
}

int K8055::SetAllAnalog() {
    return k8055_set_all_analog( &dev );
}
int K8055::ClearAllAnalog() {
    return k8055_clear_all_analog( &dev );
}

int K8055::ReadAllAnalog( int* data1, int* data2 ) {
    return k8055_read_all_analog( &dev, data1, data2 );
}

int K8055::WriteAllAnalog( int data1,int data2 ) {
    return k8055_write_all_analog( &dev, data1, data2 );
}

int K8055::SetDigitalChannel( int channel ) {
    return k8055_set_digital_channel( &dev, channel );
}

int K8055::ReadDigitalChannel( int channel ) {
    return k8055_read_digital_channel( &dev, channel );
}

int K8055::ClearDigitalChannel( int channel ) {
    return k8055_clear_digital_channel( &dev, channel );
}

int K8055::SetAllDigital() {
    return k8055_set_all_digital( &dev );
}

int K8055::ClearAllDigital() {
    return k8055_clear_all_digital( &dev );
}

int K8055::ReadAllDigital() {
    return k8055_read_all_digital( &dev );
}

int K8055::WriteAllDigital( int data ) {
    return k8055_write_all_digital( &dev, data );
}

int K8055::WriteAllOutputs( int digital, int analog1, int analog2 ) {
    return k8055_write_all_outputs( &dev, digital, analog1, analog2 );
}

int K8055::ReadAllInputs ( int*  digital, int* analog1, int* analog2, int* counter1, int* counter2 ) {
    return k8055_read_all_inputs( &dev, digital, analog1, analog2, counter1, counter2 );
}

int K8055::ResetCounter( int counter ) {
    return k8055_reset_counter( &dev, counter );
}

int K8055::ReadCounter( int counter ) {
    return k8055_read_counter( &dev, counter );
}

int K8055::SetCounterDebounceTime( int counter, int debounce_time ) {
    return k8055_set_counter_debounce_time( &dev, counter, debounce_time );
}