root / trunk / code / projects / colonet / utilities / robot_wireless_relay / serial.h @ 13
History | View | Annotate | Download (1.29 KB)
1 |
/*
|
---|---|
2 |
serial.h - Contains definitions and function prototypes for the RS232 serial port
|
3 |
*/
|
4 |
|
5 |
#ifndef _SERIAL_H
|
6 |
#define _SERIAL_H
|
7 |
|
8 |
// Tested baud rates
|
9 |
#define BAUD9600 103 |
10 |
#define BAUD115200 8 //Warning--3.5% error |
11 |
|
12 |
// Untested baud rates that might be right --aaron
|
13 |
#define BAUD1M 0 |
14 |
#define BAUD500K 1 |
15 |
#define BAUD250K 3 |
16 |
#define BAUD230400 3 //Warning--8.5% error |
17 |
#define BAUD76800 12 |
18 |
#define BAUD57600 16 //Warning--2.1% error |
19 |
#define BAUD38400 25 |
20 |
#define BAUD28800 34 |
21 |
#define BAUD19200 51 |
22 |
#define BAUD14400 68 |
23 |
#define BAUD4800 207 |
24 |
#define BAUD2400 416 //Might not work, since it needs some high bits set |
25 |
|
26 |
#include <stdio.h> |
27 |
FILE *serial1_stream; //For use with fprintf() and related functions
|
28 |
|
29 |
/* NOTE: To use fprintf():
|
30 |
After calling serial1_init(BAUD115200);
|
31 |
use the command fprintf(serial1_stream, "Hello World"); */
|
32 |
|
33 |
// Function descriptions are available in serial.c
|
34 |
|
35 |
//serial (serial0) is the ttl serial (wireless)
|
36 |
void serial_init(unsigned int ubrr); |
37 |
int serial_putchar(char c); |
38 |
int serial_getchar(void); |
39 |
int serial_getchar_nb(void); |
40 |
|
41 |
//serial1 is the rs-232 port (db9 connector) (except on robot0 where both are serial0)
|
42 |
void serial1_init( unsigned int ubrr); |
43 |
int serial1_putchar(char c); |
44 |
int serial1_getchar(void); |
45 |
int serial1_getchar_nb(void); |
46 |
|
47 |
#endif
|