Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
microrlConfig.h
Go to the documentation of this file.
1 /*
2 Microrl library config files
3 Autor: Eugene Samoylov aka Helius (ghelius@gmail.com)
4 */
5 #ifndef _MICRORL_CONFIG_H_
6 #define _MICRORL_CONFIG_H_
7 
8 #define MICRORL_LIB_VER "1.5"
9 
10 /*********** CONFIG SECTION **************/
11 /*
12 Command line length, define cmdline buffer size. Set max number of chars + 1,
13 because last byte of buffer need to contain '\0' - NULL terminator, and
14 not use for storing inputed char.
15 If user input chars more then it parametrs-1, chars not added to command line.*/
16 #define _COMMAND_LINE_LEN (1+100) // for 32 chars
17 
18 /*
19 Command token number, define max token it command line, if number of token
20 typed in command line exceed this value, then prints message about it and
21 command line not to be parced and 'execute' callback will not calls.
22 Token is word separate by white space, for example 3 token line:
23 "IRin> set mode test" */
24 #define _COMMAND_TOKEN_NMB 30
25 
26 /*
27 Define you prompt string here. You can use colors escape code, for highlight you prompt,
28 for example this prompt will green color (if you terminal supports color)*/
29 #define _PROMPT_DEFAUTL "\033[32mpprz >\033[0m " // green color
30 
31 /*
32 Define prompt text (without ESC sequence, only text) prompt length, it needs because if you use
33 ESC sequence, it's not possible detect only text length*/
34 #define _PROMPT_LEN 7
35 
36 /*Define it, if you wanna use completion functional, also set completion callback in you code,
37 now if user press TAB calls 'copmlitetion' callback. If you no need it, you can just set
38 NULL to callback ptr and do not use it, but for memory saving tune,
39 if you are not going to use it - disable this define.*/
40 #define _USE_COMPLETE
41 
42 /*Define it, if you wanna use history. It s work's like bash history, and
43 set stored value to cmdline, if UP and DOWN key pressed. Using history add
44 memory consuming, depends from _RING_HISTORY_LEN parametr */
45 #define _USE_HISTORY
46 
47 /*
48 History ring buffer length, define static buffer size.
49 For saving memory, each entered cmdline store to history in ring buffer,
50 so we can not say, how many line we can store, it depends from cmdline len,
51 but memory using more effective. We not prefer dinamic memory allocation for
52 small and embedded devices. Overhead is 2 char on each saved line*/
53 #define _RING_HISTORY_LEN 256
54 
55 /*
56 Enable Handling terminal ESC sequence. If disabling, then cursor arrow, HOME, END will not work,
57 use Ctrl+A(B,F,P,N,A,E,H,K,U,C) see README, but decrease code memory.*/
58 #define _USE_ESC_SEQ
59 
60 /*
61 Use snprintf from you standard complier library, but it gives some overhead.
62 If not defined, use my own u16int_to_str variant, it's save about 800 byte of code size
63 on AVR (avr-gcc build).
64 Try to build with and without, and compare total code size for tune library.
65 */
66 //#define _USE_LIBC_STDIO
67 
68 /*
69 Enable 'interrupt signal' callback, if user press Ctrl+C */
70 #define _USE_CTLR_C
71 
72 /*
73 Print prompt at 'microrl_init', if enable, prompt will print at startup,
74 otherwise first prompt will print after first press Enter in terminal
75 NOTE!: Enable it, if you call 'microrl_init' after your communication subsystem
76 already initialize and ready to print message */
77 #undef _ENABLE_INIT_PROMPT
78 
79 /*
80 New line symbol */
81 #define _ENDL_CR
82 
83 #if defined(_ENDL_CR)
84 #define ENDL "\r\n"
85 #elif defined(_ENDL_CRLF)
86 #define ENDL "\r\n"
87 #elif defined(_ENDL_LF)
88 #define ENDL "\n"
89 #elif defined(_ENDL_LFCR)
90 #define ENDL "\n\r"
91 #else
92 #error "You must define new line symbol."
93 #endif
94 
95 /********** END CONFIG SECTION ************/
96 
97 
98 #if _RING_HISTORY_LEN > 256
99 #error "This history implementation (ring buffer with 1 byte iterator) allow 256 byte buffer size maximum"
100 #endif
101 
102 #endif