summaryrefslogtreecommitdiffstats
path: root/libk8055/k8055++.h
blob: 87c9b9b707cf62359f7b140b6dd4dc79a32c50cc (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
/*
 * 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
 *
 */

#ifndef K8055_CPP_H
#define K8055_CPP_H 1

#include "k8055.h"

class K8055 {
    public:
        K8055();
        ~K8055();

        int read( void );
        int write( void );

        int digital_1( void );
        int digital_2( void );
        int digital_3( void );
        int digital_4( void );
        int digital_5( void );
        int analog_1( void );
        int analog_2( void );
        int counter_1( void );
        int counter_2( void );

        static char* Version( void );
        static int SearchDevices( void );

        int OpenDevice( int board_address );
        int CloseDevice();

        int SetAnalogChannel( int channel );
        int ClearAnalogChannel( int channel );
        int ReadAnalogChannel( int channel_no );
        int WriteAnalogChannel( int channel, int data );

        int SetAllAnalog();
        int ClearAllAnalog();
        int ReadAllAnalog( int* data1, int* data2 );
        int WriteAllAnalog( int data1,int data2 );

        int SetDigitalChannel( int channel );
        int ClearDigitalChannel( int channel );
        int ReadDigitalChannel( int channel );

        int SetAllDigital();
        int ClearAllDigital();
        int ReadAllDigital();
        int WriteAllDigital( int data );

        int SetAllValues( int digital_data, int ad_data1, int ad_data2 );
        int ReadAllValues ( int*  data1, int* data2, int* data3, int* data4, int* data5 );

        int ResetCounter( int counter_n );
        int ReadCounter( int counter_n );

        int SetCounterDebounceTime( int counter_n, int debounce_time );

    private:
        struct k8055_dev dev;
};

#endif // K8055_CPP_H