[go: up one dir, main page]

Menu

[r3]: / muin.h  Maximize  Restore  History

Download this file

80 lines (66 with data), 2.3 kB

 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
////////////////////////////////////////////////////////////////////////////////////
//
// //// /////// // // // // // //////
// // // // // // //// //// // // //
// // // ////// // // // // // // //
// // // // // // // // /////// //
// //// ////// // // // // // // //////
//
//muin.h
//Dexmac 2011
//
//www.dexmac.com
//
// GNU General Public License Usage
// Alternatively, this file may be used under the terms of the GNU
// General Public License version 3.0 as published by the Free Software
// Foundation and appearing in the file LICENSE.GPL included in the
// packaging of this file. Please review the following information to
// ensure the GNU General Public License version 3.0 requirements will be
// met: http://www.gnu.org/copyleft/gpl.html.
///////////////////////////////////////////////////////////////////////////////////
#ifndef MUIN_H
#define MUIN_H
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <string.h>
#define BAUDRATE B115200
#define MODEMDEVICE "/dev/ttyUSB0"
#define _POSIX_SOURCE 1 //POSIX compliant source
#define FALSE 0
#define TRUE 1
#define BYTE unsigned char
//#define DEBUG
class muin{
public:
muin(){};
~muin(){};
public:
struct termios newtio;
struct termios oldtio;
int fd_ptz;
public:
int Open(char *device,long BAUD);
void Close();
int Write(unsigned char *msg,int msgsize);
int GetADC(unsigned char *buffer_out,int *data_val);
int GetPortB(unsigned char &val);
int SetPortB(unsigned char val);
int GetChannel();
int SetChannel(int val);
int SetChannelWrite(int val);
int Read(unsigned char *buffer,char eod,int timeout);
int SetPwm(unsigned char pwm,unsigned int val);
int SetServo(unsigned char servo, unsigned int val);
int ReadCmps03(double &val);
int CalibrateCmps03(unsigned char val);
};
#endif // MUIN_H