# CONFIG_MCU_AT90S2343 is not set
# CONFIG_MCU_ATTINY22 is not set
# CONFIG_MCU_ATTINY26 is not set
+# CONFIG_MCU_ATTINY45 is not set
# CONFIG_MCU_AT90S4414 is not set
# CONFIG_MCU_AT90S4433 is not set
# CONFIG_MCU_AT90S4434 is not set
# CONFIG_MCU_ATMEGA32 is not set
# CONFIG_MCU_ATMEGA323 is not set
# CONFIG_MCU_ATMEGA325 is not set
+# CONFIG_MCU_ATMEGA328P is not set
# CONFIG_MCU_ATMEGA3250 is not set
# CONFIG_MCU_ATMEGA64 is not set
# CONFIG_MCU_ATMEGA645 is not set
# CONFIG_MCU_AT90S1200 is not set
# CONFIG_MCU_ATMEGA2560 is not set
# CONFIG_MCU_ATMEGA256 is not set
+# CONFIG_MCU_ATXMEGA128A1 is not set
+# CONFIG_MCU_ATMEGA168P is not set
+# CONFIG_MCU_ATMEGA1284P is not set
CONFIG_QUARTZ=16000000
#
# CONFIG_MODULE_FIXED_POINT is not set
# CONFIG_MODULE_VECT2 is not set
# CONFIG_MODULE_GEOMETRY is not set
+CONFIG_MODULE_HOSTSIM=y
# CONFIG_MODULE_SCHEDULER is not set
+# CONFIG_MODULE_SCHEDULER_STATS is not set
# CONFIG_MODULE_SCHEDULER_CREATE_CONFIG is not set
# CONFIG_MODULE_SCHEDULER_USE_TIMERS is not set
CONFIG_MODULE_SCHEDULER_TIMER0=y
# CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG is not set
#
-# Robot specific modules
+# Robot specific modules (fixed point lib may be needed)
#
# CONFIG_MODULE_ROBOT_SYSTEM is not set
+# CONFIG_MODULE_ROBOT_SYSTEM_USE_F64 is not set
# CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT is not set
# CONFIG_MODULE_POSITION_MANAGER is not set
# CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE is not set
#
# CONFIG_MODULE_CC2420 is not set
# CONFIG_MODULE_CC2420_CREATE_CONFIG is not set
+# CONFIG_MODULE_XBEE is not set
+# CONFIG_MODULE_XBEE_STATS is not set
+# CONFIG_MODULE_XBEE_ATCMD_HELP is not set
#
# Crypto modules
# CONFIG_AVRDUDE_PROG_PAVR is not set
# CONFIG_AVRDUDE_PROG_BUTTERFLY is not set
# CONFIG_AVRDUDE_PROG_AVR910 is not set
+# CONFIG_AVRDUDE_PROG_AVR911 is not set
# CONFIG_AVRDUDE_PROG_STK500 is not set
# CONFIG_AVRDUDE_PROG_AVRISP is not set
# CONFIG_AVRDUDE_PROG_BSD is not set
# CONFIG_AVRDUDE_PROG_DAPA is not set
# CONFIG_AVRDUDE_PROG_JTAG1 is not set
# CONFIG_AVRDUDE_PROG_AVR109 is not set
+# CONFIG_AVRDUDE_PROG_AVRISPMKII is not set
+# CONFIG_AVRDUDE_PROG_ARDUINO is not set
CONFIG_AVRDUDE_PORT="/dev/parport0"
CONFIG_AVRDUDE_BAUDRATE=19200
-/*
+/*
* Copyright Droids Corporation, Microb Technology, Eirbot (2005)
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* Revision : $Id: main.c,v 1.15.10.5 2008-12-27 16:29:08 zer0 Exp $
*
*/
-#include <uart.h>
#include <aversive/wait.h>
+#include <aversive/pgmspace.h>
+
+#include <uart.h>
#include <stdio.h>
-#include <avr/io.h>
-#include <avr/pgmspace.h>
+/* sending "pop" on cmdline uart resets the robot */
+void emergency(char c)
+{
+ static uint8_t i = 0;
+
+ printf("%c\n", c);
+
+ if ((i == 0 && c == 'p') ||
+ (i == 1 && c == 'o') ||
+ (i == 2 && c == 'p'))
+ i++;
+ else if ( !(i == 1 && c == 'p') )
+ i = 0;
+ if (i == 3) {
+#ifdef HOST_VERSION
+ hostsim_uart_exit();
+#endif
+ reset();
+ }
+}
/*
* This code sends a counter value to uart.
*/
int main(void)
-{
+{
int i;
+#ifdef HOST_VERSION
+ hostsim_uart_init();
+ hostsim_ittimer_enable(100000);
+#endif
+
/* initialize uart with the default parameters ( see
* uart_config.h ) */
- uart_init();
-
+ uart_init();
+ uart_register_rx_event(0, emergency);
+
/* enable interrupts */
sei();
wait_ms(100);
}
uart_send(0, '\n');
-
+
+#ifndef HOST_VERSION
/* now we want to do a printf : we must register the
* uart0_send as stdout. Here no receive function is
* specified. */
fdevopen(uart0_dev_send, NULL);
-
+#endif
+
/** ready to do a nice printf on the uart */
printf("Uart is cool !!\n");
-
- /* one drawback of the previous printf is that the format
- * chain is srored in RAM and this can take a huge size if
+
+ /* one drawback of the previous printf is that the format
+ * chain is stored in RAM and this can take a huge size if
* there are many printf. To avoid this problem, please use
- * printf_P together with PSTR, like in the next example. */
+ * printf_P together with PSTR, like in the next example. */
while (1) {
printf_P(PSTR("This format string takes no RAM "
"space. %i\n"), i++);
wait_ms(1000);
}
-
+
return 0;
}
* there is no new data in the transmit buffer.
*/
#ifdef UART0_COMPILE
-#ifndef SIG_UART0_DATA
+#ifndef USART0_UDRE_vect
#if defined(USART_UDRE_vect)
-#define SIG_UART0_DATA USART_UDRE_vect
-#elif defined(USART0_UDRE_vect)
-#define SIG_UART0_DATA USART0_UDRE_vect
+#define USART0_UDRE_vect USART_UDRE_vect
#elif defined(SIG_USART0_DATA)
-#define SIG_UART0_DATA SIG_USART0_DATA
+#define USART0_UDRE_vect SIG_USART0_DATA
+#elif defined(SIG_UART0_DATA)
+#define USART0_UDRE_vect SIG_UART0_DATA
#endif
#endif
-SIGNAL(SIG_UART0_DATA)
+SIGNAL(USART0_UDRE_vect)
{
uart_send_next_char(0);
}
#endif
#ifdef UART1_COMPILE
-#ifndef SIG_UART1_DATA
-#if defined(USART1_UDRE_vect)
-#define SIG_UART1_DATA USART1_UDRE_vect
-#elif defined(SIG_USART1_DATA)
-#define SIG_UART1_DATA SIG_USART1_DATA
+#ifndef USART1_UDRE_vect
+#if defined(SIG_USART1_DATA)
+#define USART1_UDRE_vect SIG_USART1_DATA
+#elif defined(SIG_UART1_DATA)
+#define USART1_UDRE_vect SIG_UART1_DATA
#endif
#endif
-SIGNAL(SIG_UART1_DATA)
+SIGNAL(USART1_UDRE_vect)
{
uart_send_next_char(1);
}
#endif
#ifdef UART2_COMPILE
-#ifndef SIG_UART2_DATA
-#if defined(USART2_UDRE_vect)
-#define SIG_UART2_DATA USART2_UDRE_vect
-#elif defined(SIG_USART2_DATA)
-#define SIG_UART2_DATA SIG_USART2_DATA
+#ifndef USART2_UDRE_vect
+#if defined(SIG_USART2_DATA)
+#define USART2_UDRE_vect SIG_USART2_DATA
+#elif defined(SIG_UART2_DATA)
+#define USART2_UDRE_vect SIG_UART2_DATA
#endif
#endif
-SIGNAL(SIG_UART2_DATA)
+SIGNAL(USART2_UDRE_vect)
{
uart_send_next_char(2);
}
#endif
#ifdef UART3_COMPILE
-#ifndef SIG_UART3_DATA
-#if defined(USART3_UDRE_vect)
-#define SIG_UART3_DATA USART3_UDRE_vect
-#elif defined(SIG_USART3_DATA)
-#define SIG_UART3_DATA SIG_USART3_DATA
+#ifndef USART3_UDRE_vect
+#if defined(SIG_USART3_DATA)
+#define USART3_UDRE_vect SIG_USART3_DATA
+#elif defined(SIG_UART3_DATA)
+#define USART3_UDRE_vect SIG_UART3_DATA
#endif
#endif
-SIGNAL(SIG_UART3_DATA)
+SIGNAL(USART3_UDRE_vect)
{
uart_send_next_char(3);
}
* a new unread data in the reception buffer.
*/
#ifdef UART0_COMPILE
-#ifndef SIG_UART0_RECV
+#ifndef USART0_RX_vect
#if defined(USART_RX_vect)
-#define SIG_UART0_RECV USART_RX_vect
-#elif defined(USART0_RX_vect)
-#define SIG_UART0_RECV USART0_RX_vect
+#define USART0_RX_vect USART_RX_vect
#elif defined(SIG_USART0_RECV)
-#define SIG_UART0_RECV SIG_USART0_RECV
+#define USART0_RX_vect SIG_USART0_RECV
+#elif defined(SIG_UART0_RECV)
+#define USART0_RX_vect SIG_UART0_RECV
#endif
#endif
-SIGNAL(SIG_UART0_RECV)
+SIGNAL(USART0_RX_vect)
{
uart_recv_next_char(0);
}
#endif
#ifdef UART1_COMPILE
-#ifndef SIG_UART1_RECV
-#if defined(USART1_RX_vect)
-#define SIG_UART1_RECV USART1_RX_vect
-#elif defined(SIG_USART1_RECV)
-#define SIG_UART1_RECV SIG_USART1_RECV
+#ifndef USART1_RX_vect
+#if defined(SIG_USART1_RECV)
+#define USART1_RX_vect SIG_USART1_RECV
+#elif defined(SIG_UART1_RECV)
+#define USART1_RX_vect SIG_UART1_RECV
#endif
#endif
-SIGNAL(SIG_UART1_RECV)
+SIGNAL(USART1_RX_vect)
{
uart_recv_next_char(1);
}
#endif
#ifdef UART2_COMPILE
-#ifndef SIG_UART2_RECV
-#if defined(USART2_RX_vect)
-#define SIG_UART2_RECV USART2_RX_vect
-#elif defined(SIG_USART2_RECV)
-#define SIG_UART2_RECV SIG_USART2_RECV
+#ifndef USART2_RX_vect
+#if defined(SIG_USART2_RECV)
+#define USART2_RX_vect SIG_USART2_RECV
+#elif defined(SIG_UART2_RECV)
+#define USART2_RX_vect SIG_UART2_RECV
#endif
#endif
-SIGNAL(SIG_UART2_RECV)
+SIGNAL(USART2_RX_vect)
{
uart_recv_next_char(2);
}
#endif
#ifdef UART3_COMPILE
-#ifndef SIG_UART3_RECV
-#if defined(USART3_RX_vect)
-#define SIG_UART3_RECV USART3_RX_vect
-#elif defined(SIG_USART3_RECV)
-#define SIG_UART3_RECV SIG_USART3_RECV
+#ifndef USART3_RX_vect
+#if defined(SIG_USART3_RECV)
+#define USART3_RX_vect SIG_USART3_RECV
+#elif defined(SIG_UART3_RECV)
+#define USART3_RX_vect SIG_UART3_RECV
#endif
#endif
-SIGNAL(SIG_UART3_RECV)
+SIGNAL(USART3_RX_vect)
{
uart_recv_next_char(3);
}
#endif\r
\r
\r
-/* For arch with only one UART, we consider that UART0 = UART */\r
-#if !defined(SIG_UART0_DATA) && !defined(SIG_USART0_DATA)\r
-#if defined SIG_UART_DATA\r
-#define SIG_UART0_DATA SIG_UART_DATA\r
-#elif defined SIG_USART_DATA\r
-#define SIG_UART0_DATA SIG_USART_DATA\r
-#endif\r
-#endif\r
-\r
-#if !defined(SIG_UART0_RECV) && !defined(SIG_USART0_RECV)\r
-#if defined SIG_UART_RECV\r
-#define SIG_UART0_RECV SIG_UART_RECV\r
-#elif defined SIG_USART_RECV\r
-#define SIG_UART0_RECV SIG_USART_RECV\r
-#endif\r
-#endif\r
-\r
#if !defined(UDR0) && defined(UDR)\r
#define UDR0 UDR\r
#endif\r
\r
\r
/* if the signal USART is defined, the uC has a USART. */\r
-#if ( defined SIG_USART0_RECV ) || ( defined SIG_USART_RECV )\r
-#define UART_IS_USART 1\r
-#elif (defined USART_UDRE_vect) || (defined USART_TXC_vect) || (defined USART_RXC_vect)\r
-#define UART_IS_USART 1\r
-#elif (defined USART1_UDRE_vect) || (defined USART1_TXC_vect) || (defined USART1_RXC_vect)\r
-#define UART_IS_USART 1\r
-#else\r
+#if defined(UART_TX_vect)\r
#define UART_IS_USART 0\r
+#else\r
+#define UART_IS_USART 1\r
#endif\r
\r
/* if the U2X macro is defined, the uC has the U2X option. */\r
{
/* number of bit in the frame */
if (u->nbits == 8)
- *uart_regs[num].ucsrb &= ~(1 << CHR9);
+ *uart_regs[num].ucsrb &= ~(1 << UCSZ2);
#ifdef CONFIG_MODULE_UART_9BITS
else if (u->nbits == 9)
- *uart_regs[num].ucsrb |= (1 << CHR9);
+ *uart_regs[num].ucsrb |= (1 << UCSZ2);
#endif
else
return ENOTSUP;