diff options
Diffstat (limited to 'examples/usartecho/echo.c')
-rw-r--r-- | examples/usartecho/echo.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/usartecho/echo.c b/examples/usartecho/echo.c new file mode 100644 index 0000000..4d978f7 --- /dev/null +++ b/examples/usartecho/echo.c @@ -0,0 +1,25 @@ +#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() { + DDRB |= _BV(DDB1) | _BV(DDB2); + 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); +} + + |