Mercurial > public > ostc4
annotate BootLoader/Src/tInfoBootloader.c @ 29:3a98f9e7ca58
ADD script to set GPL headers
author | jDG |
---|---|
date | Tue, 23 Jan 2018 13:36:25 +0100 |
parents | 97eafbcb81a9 |
children | ea1003f63e44 |
rev | line source |
---|---|
5 | 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 ------------------------------------------------------------------*/ | |
25
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
24 #include "tInfoBootloader.h" |
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
25 |
5 | 26 #include "base_bootloader.h" |
25
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
27 #include "gfx_colors.h" |
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
28 #include "gfx_engine.h" |
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
29 #include "gfx_fonts.h" |
5 | 30 #include "ostc.h" |
25
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
31 |
97eafbcb81a9
FIX move bootloader SFirmwareData at fixed address 0x0800A000
jdg@air
parents:
5
diff
changeset
|
32 #include <string.h> |
5 | 33 /* Exported variables --------------------------------------------------------*/ |
34 | |
35 /* Private variables ---------------------------------------------------------*/ | |
36 | |
37 GFX_DrawCfgScreen tIBscreen; | |
38 GFX_DrawCfgWindow tIBwindow; | |
39 uint8_t line = 1; | |
40 | |
41 char textButtonLeft[30] = { 0 }; | |
42 char textButtonMid[31] = { 0 }; | |
43 char textButtonRight[31] = { 0 }; | |
44 | |
45 /* Private types -------------------------------------------------------------*/ | |
46 | |
47 /* Private function prototypes -----------------------------------------------*/ | |
48 | |
49 /* Exported functions --------------------------------------------------------*/ | |
50 | |
51 void tInfoBootloader_init(void) | |
52 { | |
53 tIBscreen.FBStartAdress = 0; | |
54 tIBscreen.ImageHeight = 480; | |
55 tIBscreen.ImageWidth = 800; | |
56 tIBscreen.LayerIndex = 1; | |
57 | |
58 tIBwindow.Image = &tIBscreen; | |
59 tIBwindow.WindowNumberOfTextLines = 6; | |
60 tIBwindow.WindowLineSpacing = 65; | |
61 tIBwindow.WindowTab = 400; | |
62 tIBwindow.WindowX0 = 20; | |
63 tIBwindow.WindowX1 = 779; | |
64 tIBwindow.WindowY0 = 0; | |
65 tIBwindow.WindowY1 = 799; | |
66 | |
67 line = 1; | |
68 } | |
69 | |
70 | |
71 void tInfo_button_text(const char *text_left, const char *text_mid, const char *text_right) | |
72 { | |
73 if(text_left) | |
74 strncpy(textButtonLeft,text_left,30); | |
75 if(text_mid) | |
76 { | |
77 textButtonMid[0] = '\001'; | |
78 strncpy(&textButtonMid[1],text_mid,30); | |
79 } | |
80 if(text_right) | |
81 { | |
82 textButtonRight[0] = '\002'; | |
83 strncpy(&textButtonRight[1],text_right,30); | |
84 } | |
85 } | |
86 | |
87 | |
88 void tInfo_newpage(const char *text) | |
89 { | |
90 uint32_t backup = tIBscreen.FBStartAdress; | |
91 | |
92 tIBscreen.FBStartAdress = getFrame(18); | |
93 line = 1; | |
94 if(text) | |
95 GFX_write_string(&FontT48, &tIBwindow, text,line); | |
96 line++; | |
97 | |
98 if(*textButtonLeft) | |
99 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonLeft,CLUT_ButtonSurfaceScreen); | |
100 if(*textButtonMid) | |
101 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonMid,CLUT_ButtonSurfaceScreen); | |
102 if(*textButtonRight) | |
103 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonRight,CLUT_ButtonSurfaceScreen); | |
104 | |
105 GFX_SetFrameTop(tIBscreen.FBStartAdress); | |
106 GFX_change_LTDC(); | |
107 | |
108 if(backup != 0) | |
109 releaseFrame(18,backup); | |
110 } | |
111 | |
112 | |
113 void tInfo_write(const char *text) | |
114 { | |
115 if((line > 6) || (tIBscreen.FBStartAdress == 0)) | |
116 tInfo_newpage(text); | |
117 else | |
118 { | |
119 if(text) | |
120 GFX_write_string(&FontT48, &tIBwindow, text,line); | |
121 line++; | |
122 | |
123 } | |
124 } | |
125 | |
126 /* Private functions ---------------------------------------------------------*/ |