Mercurial > public > ostc4
comparison BootLoader/Src/tInfoBootloader.c @ 5:e65d01b6a17e
MOVE files for other applications
author | JeanDo |
---|---|
date | Fri, 15 Dec 2017 01:45:20 +0100 |
parents | |
children | 97eafbcb81a9 |
comparison
equal
deleted
inserted
replaced
4:89a87ddc2e47 | 5:e65d01b6a17e |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file tInfoBootloader.c | |
4 * @author heinrichs/weikamp, Christian Weikamp | |
5 * @version V0.0.1 | |
6 * @date 08-May-2015 | |
7 * @brief Write something on the screen in between steps | |
8 * | |
9 @verbatim | |
10 ============================================================================== | |
11 ##### How to use ##### | |
12 ============================================================================== | |
13 * a little bit of text (DMA is not running for fast clean) | |
14 @endverbatim | |
15 ****************************************************************************** | |
16 * @attention | |
17 * | |
18 * <h2><center>© COPYRIGHT(c) 2015 heinrichs weikamp</center></h2> | |
19 * | |
20 ****************************************************************************** | |
21 */ | |
22 | |
23 /* Includes ------------------------------------------------------------------*/ | |
24 #include <string.h> | |
25 #include "base_bootloader.h" | |
26 #include "ostc.h" | |
27 #include "tInfoBootloader.h" | |
28 #include "gfx_engine.h" | |
29 #include "gfx_colors.h" | |
30 /* Exported variables --------------------------------------------------------*/ | |
31 | |
32 /* Private variables ---------------------------------------------------------*/ | |
33 | |
34 GFX_DrawCfgScreen tIBscreen; | |
35 GFX_DrawCfgWindow tIBwindow; | |
36 uint8_t line = 1; | |
37 | |
38 char textButtonLeft[30] = { 0 }; | |
39 char textButtonMid[31] = { 0 }; | |
40 char textButtonRight[31] = { 0 }; | |
41 | |
42 /* Private types -------------------------------------------------------------*/ | |
43 | |
44 /* Private function prototypes -----------------------------------------------*/ | |
45 | |
46 /* Exported functions --------------------------------------------------------*/ | |
47 | |
48 void tInfoBootloader_init(void) | |
49 { | |
50 tIBscreen.FBStartAdress = 0; | |
51 tIBscreen.ImageHeight = 480; | |
52 tIBscreen.ImageWidth = 800; | |
53 tIBscreen.LayerIndex = 1; | |
54 | |
55 tIBwindow.Image = &tIBscreen; | |
56 tIBwindow.WindowNumberOfTextLines = 6; | |
57 tIBwindow.WindowLineSpacing = 65; | |
58 tIBwindow.WindowTab = 400; | |
59 tIBwindow.WindowX0 = 20; | |
60 tIBwindow.WindowX1 = 779; | |
61 tIBwindow.WindowY0 = 0; | |
62 tIBwindow.WindowY1 = 799; | |
63 | |
64 line = 1; | |
65 } | |
66 | |
67 | |
68 void tInfo_button_text(const char *text_left, const char *text_mid, const char *text_right) | |
69 { | |
70 if(text_left) | |
71 strncpy(textButtonLeft,text_left,30); | |
72 if(text_mid) | |
73 { | |
74 textButtonMid[0] = '\001'; | |
75 strncpy(&textButtonMid[1],text_mid,30); | |
76 } | |
77 if(text_right) | |
78 { | |
79 textButtonRight[0] = '\002'; | |
80 strncpy(&textButtonRight[1],text_right,30); | |
81 } | |
82 } | |
83 | |
84 | |
85 void tInfo_newpage(const char *text) | |
86 { | |
87 uint32_t backup = tIBscreen.FBStartAdress; | |
88 | |
89 tIBscreen.FBStartAdress = getFrame(18); | |
90 line = 1; | |
91 if(text) | |
92 GFX_write_string(&FontT48, &tIBwindow, text,line); | |
93 line++; | |
94 | |
95 if(*textButtonLeft) | |
96 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonLeft,CLUT_ButtonSurfaceScreen); | |
97 if(*textButtonMid) | |
98 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonMid,CLUT_ButtonSurfaceScreen); | |
99 if(*textButtonRight) | |
100 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonRight,CLUT_ButtonSurfaceScreen); | |
101 | |
102 GFX_SetFrameTop(tIBscreen.FBStartAdress); | |
103 GFX_change_LTDC(); | |
104 | |
105 if(backup != 0) | |
106 releaseFrame(18,backup); | |
107 } | |
108 | |
109 | |
110 void tInfo_write(const char *text) | |
111 { | |
112 if((line > 6) || (tIBscreen.FBStartAdress == 0)) | |
113 tInfo_newpage(text); | |
114 else | |
115 { | |
116 if(text) | |
117 GFX_write_string(&FontT48, &tIBwindow, text,line); | |
118 line++; | |
119 | |
120 } | |
121 } | |
122 | |
123 /* Private functions ---------------------------------------------------------*/ |