forked from gicking/stm8gal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
83 lines (57 loc) · 1.5 KB
/
main.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
\file main.h
\author G. Icking-Konert
\date 2014-03-15
\version 0.1
\brief main header and declaration of global variables
main header with global macros and global variable declaration.
All global variables start with "g_" to indicate their scope.
*/
// for including file only once
#ifndef _MAIN_H_
#define _MAIN_H_
/*******
global includes
*******/
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
/*******
global macros
*******/
/// max length of strings, e.g. filenames
#define STRLEN 1000
/// UART communication timeout
#define TIMEOUT 1000
/// max. number of bootloader synchronization attempts
#define RETRY 15
// activate debug output
//#define DEBUG
/*******
global typedefs
*******/
/// verbosity level in readable way, from no output to very chatty
typedef enum {MUTE=0, SILENT, INFORM, CHATTY} verbose_t;
/// physical bootloader interface
#if defined(USE_SPIDEV)
typedef enum {UART=0, SPI_ARDUINO, SPI_SPIDEV} physInterface_t;
#else
typedef enum {UART=0, SPI_ARDUINO} physInterface_t;
#endif
/*******
global variables
*******/
/// define globals only once (with _MAIN_ defined)
#ifdef _MAIN_
#define global
#else
#define global extern
#endif
/// wait for \<return\> prior to closing console window
global bool g_pauseOnExit;
/// optimize for background operation, e.g. skip prompts and console colors
global bool g_backgroundOperation;
// undefine global keyword
#undef global
#endif // _MAIN_H_
// end of file