30
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
2 /// -*- coding: UTF-8 -*-
|
|
3 ///
|
|
4 /// \file BootLoader/Src/tInfoBootloader.c
|
|
5 /// \brief Write something on the screen in between steps
|
|
6 /// \author heinrichs/weikamp, Christian Weikamp
|
|
7 /// \date 08-May-2015
|
|
8 ///
|
|
9 /// $Id$
|
|
10 ///////////////////////////////////////////////////////////////////////////////
|
|
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
|
|
12 ///
|
|
13 /// This program is free software: you can redistribute it and/or modify
|
|
14 /// it under the terms of the GNU General Public License as published by
|
|
15 /// the Free Software Foundation, either version 3 of the License, or
|
|
16 /// (at your option) any later version.
|
|
17 ///
|
|
18 /// This program is distributed in the hope that it will be useful,
|
|
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 /// GNU General Public License for more details.
|
|
22 ///
|
|
23 /// You should have received a copy of the GNU General Public License
|
|
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
25 //////////////////////////////////////////////////////////////////////////////
|
|
26
|
|
27 /* Includes ------------------------------------------------------------------*/
|
|
28 #include "tInfoBootloader.h"
|
|
29
|
|
30 #include "base_bootloader.h"
|
|
31 #include "gfx_colors.h"
|
|
32 #include "gfx_engine.h"
|
|
33 #include "gfx_fonts.h"
|
|
34 #include "ostc.h"
|
|
35
|
|
36 #include <string.h>
|
|
37 /* Exported variables --------------------------------------------------------*/
|
|
38
|
|
39 /* Private variables ---------------------------------------------------------*/
|
|
40
|
|
41 GFX_DrawCfgScreen tIBscreen;
|
|
42 GFX_DrawCfgWindow tIBwindow;
|
|
43 uint8_t line = 1;
|
|
44
|
|
45 char textButtonLeft[30] = { 0 };
|
|
46 char textButtonMid[31] = { 0 };
|
|
47 char textButtonRight[31] = { 0 };
|
|
48
|
|
49 /* Private types -------------------------------------------------------------*/
|
|
50
|
|
51 /* Private function prototypes -----------------------------------------------*/
|
|
52
|
|
53 /* Exported functions --------------------------------------------------------*/
|
|
54
|
|
55 void tInfoBootloader_init(void)
|
|
56 {
|
|
57 tIBscreen.FBStartAdress = 0;
|
|
58 tIBscreen.ImageHeight = 480;
|
|
59 tIBscreen.ImageWidth = 800;
|
|
60 tIBscreen.LayerIndex = 1;
|
|
61
|
|
62 tIBwindow.Image = &tIBscreen;
|
|
63 tIBwindow.WindowNumberOfTextLines = 6;
|
|
64 tIBwindow.WindowLineSpacing = 65;
|
|
65 tIBwindow.WindowTab = 400;
|
|
66 tIBwindow.WindowX0 = 20;
|
|
67 tIBwindow.WindowX1 = 779;
|
|
68 tIBwindow.WindowY0 = 0;
|
|
69 tIBwindow.WindowY1 = 799;
|
|
70
|
|
71 line = 1;
|
|
72 }
|
|
73
|
|
74
|
|
75 void tInfo_button_text(const char *text_left, const char *text_mid, const char *text_right)
|
|
76 {
|
|
77 if(text_left)
|
|
78 strncpy(textButtonLeft,text_left,30);
|
|
79 if(text_mid)
|
|
80 {
|
|
81 textButtonMid[0] = '\001';
|
|
82 strncpy(&textButtonMid[1],text_mid,30);
|
|
83 }
|
|
84 if(text_right)
|
|
85 {
|
|
86 textButtonRight[0] = '\002';
|
|
87 strncpy(&textButtonRight[1],text_right,30);
|
|
88 }
|
|
89 }
|
|
90
|
|
91
|
|
92 void tInfo_newpage(const char *text)
|
|
93 {
|
|
94 uint32_t backup = tIBscreen.FBStartAdress;
|
|
95
|
|
96 tIBscreen.FBStartAdress = getFrame(18);
|
|
97 line = 1;
|
|
98 if(text)
|
|
99 GFX_write_string(&FontT48, &tIBwindow, text,line);
|
|
100 line++;
|
|
101
|
|
102 if(*textButtonLeft)
|
|
103 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonLeft,CLUT_ButtonSurfaceScreen);
|
|
104 if(*textButtonMid)
|
|
105 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonMid,CLUT_ButtonSurfaceScreen);
|
|
106 if(*textButtonRight)
|
|
107 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonRight,CLUT_ButtonSurfaceScreen);
|
|
108
|
|
109 GFX_SetFrameTop(tIBscreen.FBStartAdress);
|
|
110 GFX_change_LTDC();
|
|
111
|
|
112 if(backup != 0)
|
|
113 releaseFrame(18,backup);
|
|
114 }
|
|
115
|
|
116
|
|
117 void tInfo_write(const char *text)
|
|
118 {
|
|
119 if((line > 6) || (tIBscreen.FBStartAdress == 0))
|
|
120 tInfo_newpage(text);
|
|
121 else
|
|
122 {
|
|
123 if(text)
|
|
124 GFX_write_string(&FontT48, &tIBwindow, text,line);
|
|
125 line++;
|
|
126
|
|
127 }
|
|
128 }
|
|
129
|
|
130 /* Private functions ---------------------------------------------------------*/
|