initial commit, compiles for ATTINY84 with TX on PA5 and RX on PA6

This commit is contained in:
juraj
2020-02-21 20:48:19 +01:00
commit 95ccf534a4
7 changed files with 400 additions and 0 deletions

27
fifo.c Normal file
View File

@@ -0,0 +1,27 @@
#include "fifo.h"
void fifo_init (fifo_t *f, uint8_t *buffer, const uint8_t size)
{
f->count = 0;
f->pread = f->pwrite = buffer;
f->read2end = f->write2end = f->size = size;
}
uint8_t fifo_put (fifo_t *f, const uint8_t data)
{
return _inline_fifo_put (f, data);
}
uint8_t fifo_get_wait (fifo_t *f)
{
while (!f->count);
return _inline_fifo_get (f);
}
int fifo_get_nowait (fifo_t *f)
{
if (!f->count) return -1;
return (int) _inline_fifo_get (f);
}