-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassert.h
More file actions
executable file
·40 lines (34 loc) · 1.23 KB
/
assert.h
File metadata and controls
executable file
·40 lines (34 loc) · 1.23 KB
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
/**
* @file assert.h
*
* @date 2019-10-09
* @author your name (you@domain.com)
*
* @brief Assertion
*/
#ifndef ASSERT_H
#define ASSERT_H
#include "compiler.h"
#include "reset.h"
#include "util/concatstr.h"
/** @brief assert message prefix */
#define ASSERT_MSG_PRFX \
"[" __FILE__ ":" CONCATSTR(__LINE__) "] "
/** @brief assert check implementation. If condition is not met then an endless
* loop will be executed
*
* @param x condition to be checked
* @param msg constant message pointer to be stored in the within error
* reporting placeholder
* @param info additional pointer info
* */
#define assert(x, msg) \
/* protect from compilers */ \
do { \
/* check condition */ \
if (!(x)) { \
/* reset the mcu */ \
Reset_ResetMCU(); \
} \
} while (0)
#endif /* ASSERT_H */