-
Notifications
You must be signed in to change notification settings - Fork 2
/
version.h
63 lines (54 loc) · 1.42 KB
/
version.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
/*
* version.h
*
* Created on: 15-03-2016
* Author: Tomek
*/
#ifndef VERSION_H_
#define VERSION_H_
#include <stdint.h>
/* software version: major */
#ifndef VERSION_SW_MAJOR
#define VERSION_SW_MAJOR 1
#endif
/* software version: minor */
#ifndef VERSION_SW_MINOR
#define VERSION_SW_MINOR 0
#endif
/* software version: build */
#ifndef VERSION_SW_BUILD
#define VERSION_SW_BUILD 0
#endif
/* hardware version: major */
#ifndef VERSION_HW_MAJOR
#define VERSION_HW_MAJOR 1
#endif
/* hardware version: minor */
#ifndef VERSION_HW_MINOR
#define VERSION_HW_MINOR 0
#endif
/* hardware version: build */
#ifndef VERSION_HW_BUILD
#define VERSION_HW_BUILD 0
#endif
/* this is a helper to covert numbers to strings */
#define _VERSION_CONCATSTR(x) #x
#define VERSION_CONCATSTR(x) _VERSION_CONCATSTR(x)
/* software version as a string */
#define VERSION_SW_STR \
VERSION_CONCATSTR(VERSION_SW_MAJOR) "." \
VERSION_CONCATSTR(VERSION_SW_MINOR) "." \
VERSION_CONCATSTR(VERSION_SW_BUILD)
/* hardware version as a string */
#define VERSION_HW_STR \
VERSION_CONCATSTR(VERSION_HW_MAJOR) "." \
VERSION_CONCATSTR(VERSION_HW_MINOR) "." \
VERSION_CONCATSTR(VERSION_HW_BUILD)
/* version type */
typedef struct version {
/* build number */
uint16_t build;
/* minor and major version numbers */
uint8_t minor, major;
} version_t;
#endif /* VERSION_H_ */