aboutsummaryrefslogtreecommitdiff
path: root/examples/usartecho/echo.c
blob: 4ba93641c1d94ebf62a1517e14ff49c71aa34fd0 (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 <avr/io.h>
#include <util/delay.h>
#include <string.h>
#include "../../usart.h"

void rec(uint8_t data) {
    if (data)
        usart_send(data);
}

int main() {
    usart_init_uart();
    SREG |= _BV(7);
    usart_send('a');
    usart_send('b');
    usart_send('c');
    usart_send('d');
    usart_send_str("\n\rHello, there is UART echo!\n\r");
    usart_receive = rec;

    while (1);
}