Out-of-office display, GFX
 All Classes Files Functions Variables Enumerations Enumerator Groups
uartDriver.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Andreas Misje
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
25 #ifndef UARTDRIVER_H
26 #define UARTDRIVER_H
27 
28 #include <stddef.h>
29 #include <stdbool.h>
30 
38 #define UART_RX_RINGBUFFER_SIZE 20
39 
43 #define UART_ENABLE_INPUT_PARSER
44 
45 #ifdef UART_ENABLE_INPUT_PARSER
46 
50 #define UART_CMD_ARG_LEN 10
51 
55 struct command
56 {
61  const char *command;
72  void ( *callback )( const char *arg );
73 };
74 
87 void uart_init( struct command *commands, size_t numCommands );
88 
89 #else
90 
96 void uart_init();
97 
98 #endif // UART_ENABLE_INPUT_PARSER
99 
100 #ifdef UART_ENABLE_INPUT_PARSER
101 
113 void uart_runCmdCallbacks();
114 #endif // UART_ENABLE_INPUT_PARSER
115 
125 size_t uart_copyBuffer( char *buffer, size_t len );
126 
127 #endif // UARTDRIVER_H
128