Revision 1345
Final spline code for master/slave
updated outdated libdragonfly and libwireless
serial.h | ||
---|---|---|
1 | 1 |
/** |
2 |
* Copyright (c) 2007 Colony Project |
|
3 |
* |
|
4 |
* Permission is hereby granted, free of charge, to any person |
|
5 |
* obtaining a copy of this software and associated documentation |
|
6 |
* files (the "Software"), to deal in the Software without |
|
7 |
* restriction, including without limitation the rights to use, |
|
8 |
* copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 |
* copies of the Software, and to permit persons to whom the |
|
10 |
* Software is furnished to do so, subject to the following |
|
11 |
* conditions: |
|
12 |
* |
|
13 |
* The above copyright notice and this permission notice shall be |
|
14 |
* included in all copies or substantial portions of the Software. |
|
15 |
* |
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
17 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
18 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
19 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
20 |
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
21 |
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
23 |
* OTHER DEALINGS IN THE SOFTWARE. |
|
24 |
**/ |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
2 | 28 |
* @file serial.h |
3 | 29 |
* @brief Contains declarations for serial input and output |
4 | 30 |
* |
... | ... | |
10 | 36 |
**/ |
11 | 37 |
|
12 | 38 |
/* |
13 |
serial.h - Contains definitions and function prototypes for the RS232 serial port
|
|
39 |
serial.h - Contains definitions and function prototypes for the RS232 serial port
|
|
14 | 40 |
author(s): pkv |
15 | 41 |
|
16 | 42 |
Directions: |
... | ... | |
19 | 45 |
write characters to the serial ports. |
20 | 46 |
|
21 | 47 |
UART Mapping: |
22 |
usb_*() -> UART0
|
|
23 |
xbee_*() -> UART1
|
|
48 |
usb_*() -> UART0 |
|
49 |
xbee_*() -> UART1 |
|
24 | 50 |
|
25 | 51 |
Options: (Add the following defines to your code to configure this library) |
26 |
#define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here
|
|
27 |
#define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here
|
|
28 |
#define USE_STDIO
|
|
52 |
#define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here |
|
53 |
#define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here |
|
54 |
#define USE_STDIO |
|
29 | 55 |
|
30 | 56 |
Note: If you enable USE_STDIO, the first init function that is called will |
31 | 57 |
automatically be linked to stdin, stdout, and stderr. To use the baud rate |
... | ... | |
42 | 68 |
#ifndef _SERIAL_H |
43 | 69 |
#define _SERIAL_H |
44 | 70 |
|
71 |
#include <inttypes.h> |
|
72 |
#include <avr/pgmspace.h> |
|
73 |
|
|
45 | 74 |
/** |
46 | 75 |
* @defgroup usb USB Input / Output |
47 | 76 |
* @brief Functions for USB input / output |
... | ... | |
67 | 96 |
int usb_getc_nb(char *c); |
68 | 97 |
/** @brief Print a string to USB **/ |
69 | 98 |
int usb_puts(char *s); |
99 |
/** @brief Print a string from program space to USB **/ |
|
100 |
void usb_puts_P (PGM_P s); |
|
70 | 101 |
/** @brief Print an integer to USB **/ |
71 | 102 |
int usb_puti(int value); |
103 |
/** @brief Determine a hexadecimal digit **/ |
|
104 |
uint8_t hex_digit (uint8_t value); |
|
105 |
/** @brief Print a fixed width hexadecimal representation to USB **/ |
|
106 |
void usb_puth16 (uint16_t value); |
|
107 |
/** @brief Print a fixed width hexadecimal representation to USB **/ |
|
108 |
void usb_puth8(uint8_t value); |
|
109 |
/** @brief Alias for usb_puth16 **/ |
|
110 |
static inline void usb_puth (uint16_t value) { usb_puth16 (value); }; |
|
72 | 111 |
|
112 |
|
|
73 | 113 |
/** @} **/ //end addtogroup |
74 | 114 |
|
75 | 115 |
/** |
... | ... | |
98 | 138 |
/** @brief Read a character from the XBee without blocking **/ |
99 | 139 |
int xbee_getc_nb(char *c); |
100 | 140 |
|
141 |
|
|
142 |
|
|
101 | 143 |
/** @} **/ //end addtogroup |
102 | 144 |
|
103 | 145 |
#endif |
Also available in: Unified diff