-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
44 lines (41 loc) · 590 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* UART_TEST
* main.c
*
* Created on: 29 paź 2017
* Author: zbyszek
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "uart.h"
#include <string.h>
#include <stdio.h>
#define LED_DDR DDRB
#define LED_PORT PORTB
#define LED_PIN PB5
#define LED_TOGGLE() (LED_PORT ^= 1<<LED_PIN)
int main()
{
initUART();
RX_INTEN();//enable RX interrupt
sei();
while(1)
{
//main loop
}
}
ISR(USART_RX_vect)
{
LED_TOGGLE();
char c = getByte();
switch(c)
{
case 13://CR
writeString("\r\n");
break;
default:
putByte((char)'X');
break;
}
}