summaryrefslogtreecommitdiffstats
path: root/stdio.c
blob: c12a9ab55b6da4abb77e66189abb21e2bb0eff40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "project.h"

static int
stdio_uart_putchar (char var, FILE * stream)
{

  if (var == '\n')
    uart_putc ('\r');
  uart_putc (var);
  return 0;
}


static FILE stdio_uart_stdout =
FDEV_SETUP_STREAM (stdio_uart_putchar, NULL, _FDEV_SETUP_WRITE);

void
stdio_init (void)
{
  stdout = &stdio_uart_stdout;

  uart_init (UART_BAUD_SELECT (UART_BAUD_RATE, F_CPU));
  sei ();
}