4 This test case enables uart RX interupts, does a "printf" and then receive characters
5 via the interupt handler until it reaches a \r.
7 This tests the uart reception fifo system. It relies on the uart "irq" input and output
8 to be wired together (see simavr.c)
13 #include <avr/interrupt.h>
14 #include <avr/eeprom.h>
15 #include <avr/sleep.h>
18 * This demonstrate how to use the avr_mcu_section.h file
19 * The macro adds a section to the ELF file with useful
20 * information for the simulator
22 #include "avr_mcu_section.h"
23 AVR_MCU(F_CPU, "atmega88");
26 static int uart_putchar(char c, FILE *stream) {
28 uart_putchar('\r', stream);
29 loop_until_bit_is_set(UCSR0A, UDRE0);
34 static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
37 volatile uint8_t bindex = 0;
39 volatile uint8_t done = 0;
55 UCSR0B |= (1 << RXCIE0) | (1 << RXEN0) | (1 << TXEN0);
58 printf("Hey there, this should be received back\n");
64 printf("Received: %s", buffer);
66 // this quits the simulator, since interupts are off
67 // this is a "feature" that allows running tests cases and exit