root / trunk / cardbox / serial.h @ 139
History | View | Annotate | Download (1.81 KB)
1 |
/********
|
---|---|
2 |
* This file is part of Tooltron.
|
3 |
*
|
4 |
* Tooltron is free software: you can redistribute it and/or modify
|
5 |
* it under the terms of the Lesser GNU General Public License as published by
|
6 |
* the Free Software Foundation, either version 3 of the License, or
|
7 |
* (at your option) any later version.
|
8 |
*
|
9 |
* Tooltron is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* Lesser GNU General Public License for more details.
|
13 |
* You should have received a copy of the Lesser GNU General Public License
|
14 |
* along with Tooltron. If not, see <http://www.gnu.org/licenses/>.
|
15 |
*
|
16 |
* Copyright 2009 Kevin Woo <kwoo@2ndt.com>
|
17 |
*
|
18 |
********/
|
19 |
/*
|
20 |
serial.h - Contains definitions and function prototypes for the RS232 serial port
|
21 |
*/
|
22 |
|
23 |
#ifndef _SERIAL_H
|
24 |
#define _SERIAL_H
|
25 |
|
26 |
// Tested baud rates
|
27 |
#define BAUD9600 51 |
28 |
#define BAUD115200 8 //Warning--3.5% error |
29 |
|
30 |
// Untested baud rates that might be right --aaron
|
31 |
#define BAUD1M 0 |
32 |
#define BAUD500K 1 |
33 |
#define BAUD250K 3 |
34 |
#define BAUD230400 3 //Warning--8.5% error |
35 |
#define BAUD76800 12 |
36 |
#define BAUD57600 16 //Warning--2.1% error |
37 |
#define BAUD38400 25 |
38 |
#define BAUD28800 34 |
39 |
#define BAUD19200 51 |
40 |
#define BAUD14400 68 |
41 |
#define BAUD4800 207 |
42 |
#define BAUD2400 416 //Might not work, since it needs some high bits set |
43 |
|
44 |
// Function descriptions are available in serial.c
|
45 |
|
46 |
//serial (serial0) is the ttl serial (wireless)
|
47 |
void serial_init( unsigned int ubrr); |
48 |
int serial_putchar(char c); |
49 |
int serial_getchar(void); |
50 |
int serial_getchar_nb(void); |
51 |
|
52 |
//serial1 is the rs-232 port (db9 connector) (except on robot0 where both are serial0)
|
53 |
void serial1_init( unsigned int ubrr); |
54 |
int serial1_putchar(char c); |
55 |
int serial1_getchar(void); |
56 |
int serial1_getchar_nb(void); |
57 |
|
58 |
|
59 |
|
60 |
#endif
|