OpenWareLaboratory
message.h
Go to the documentation of this file.
1 #ifndef __MESSAGE_H
2 #define __MESSAGE_H
3 
4 #include <stdint.h>
5 
6 /* #ifdef DDEBUG */
7 /* #define DEBUG_ASSERT(cond, msg) if(!(cond)){debugAssertFailed(msg, __FILE__, __LINE__);} */
8 /* #else */
9 /* #define DEBUG_ASSERT(x, y) */
10 /* #endif */
11 /* #define ASSERT_TRUE(cond) if(!(cond)){debugAssertFailed("Assertion failed", __PRETTY_FUNCTION__, __LINE__);} */
12 /* #define ASSERT_FALSE(cond) if(cond){debugAssertFailed("Assertion failed", __PRETTY_FUNCTION__, __LINE__);} */
13 /* #define ASSERT(cond, msg) if(!(cond)){debugAssertFailed(msg, __PRETTY_FUNCTION__, __LINE__);} */
14 
15 #ifndef NDEBUG
16 #define ASSERT(cond, msg) if(!(cond)){assert_failed(msg, __PRETTY_FUNCTION__, __LINE__);}
17 #else
18 #define ASSERT(cond, msg)
19 #endif
20 
21 #ifndef CHECKSUM_ERROR_STATUS
22 #define CHECKSUM_ERROR_STATUS -10
23 #endif
24 #ifndef OUT_OF_MEMORY_ERROR_STATUS
25 #define OUT_OF_MEMORY_ERROR_STATUS -20
26 #endif
27 #ifndef CONFIGURATION_ERROR_STATUS
28 #define CONFIGURATION_ERROR_STATUS -30
29 #endif
30 #ifndef PROGRAM_ERROR_STATUS
31 #define PROGRAM_ERROR_STATUS -40
32 #endif
33 
34 #ifdef __cplusplus
35  extern "C" {
36 #endif
37 
38  char* msg_itoa(int val, int base);
39  char* msg_ftoa(float val, int base);
40 
41  void debugMessage(const char* msg);
42  void error(int8_t code, const char* reason);
43  void assert_failed(const char* msg, const char* location, int line);
44 
45 #ifdef __cplusplus
46 }
47 
48 void debugMessage(const char* msg, int);
49 void debugMessage(const char* msg, int, int);
50 void debugMessage(const char* msg, int, int, int);
51 void debugMessage(const char* msg, float);
52 void debugMessage(const char* msg, float, float);
53 void debugMessage(const char* msg, float, float, float);
54 void assert_failed(uint8_t* location, uint32_t line);
55 
56 #endif
57 
58 #endif /* __MESSAGĀ£_H */
char * msg_itoa(int val, int base)
void debugMessage(const char *msg)
char * msg_ftoa(float val, int base)
void error(int8_t code, const char *reason)
void assert_failed(const char *msg, const char *location, int line)