-
Notifications
You must be signed in to change notification settings - Fork 0
/
uart0.h
52 lines (43 loc) · 1.63 KB
/
uart0.h
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
42
43
44
45
46
47
48
49
50
51
52
// UART0 Library - Lab5
// Nathan Fusselman
//-----------------------------------------------------------------------------
// Hardware Target
//-----------------------------------------------------------------------------
// Target Platform: EK-TM4C123GXL
// Target uC: TM4C123GH6PM
// System Clock: -
// Hardware configuration:
// UART Interface:
// U0TX (PA1) and U0RX (PA0) are connected to the 2nd controller
// The USB on the 2nd controller enumerates to an ICDI interface and a virtual COM port
//-----------------------------------------------------------------------------
// Device includes, defines, and assembler directives
//-----------------------------------------------------------------------------
#ifndef UART0_H_
#define UART0_H_
#define MAX_CHARS 80
#define MAX_FIELDS 5
typedef struct _USER_DATA {
char buffer[MAX_CHARS+1];
uint8_t fieldCount;
uint8_t fieldPosition[MAX_FIELDS];
char fieldType[MAX_FIELDS];
} USER_DATA;
//-----------------------------------------------------------------------------
// Subroutines
//-----------------------------------------------------------------------------
void initUart0();
void setUart0BaudRate(uint32_t baudRate, uint32_t fcyc);
void putbUart0(bool);
void putiUart0(uint32_t);
void putcUart0(char c);
void putsUart0(char* str);
char getcUart0();
void getsUart0(USER_DATA* data);
void parseFields(USER_DATA* data);
char* getFieldString(USER_DATA* data, uint8_t fieldNumber);
int32_t getFieldInteger(USER_DATA* data, uint8_t fieldNumber);
bool isCommand(USER_DATA* data, const char strCommand[], uint8_t minArguments);
bool stringCompare(char* a, char* b);
bool kbhitUart0();
#endif