Seperated core logic from avr8 code
This commit is contained in:
parent
ba28f387ef
commit
d79ddb8ee7
|
@ -1,3 +1,4 @@
|
||||||
|
-I../sss7core
|
||||||
-I/usr/avr/include
|
-I/usr/avr/include
|
||||||
-D__AVR_ATmega8__
|
-D__AVR_ATmega8__
|
||||||
-DF_CPU=16000000
|
-DF_CPU=16000000
|
||||||
|
|
|
@ -4,8 +4,8 @@ ISPPORT ?= /dev/kaboard
|
||||||
|
|
||||||
VERSION = 0.1
|
VERSION = 0.1
|
||||||
|
|
||||||
HEADERS = sss7.h uart.h timer.h
|
HEADERS = ../sss7core/sss7.h uart.h timer.h
|
||||||
SRC = main.c sss7.c uart.c timer.c
|
SRC = main.c ../sss7core/sss7.c uart.c timer.c
|
||||||
TARGET = sss7
|
TARGET = sss7
|
||||||
OBJDIR = bin
|
OBJDIR = bin
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ SIZE = avr-size
|
||||||
|
|
||||||
OBJ = $(SRC:%.c=$(OBJDIR)/$(AVRMCU)/%.o)
|
OBJ = $(SRC:%.c=$(OBJDIR)/$(AVRMCU)/%.o)
|
||||||
|
|
||||||
CFLAGS = -Os -Wall -Wstrict-prototypes
|
CFLAGS = -I ../sss7core/ -Os -Wall -Wstrict-prototypes
|
||||||
CFLAGS += -ffunction-sections -fdata-sections
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
CFLAGS += -fshort-enums -fpack-struct -funsigned-char -funsigned-bitfields
|
CFLAGS += -fshort-enums -fpack-struct -funsigned-char -funsigned-bitfields
|
||||||
CFLAGS += -mmcu=$(AVRMCU) -DF_CPU=$(F_CPU)UL -DVERSION=$(VERSION)
|
CFLAGS += -mmcu=$(AVRMCU) -DF_CPU=$(F_CPU)UL -DVERSION=$(VERSION)
|
||||||
|
|
|
@ -25,7 +25,14 @@ void uart_init(void) {
|
||||||
UCSRB |= (1 << TXCIE) | (1 << RXCIE); // enable tx and rx interrupts
|
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) {
|
ISR(USART_RXC_vect) {
|
||||||
sss7_process_rx();
|
sss7_process_rx();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,6 @@
|
||||||
|
|
||||||
void uart_init(void);
|
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
|
#endif
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "uart.h"
|
|
||||||
|
|
||||||
volatile enum sss7State sss7_state;
|
volatile enum sss7State sss7_state;
|
||||||
|
|
||||||
uint8_t sss7_rx_buffer[SSS7_RX_BUFFER_COUNT][SSS7_PAYLOAD_SIZE];
|
uint8_t sss7_rx_buffer[SSS7_RX_BUFFER_COUNT][SSS7_PAYLOAD_SIZE];
|
|
@ -31,6 +31,9 @@ void sss7_process_rx(void);
|
||||||
void sss7_process_tx(void);
|
void sss7_process_tx(void);
|
||||||
void sss7_process_ticks(uint16_t ticks);
|
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);
|
void sss7_init(void);
|
||||||
|
|
Loading…
Reference in New Issue