Mercurial > public > ostc4
annotate Discovery/Inc/Fonts/image_battery.h @ 238:a9d798e8c11f div-fixes-5
cleanup, bugfix: do not mask I2C_SystemStatus with local variable
This commit is partly cleanup, and partly possible bugfix. Masking
the global I2C_SystemStatus with a local variable is (very) bad practice,
but more importantly, dangerous, as other code uses this I2C_SystemStatus
to base decisions on. So, this is definitely non-trivial, as it can
possibly change the flow of control. This said, its tested and seems to
have no negative effects (but also no positive, as I sort of hoped for),
so that is why I mark it cleanup as well. Constructs like this shall
be heavily documented in the code, when there is a reason to do things
like this.
Further, remove a 2nd rather useless construct. There is no reason
to & 0x03 the output of I2C_SystemStatus. This is the only location
in the entire code base where this is done, so, its not only useless
but also inconsistent and confusing the true intentions here.
Finally, littered to code with todo's that I will take care of in
next commits.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 08 Apr 2019 10:16:17 +0200 |
parents | 219943ef9dc0 |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Inc/Fonts/image_battery.h | |
5 /// \brief Font to display battery filling up. | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 2015-06-03 | |
8 /// | |
9 /// \details | |
10 /// Imported from Batt2Top - gaia by hw | |
11 /// | |
12 /// $Id$ | |
13 /////////////////////////////////////////////////////////////////////////////// | |
14 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
15 /// | |
16 /// This program is free software: you can redistribute it and/or modify | |
17 /// it under the terms of the GNU General Public License as published by | |
18 /// the Free Software Foundation, either version 3 of the License, or | |
19 /// (at your option) any later version. | |
20 /// | |
21 /// This program is distributed in the hope that it will be useful, | |
22 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 /// GNU General Public License for more details. | |
25 /// | |
26 /// You should have received a copy of the GNU General Public License | |
27 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 ////////////////////////////////////////////////////////////////////////////// | |
29 | |
30 #include "gfx_fonts.h" | |
31 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
32 static const uint8_t image_data_Batt2Top[168] UPPER_IMAGES = { |
38 | 33 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, |
34 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, | |
35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
39 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
40 }; | |
41 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
42 static const uint8_t image_data_Batt2Empty4px_of_40px[96] UPPER_IMAGES = { |
38 | 43 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, |
44 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, | |
45 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, | |
46 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00 | |
47 }; | |
48 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
49 static const uint8_t image_data_Batt2Full4px_of_40px[96] UPPER_IMAGES = { |
38 | 50 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, |
51 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | |
52 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | |
53 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 | |
54 }; | |
55 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
56 static const uint8_t image_data_Batt2Bottom[72] UPPER_IMAGES = { |
38 | 57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
58 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, | |
59 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 | |
60 }; | |
61 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
62 static const uint8_t image_data_Batt2Blitz[312] UPPER_IMAGES = { |
38 | 63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
64 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
65 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
66 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
67 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
68 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | |
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, | |
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, | |
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | |
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, | |
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | |
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
76 }; | |
77 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
78 static const tImage Batt2Top UPPER_IMAGES = { image_data_Batt2Top, 7, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
79 static const tImage Batt2Empty4px_of_40px UPPER_IMAGES = { image_data_Batt2Empty4px_of_40px, 4, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
80 static const tImage Batt2Full4px_of_40px UPPER_IMAGES = { image_data_Batt2Full4px_of_40px, 4, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
81 static const tImage Batt2Bottom UPPER_IMAGES = { image_data_Batt2Bottom, 3, 24}; |
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
82 static const tImage Batt2Blitz UPPER_IMAGES = { image_data_Batt2Blitz, 13, 24}; |
38 | 83 |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
84 static const tChar batt2_array[] UPPER_IMAGES = { |
38 | 85 |
86 // character: battery header | |
87 {'0', &Batt2Top}, | |
88 | |
89 // character: battery empty | |
90 {'1', &Batt2Empty4px_of_40px}, | |
91 | |
92 // character: battery full | |
93 {'2', &Batt2Full4px_of_40px}, | |
94 | |
95 // character: battery footer | |
96 {'3', &Batt2Bottom}, | |
97 | |
98 // character: battery lightning | |
99 {'4', &Batt2Blitz}, | |
100 }; | |
101 | |
45
219943ef9dc0
Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
Ideenmodellierer
parents:
38
diff
changeset
|
102 const tFont Batt24 UPPER_IMAGE_DIRECTORY = { 5, batt2_array , 18, 18, 24}; |