summaryrefslogtreecommitdiff
path: root/include/Serial.h
blob: a1ec824d97a0381637f803dcfa85b5ddf2a6b572 (plain) (blame)
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
#ifndef SERIAL_H
#define SERIAL_H

/* *************************************
 *  Includes
 * *************************************/

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define SERIAL_DATA_PACKET_SIZE 8
#define ACK_BYTE_STRING "b"

enum
{
    FIFO_SZ = 132
};

typedef volatile struct
{
    unsigned char buf[FIFO_SZ];
    size_t pending, processed;
    bool full;
} fifo;

extern fifo rx;

void SerialInit(void);
void SerialWrite(unsigned char byte);

#ifdef __cplusplus
}
#endif

#endif /* SERIAL_H */