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
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 ------------------------------------------------------------------*/
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
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
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
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
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
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
33 /* Exported variables --------------------------------------------------------*/
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
34
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
35 /* Private variables ---------------------------------------------------------*/
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
36
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
37 GFX_DrawCfgScreen tIBscreen;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
38 GFX_DrawCfgWindow tIBwindow;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
39 uint8_t line = 1;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
40
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
41 char textButtonLeft[30] = { 0 };
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
42 char textButtonMid[31] = { 0 };
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
43 char textButtonRight[31] = { 0 };
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
44
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
45 /* Private types -------------------------------------------------------------*/
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
46
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
47 /* Private function prototypes -----------------------------------------------*/
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
48
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
49 /* Exported functions --------------------------------------------------------*/
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
50
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
51 void tInfoBootloader_init(void)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
52 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
53 tIBscreen.FBStartAdress = 0;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
54 tIBscreen.ImageHeight = 480;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
55 tIBscreen.ImageWidth = 800;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
56 tIBscreen.LayerIndex = 1;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
57
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
58 tIBwindow.Image = &tIBscreen;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
59 tIBwindow.WindowNumberOfTextLines = 6;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
60 tIBwindow.WindowLineSpacing = 65;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
61 tIBwindow.WindowTab = 400;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
62 tIBwindow.WindowX0 = 20;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
63 tIBwindow.WindowX1 = 779;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
64 tIBwindow.WindowY0 = 0;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
65 tIBwindow.WindowY1 = 799;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
66
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
67 line = 1;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
68 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
69
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
70
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
71 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
72 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
73 if(text_left)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
74 strncpy(textButtonLeft,text_left,30);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
75 if(text_mid)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
76 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
77 textButtonMid[0] = '\001';
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
78 strncpy(&textButtonMid[1],text_mid,30);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
79 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
80 if(text_right)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
81 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
82 textButtonRight[0] = '\002';
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
83 strncpy(&textButtonRight[1],text_right,30);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
84 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
85 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
86
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
87
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
88 void tInfo_newpage(const char *text)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
89 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
90 uint32_t backup = tIBscreen.FBStartAdress;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
91
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
92 tIBscreen.FBStartAdress = getFrame(18);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
93 line = 1;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
94 if(text)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
95 GFX_write_string(&FontT48, &tIBwindow, text,line);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
96 line++;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
97
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
98 if(*textButtonLeft)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
99 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonLeft,CLUT_ButtonSurfaceScreen);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
100 if(*textButtonMid)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
101 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonMid,CLUT_ButtonSurfaceScreen);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
102 if(*textButtonRight)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
103 write_content_simple(&tIBscreen, 0, 800, 480-24, &FontT24,textButtonRight,CLUT_ButtonSurfaceScreen);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
104
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
105 GFX_SetFrameTop(tIBscreen.FBStartAdress);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
106 GFX_change_LTDC();
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
107
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
108 if(backup != 0)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
109 releaseFrame(18,backup);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
110 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
111
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
112
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
113 void tInfo_write(const char *text)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
114 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
115 if((line > 6) || (tIBscreen.FBStartAdress == 0))
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
116 tInfo_newpage(text);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
117 else
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
118 {
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
119 if(text)
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
120 GFX_write_string(&FontT48, &tIBwindow, text,line);
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
121 line++;
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
122
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
123 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
124 }
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
125
e65d01b6a17e MOVE files for other applications
JeanDo
parents:
diff changeset
126 /* Private functions ---------------------------------------------------------*/