include
serial.h
Go to the documentation of this file.
1
// Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to
5
// deal in the Software without restriction, including without limitation the
6
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
// sell copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
// SOFTWARE.
20
21
#ifndef SERIAL_H
22
#define SERIAL_H
23
24
#define ENABLE 1
25
#define DISABLE 0
26
27
#define DEFAULT_BAUDRATE 38400
28
29
/* for measurement time estimation */
30
extern
double
SER_BAUDRATE
;
31
#define SER_INTERVAL 0.0050
32
// #define SER_BYTES 13.0
33
// #define SER_TIME_BYTE (11.0/SER_BAUDRATE)
34
35
int
serial_tryconnect
(
char
*device_name);
36
int
serial_connect
(
char
*device_name);
37
int
serial_change_baudrate
(
int
baud);
38
39
/*----------------PBS_close------------------*/
40
int
serial_close
(
void
);
41
int
serial_write
(
char
*buf,
int
len);
42
int
serial_recieve
(
int
(*serial_event)(
char
*,
int
,
double
,
void
*),
void
*data);
43
void
serial_flush_in
(
void
);
44
void
serial_flush_out
(
void
);
45
int
encode_write
(
char
*data,
int
len);
46
47
#endif // SERIAL_H
serial_connect
int serial_connect(char *device_name)
Definition:
serial.c:320
SER_BAUDRATE
double SER_BAUDRATE
Definition:
serial.c:48
encode_write
int encode_write(char *data, int len)
Definition:
serial.c:530
serial_change_baudrate
int serial_change_baudrate(int baud)
ボーレートを変更する
Definition:
serial.c:216
serial_recieve
int serial_recieve(int(*serial_event)(char *, int, double, void *), void *data)
Definition:
serial.c:434
serial_flush_in
void serial_flush_in(void)
Definition:
serial.c:388
serial_close
int serial_close(void)
Definition:
serial.c:363
serial_tryconnect
int serial_tryconnect(char *device_name)
Definition:
serial.c:178
serial_write
int serial_write(char *buf, int len)
Definition:
serial.c:568
serial_flush_out
void serial_flush_out(void)
Definition:
serial.c:423
yp-spur
Author(s):
autogenerated on Fri Oct 20 2023 03:02:42