add code folder - dont really know
This commit is contained in:
20
code/inc/fifo.h
Normal file
20
code/inc/fifo.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _FIFO_H_
|
||||
#define _FIFO_H_
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
#define FIFO_FAIL 0
|
||||
#define FIFO_SUCCESS 1
|
||||
|
||||
#define FIFO_SIZE 128
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[FIFO_SIZE];
|
||||
uint8_t read; // zeigt auf das Feld mit dem ältesten Inhalt
|
||||
uint8_t write; // zeigt immer auf leeres Feld
|
||||
} Fifo_t;
|
||||
|
||||
uint8_t fifo_push(Fifo_t * fifo, uint8_t byte);
|
||||
uint8_t fifo_pop(Fifo_t * fifo, uint8_t *pByte);
|
||||
|
||||
#endif
|
||||
15
code/inc/uart.h
Normal file
15
code/inc/uart.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _UART_H_
|
||||
#define _UART_H_
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "fifo.h"
|
||||
|
||||
extern Fifo_t uart0_rx_buffer;
|
||||
extern Fifo_t uart0_tx_buffer;
|
||||
|
||||
|
||||
void init_uart(void);
|
||||
//void putchar(char c);
|
||||
char get_uart0_char(void);
|
||||
|
||||
#endif
|
||||
12
code/inc/util.h
Normal file
12
code/inc/util.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _UTIL_H_
|
||||
#define _UTIL_H_
|
||||
|
||||
void delay(int ms);
|
||||
static void printchar(char **str, int c);
|
||||
static int prints(char **out, const char *string, int width, int pad);
|
||||
static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase);
|
||||
static int print(char **out, int *varg);
|
||||
int printf(const char *format, ...);
|
||||
int sprintf(char *out, const char *format, ...);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user