HomeAut
formattedMessage.h
1 /*
2  * formattedMessage.h
3  *
4  * Created on: 2016.09.10
5  * Author: Vizi Gábor
6  * E-mail: vizi.gabor90@gmail.com
7  * Function: Formatted (colored / backgroundcolor) message
8  * Target: STM32Fx
9  * Version: v4
10  * Last modified: 2016.09.28
11  */
12 
13 #ifndef FORMATTEDMESSAGE_H_
14 #define FORMATTEDMESSAGE_H_
15 
16 
17 
18 /*------------------------------------------------------------------------------
19  * Macros & definitions
20  *----------------------------------------------------------------------------*/
21 
22 // Example:
23 // USART_SendString("\x1B" "[30m"); = Black text color
24 
25 #define USART_ESCAPE_TEXT_START "\x1B" "[3"
26 #define USART_ESCAPE_TEXT_END "m"
27 
28 // Example:
29 // USART_SendString("\x1B" "[47m"); = White background color
30 #define USART_ESCAPE_BACKGROUND_START "\x1B" "[4"
31 #define USART_ESCAPE_BACKGROUND_END "m"
32 
33 
34 
35 /*------------------------------------------------------------------------------
36  * Type definitions
37  *----------------------------------------------------------------------------*/
38 
44 typedef enum
45 {
46  Color_Black = 0,
47  Color_Red,
48  Color_Green,
49  Color_Yellow,
50  Color_Blue,
51  Color_Magenta,
52  Color_Cyan,
53  Color_White
54 } FormattedStringColors_t;
55 
56 
57 
58 /*------------------------------------------------------------------------------
59  * Global function declarations
60  *----------------------------------------------------------------------------*/
61 
62 void SendColouredMessageWithBackgroundColor(const char* message,
63  FormattedStringColors_t textColor,
64  FormattedStringColors_t backgroundColor);
65 void SendColouredMessage(const char* message, FormattedStringColors_t textColor);
66 void SendTextColor(FormattedStringColors_t textColor);
67 void SendBackgroundColor(FormattedStringColors_t backgroundColor);
68 void SendErrorMessage(const char *message);
69 
70 void FormattedMessage_Test(void);
71 
72 
73 
74 #endif /* FORMATTEDMESSAGE_H_ */