annotate BootLoader/Src/tInfoBootloader.c @ 22:1df134a2706e

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