Project

General

Profile

Revision 1208

Moved usb_puts_P from diagnostic station to library

View differences:

trunk/code/lib/include/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 **/
trunk/code/projects/diagnostic_station/station/tests.h
12 12
void test_all (void);
13 13

  
14 14

  
15

  
16

  
17

  
18

  
19

  
20

  
21

  
22

  
23

  
24

  
25

  
26 15
#endif
trunk/code/projects/diagnostic_station/station/comm_server.c
60 60
// ## Message processing ##
61 61
// ########################
62 62

  
63
// TODO move this to the library
64
static void serial_send_string_P (PGM_P s)
65
{
66
    char buf;
67
    while (memcpy_P (&buf, s, sizeof (char)), buf!=0)
68
    {
69
        usb_putc (buf);
70
        s++;
71
    }
72
}
73

  
74 63
static char *find_next_parameter (char *p)
75 64
{
76 65
	// Advance p until a blank or the terminating zero is found.
......
259 248

  
260 249
static void handle_message_help (char *buffer)
261 250
{
262
	serial_send_string_P (help_text);
251
	usb_puts_P (help_text);
263 252
}
264 253

  
265 254

  
trunk/code/projects/diagnostic_station/station/main.c
70 70
	usb_puts("# Diagnostic station version " version_string " starting" NL);
71 71

  
72 72
    orb_init_pwm ();
73
	
73 74
	hardware_init ();
74 75
	comm_server_init ();
75 76
	comm_robot_init ();
......
103 104
{
104 105
    dragonfly_init(0);
105 106

  
106
    usb_init ();
107
	// Initialize before using USB
108
	comm_server_init ();
107 109

  
108 110
	usb_puts(NL NL NL);
109 111
	usb_puts("# Diagnostic station version " version_string " starting" NL);
110 112

  
111 113
    orb_init_pwm ();
112 114
	hardware_init ();
113
	comm_server_init ();
114 115

  
115 116
	orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL);
116 117
	xbee_init ();

Also available in: Unified diff