Revision 1207
Added usb_puts_P
trunk/code/projects/libdragonfly/serial.c | ||
---|---|---|
154 | 154 |
} |
155 | 155 |
|
156 | 156 |
/** |
157 |
* Sends a sequence of characters from program space over USB. |
|
158 |
* |
|
159 |
* @param s the string to send |
|
160 |
**/ |
|
161 |
void usb_puts_P (PGM_P s) { |
|
162 |
char buf; |
|
163 |
|
|
164 |
while (memcpy_P (&buf, s, sizeof (char)), buf!=0) { |
|
165 |
usb_putc (buf); |
|
166 |
s++; |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
/** |
|
157 | 173 |
* Returns the first character in the buffer received from USB. |
158 | 174 |
* This function blocks execution until a character has been received. |
159 | 175 |
* xbee_init must be called before this function may be used. |
trunk/code/projects/libdragonfly/serial.h | ||
---|---|---|
69 | 69 |
#define _SERIAL_H |
70 | 70 |
|
71 | 71 |
#include <inttypes.h> |
72 |
#include <avr/pgmspace.h> |
|
72 | 73 |
|
73 | 74 |
/** |
74 | 75 |
* @defgroup usb USB Input / Output |
... | ... | |
95 | 96 |
int usb_getc_nb(char *c); |
96 | 97 |
/** @brief Print a string to USB **/ |
97 | 98 |
int usb_puts(char *s); |
99 |
/** @brief Print a string from program space to USB **/ |
|
100 |
void usb_puts_P (PGM_P s); |
|
98 | 101 |
/** @brief Print an integer to USB **/ |
99 | 102 |
int usb_puti(int value); |
100 | 103 |
/** @brief Determine a hexadecimal digit **/ |
Also available in: Unified diff