diff --git a/software/AVR8/.clang_complete b/software/AVR8/.clang_complete index 7a4710a..98429a4 100644 --- a/software/AVR8/.clang_complete +++ b/software/AVR8/.clang_complete @@ -1,3 +1,4 @@ +-I../sss7core -I/usr/avr/include -D__AVR_ATmega8__ -DF_CPU=16000000 diff --git a/software/AVR8/Makefile b/software/AVR8/Makefile index 4d8b1fa..e77cded 100644 --- a/software/AVR8/Makefile +++ b/software/AVR8/Makefile @@ -4,8 +4,8 @@ ISPPORT ?= /dev/kaboard VERSION = 0.1 -HEADERS = sss7.h uart.h timer.h -SRC = main.c sss7.c uart.c timer.c +HEADERS = ../sss7core/sss7.h uart.h timer.h +SRC = main.c ../sss7core/sss7.c uart.c timer.c TARGET = sss7 OBJDIR = bin @@ -16,7 +16,7 @@ SIZE = avr-size OBJ = $(SRC:%.c=$(OBJDIR)/$(AVRMCU)/%.o) -CFLAGS = -Os -Wall -Wstrict-prototypes +CFLAGS = -I ../sss7core/ -Os -Wall -Wstrict-prototypes CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -fshort-enums -fpack-struct -funsigned-char -funsigned-bitfields CFLAGS += -mmcu=$(AVRMCU) -DF_CPU=$(F_CPU)UL -DVERSION=$(VERSION) diff --git a/software/AVR8/uart.c b/software/AVR8/uart.c index 3b1b427..8c90c55 100644 --- a/software/AVR8/uart.c +++ b/software/AVR8/uart.c @@ -25,7 +25,14 @@ void uart_init(void) { UCSRB |= (1 << TXCIE) | (1 << RXCIE); // enable tx and rx interrupts } +uint8_t uart_get_byte(void) { + uint8_t byte = UDR; + return byte; +} +void uart_put_byte(uint8_t byte) { + UDR = byte; +} ISR(USART_RXC_vect) { sss7_process_rx(); } diff --git a/software/AVR8/uart.h b/software/AVR8/uart.h index 1f6c59d..48dbde5 100644 --- a/software/AVR8/uart.h +++ b/software/AVR8/uart.h @@ -17,13 +17,6 @@ void uart_init(void); -static inline uint8_t uart_get_byte(void) { - uint8_t byte = UDR; - return byte; -} -static inline void uart_put_byte(uint8_t byte) { - UDR = byte; -} #endif diff --git a/software/AVR8/sss7.c b/software/sss7core/sss7.c similarity index 99% rename from software/AVR8/sss7.c rename to software/sss7core/sss7.c index 023e225..c2f971b 100644 --- a/software/AVR8/sss7.c +++ b/software/sss7core/sss7.c @@ -2,8 +2,6 @@ #include -#include "uart.h" - volatile enum sss7State sss7_state; uint8_t sss7_rx_buffer[SSS7_RX_BUFFER_COUNT][SSS7_PAYLOAD_SIZE]; diff --git a/software/AVR8/sss7.h b/software/sss7core/sss7.h similarity index 93% rename from software/AVR8/sss7.h rename to software/sss7core/sss7.h index 15770e5..7e82f8e 100644 --- a/software/AVR8/sss7.h +++ b/software/sss7core/sss7.h @@ -31,6 +31,9 @@ void sss7_process_rx(void); void sss7_process_tx(void); void sss7_process_ticks(uint16_t ticks); +extern void uart_put_byte(uint8_t byte); +extern uint8_t uart_get_byte(void); + void sss7_init(void);