2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program 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 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: main.c,v 1.15.10.5 2008-12-27 16:29:08 zer0 Exp $
21 #include <aversive/wait.h>
22 #include <aversive/pgmspace.h>
28 /* sending "pop" on cmdline uart resets the robot */
29 void emergency(char c)
35 if ((i == 0 && c == 'p') ||
36 (i == 1 && c == 'o') ||
39 else if ( !(i == 1 && c == 'p') )
50 * This code sends a counter value to uart.
58 hostsim_ittimer_enable(100000);
61 /* initialize uart with the default parameters ( see
64 uart_register_rx_event(0, emergency);
66 /* enable interrupts */
69 /* send some single characters */
70 for (i=0; i<10; i++) {
72 uart_send(0, '0' + i);
78 /* now we want to do a printf : we must register the
79 * uart0_send as stdout. Here no receive function is
81 fdevopen(uart0_dev_send, NULL);
84 /** ready to do a nice printf on the uart */
85 printf("Uart is cool !!\n");
87 /* one drawback of the previous printf is that the format
88 * chain is stored in RAM and this can take a huge size if
89 * there are many printf. To avoid this problem, please use
90 * printf_P together with PSTR, like in the next example. */
92 printf_P(PSTR("This format string takes no RAM "