annotate BootLoader/Src/tInfoBootloader.c @ 554:3328189786e7

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