annotate Discovery/Src/gfx_engine.c @ 1054:8fe6676f28c9 Icon_Integration tip

Restructure reset menu: The reset for custom icon back to the default has been added. Without modification it would not have fit into the reset menu. To add some space all reset operations have been moved into a general "Reset" menu linke it is also implemented for the reboot options. The icon reset option is only show if an icon is stored.
author Ideenmodellierer
date Wed, 31 Dec 2025 17:52:03 +0100
parents 36fa1c44e597
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file gfx_engine.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 30-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief Main source file of GFX Graphic Engine
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * This file provides firmware functions to manage the following
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * functions to draw on the screen:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * + write string to display
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 #include <stdlib.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 #include <stdint.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #include "gfx.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #include "gfx_engine.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "gfx_colors.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "ostc.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "text_multilanguage.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
39 #define RING_BUF_SIZE (5u)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
40 #define MAX_COLOR_STRING_LENGTH (100u)
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
41
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 uint32_t Xdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 uint32_t Ydelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 uint8_t invert;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 uint8_t color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint8_t dualFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t resize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint32_t font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 uint8_t spaceMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 uint8_t singleSpaceWithSizeOfNextChar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 uint8_t useTinyFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 uint32_t TinyFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 int8_t TinyFontExtraYdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 tFont *actualFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 uint8_t doubleSize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 } GFX_CfgWriteString;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 uint32_t pBuffer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 uint32_t height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 uint32_t width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 uint32_t leftStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 uint32_t bottomStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 } GFX_layerSingle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 GFX_layerSingle top;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 GFX_layerSingle bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 } GFX_layersTopBottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 uint32_t pActualTopBuffer;
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
78 uint32_t pNextTopBuffer[RING_BUF_SIZE];
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 GFX_layerSingle actualBottom;
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
80 GFX_layerSingle nextBottom[RING_BUF_SIZE];
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
81 uint8_t NextTopWrite;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
82 uint8_t NextBottomWrite;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
83 uint8_t NextTopRead;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
84 uint8_t NextBottomRead;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 } GFX_layerControl;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 uint32_t StartAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 int8_t status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 uint8_t caller;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 } SFrameList;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 enum FRAMESTATE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 CLEAR = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 BLOCKED,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 RELEASED
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 enum LOGOSTATE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 LOGOOFF = 0,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 LOGOSTART = 1,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 LOGOSTOP = 255
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 // should be 43
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 #define MAXFRAMES 39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 #define SDRAM_BANK_ADDR ((uint32_t)0xD0000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 #define FBGlobalStart SDRAM_BANK_ADDR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 #define FBOffsetEachIndex (800*480*2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 #define SDRAM_DOUBLE_BUFFER_ONE ((uint32_t)(FBGlobalStart + (MAXFRAMES * FBOffsetEachIndex)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 #define SDRAM_DOUBLE_BUFFER_TWO ((uint32_t)(SDRAM_DOUBLE_BUFFER_ONE + (2 * FBOffsetEachIndex)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 #define SDRAM_DOUBLE_BUFFER_END ((uint32_t)(SDRAM_DOUBLE_BUFFER_TWO + (2 * FBOffsetEachIndex)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /* Semi Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 DMA2D_HandleTypeDef Dma2dHandle;
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
122 static LTDC_HandleTypeDef LtdcHandle;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
126 static uint8_t DMA2D_at_work = 0;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
127
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
128 static GFX_layerControl FrameHandler = { 0 };
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
129
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
130 static uint32_t pInvisibleFrame = 0;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
131 static uint32_t pLogoFrame = 0;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
132 static uint8_t logoStatus;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
133 static uint32_t pBackgroundHwFrame = 0;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
134 static uint8_t backgroundHwStatus;
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
135
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
136 static SFrameList frame[MAXFRAMES];
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
138 static void GFX_clear_frame_immediately(uint32_t pDestination);
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
139 static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /* ITM Trace-----------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 #include "stdio.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 #define ITM_Port8(n) (*((volatile unsigned char *)(0xE0000000+4*n)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 #define ITM_Port16(n) (*((volatile unsigned short*)(0xE0000000+4*n)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 #define ITM_Port32(n) (*((volatile unsigned long *)(0xE0000000+4*n)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 #define DEMCR (*((volatile unsigned long *)(0xE000EDFC)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 #define TRCENA 0x01000000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 struct __FILE { int handle; /* Add whatever needed */ };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 FILE __stdout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 FILE __stdin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 int fputc(int ch, FILE *f) {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 if (DEMCR & TRCENA) {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 while (ITM_Port32(0) == 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 ITM_Port8(0) = ch;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 return(ch);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 uint32_t MinU32GFX(uint32_t a, uint32_t b)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 return ((a<b)?a:b);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 uint32_t MaxU32GFX(uint32_t a, uint32_t b)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 return((a>b)?a:b);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 static uint32_t GFX_write_substring(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, uint8_t textId, int8_t nextCharFor2Byte);
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
178 static uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pText);
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
179 static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 static void GFX_Error_Handler(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 static void GFX_Dma2d_TransferComplete(DMA2D_HandleTypeDef* Dma2dHandle);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 static void GFX_Dma2d_TransferError(DMA2D_HandleTypeDef* Dma2dHandle);
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
183 static void GFX_clear_frame_dma2d(uint8_t frameId);
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
184
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
185 static uint32_t GFX_doubleBufferOne(void);
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
186 static uint32_t GFX_doubleBufferTwo(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
188 static void GFX_LTDC_Init_display0(void);
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
189 static void GFX_LTDC_Init_display1(void);
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
190
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 uint8_t GFX_logoStatus(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 return logoStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 void GFX_SetWindowLayer0(uint32_t pDestination, int16_t XleftGimpStyle, int16_t XrightGimpStyle, int16_t YtopGimpStyle, int16_t YbottomGimpStyle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 int16_t XSize, YSize, X0, Y0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 if(XleftGimpStyle < 0) XleftGimpStyle = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 if(XrightGimpStyle < 0) XrightGimpStyle = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 if(XleftGimpStyle > 799) XleftGimpStyle = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 if(XrightGimpStyle > 799) XrightGimpStyle = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 if(YtopGimpStyle < 0) YtopGimpStyle = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 if(YbottomGimpStyle < 0) YbottomGimpStyle = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 if(YtopGimpStyle > 479) YtopGimpStyle = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 if(YbottomGimpStyle > 479) YbottomGimpStyle = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 XSize = YbottomGimpStyle - YtopGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 YSize = XrightGimpStyle - XleftGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 if((XSize <= 0) || (YSize <= 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 X0 = 479 - YbottomGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 Y0 = XleftGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 while((LTDC->CPSR & LTDC_CPSR_CYPOS) <= (uint32_t)800);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 HAL_LTDC_SetWindowSize(&LtdcHandle, XSize, YSize, LayerIdx);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 HAL_LTDC_SetWindowPosition(&LtdcHandle, X0, Y0,LayerIdx);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 HAL_LTDC_SetAddress(&LtdcHandle, pDestination, LayerIdx);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 XSize = XrightGimpStyle - XleftGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 YSize = YbottomGimpStyle - YtopGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 if((XSize <= 0) || (YSize <= 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 Y0 = 479 - YbottomGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 X0 = XleftGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 GFX_SetFrameBottom(pDestination, X0, Y0, XSize, YSize);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 void GFX_logoAutoOff(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 if(logoStatus == LOGOOFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 logoStatus = LOGOSTART;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 void GFX_hwBackgroundOn(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 backgroundHwStatus = LOGOSTART;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 void GFX_hwBackgroundOff(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 backgroundHwStatus = LOGOSTOP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254
314
e141b571a03d Reinitialize logos after flip of display
ideenmodellierer
parents: 297
diff changeset
255 void GFX_build_hw_background_frame(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 GFX_DrawCfgScreen tLogoTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 SWindowGimpStyle windowGimp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 pBackgroundHwFrame = getFrame(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 backgroundHwStatus = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 tLogoTemp.FBStartAdress = pBackgroundHwFrame;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 tLogoTemp.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 tLogoTemp.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 tLogoTemp.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 windowGimp.left = (800 - 400) / 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 windowGimp.top = 0;//(480 - 46) / 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 GFX_draw_image_color(&tLogoTemp, windowGimp, &ImgHWcolor);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 char localtext[256];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 uint8_t ptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 localtext[ptr++] = 'O';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 localtext[ptr++] = 'S';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 ptr += GFX_printf_firmware(&localtext[ptr]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 localtext[ptr] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 write_content_simple(&tLogoTemp, 0, 800, 240-24, &FontT24,localtext,CLUT_Font020);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288
314
e141b571a03d Reinitialize logos after flip of display
ideenmodellierer
parents: 297
diff changeset
289 void GFX_build_logo_frame(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 GFX_DrawCfgScreen tLogoTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 SWindowGimpStyle windowGimp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
294 SIconHeader* pIconHeader = (SIconHeader*) ICON_HEADER_ADDR;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
295 tImage Image;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
296 Image.data= (uint8_t*) (ICON_HEADER_ADDR + 12 + (256 * 4)); /* Offset Header + CLUT */
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
297
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
298 Image.width = ((pIconHeader->dummy7 & 0x0F) << 8) | pIconHeader->dummy5;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
299 Image.height = ((pIconHeader->dummy7 & 0xF0) << 4) | pIconHeader->dummy6;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
300
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
301
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 pLogoFrame = getFrame(1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 logoStatus = LOGOOFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 tLogoTemp.FBStartAdress = pLogoFrame;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 tLogoTemp.ImageHeight = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 tLogoTemp.ImageWidth = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 tLogoTemp.LayerIndex = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
310 if(pIconHeader->type == 0x20)
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
311 {
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
312 windowGimp.left = (800 - Image.width) / 2;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
313 windowGimp.top = (480 - Image.height) / 2;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
314
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
315 GFX_draw_image_color(&tLogoTemp, windowGimp, &Image);
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
316 }
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
317 else
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
318 {
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
319 windowGimp.left = (800 - ImgHWcolor.width) / 2;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
320 windowGimp.top = (480 - ImgHWcolor.height) / 2;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
321 GFX_draw_image_color(&tLogoTemp, windowGimp, &ImgHWcolor);
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
322 }
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
323
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
324
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 char localtext[256];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 uint8_t ptr = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 localtext[ptr++] = 'O';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 localtext[ptr++] = 'S';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 localtext[ptr++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 ptr += GFX_printf_firmware(&localtext[ptr]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 localtext[ptr] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 write_content_simple(&tLogoTemp, 0, 800, 240-24, &FontT24,localtext,CLUT_Font020);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 void GFX_init(uint32_t * pDestinationOut)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 frame[0].StartAddress = FBGlobalStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 GFX_clear_frame_immediately(frame[0].StartAddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 frame[0].status = CLEAR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 frame[0].caller = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 for(int i=1;i<MAXFRAMES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 frame[i].StartAddress = frame[i-1].StartAddress + FBOffsetEachIndex;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 GFX_clear_frame_immediately(frame[i].StartAddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 frame[i].status = CLEAR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 frame[i].caller = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 pInvisibleFrame = getFrame(2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 *pDestinationOut = pInvisibleFrame;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 GFX_build_logo_frame();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 GFX_build_hw_background_frame();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 /* Register to memory mode with ARGB8888 as color Mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 Dma2dHandle.Init.Mode = DMA2D_R2M;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 Dma2dHandle.Init.ColorMode = DMA2D_ARGB4444;//to fake AL88, before: DMA2D_ARGB8888;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 Dma2dHandle.Init.OutputOffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 /* DMA2D Callbacks Configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 Dma2dHandle.XferCpltCallback = GFX_Dma2d_TransferComplete;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 Dma2dHandle.XferErrorCallback = GFX_Dma2d_TransferError;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 Dma2dHandle.Instance = DMA2D;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 /* DMA2D Initialisation */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 GFX_Error_Handler();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) != HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 GFX_Error_Handler();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 DMA2D_at_work = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
382 void GFX_init1_no_DMA(uint32_t * pDestinationOut, uint8_t blockFrames)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
383 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
384 frame[0].StartAddress = FBGlobalStart;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
385 GFX_clear_frame_immediately(frame[0].StartAddress);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
386 frame[0].status = CLEAR;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
387 frame[0].caller = 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
388
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
389 for(int i=1;i<MAXFRAMES;i++)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
390 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
391 frame[i].StartAddress = frame[i-1].StartAddress + FBOffsetEachIndex;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
392 GFX_clear_frame_immediately(frame[i].StartAddress);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
393 frame[i].status = CLEAR;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
394 frame[i].caller = 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
395 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
396
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
397 for(int i=0;i<blockFrames;i++)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
398 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
399 frame[i].status = BLOCKED;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
400 frame[i].caller = 1;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
401 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
402
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
403 pInvisibleFrame = getFrame(2);
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
404 *pDestinationOut = pInvisibleFrame;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
405
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
406 GFX_build_logo_frame();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
407 GFX_build_hw_background_frame();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
408 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
409
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
410
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
411 void GFX_init2_DMA(void)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
412 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
413 /* Register to memory mode with ARGB8888 as color Mode */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
414 Dma2dHandle.Init.Mode = DMA2D_R2M;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
415 Dma2dHandle.Init.ColorMode = DMA2D_ARGB4444;//to fake AL88, before: DMA2D_ARGB8888;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
416 Dma2dHandle.Init.OutputOffset = 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
417
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
418 /* DMA2D Callbacks Configuration */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
419 Dma2dHandle.XferCpltCallback = GFX_Dma2d_TransferComplete;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
420 Dma2dHandle.XferErrorCallback = GFX_Dma2d_TransferError;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
421
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
422 Dma2dHandle.Instance = DMA2D;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
423
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
424 /* DMA2D Initialisation */
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
425 if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
426 GFX_Error_Handler();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
427
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
428 if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) != HAL_OK)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
429 GFX_Error_Handler();
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
430
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
431 DMA2D_at_work = 255;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
432 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 void GFX_SetFrameTop(uint32_t pDestination)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 {
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
437 uint8_t NextTopWork = FrameHandler.NextTopWrite + 1;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
438
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
439 if(NextTopWork == RING_BUF_SIZE)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
440 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
441 NextTopWork = 0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
442 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 if(pDestination == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 pDestination = pInvisibleFrame;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
447 FrameHandler.pNextTopBuffer[NextTopWork] = pDestination;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
448 FrameHandler.NextTopWrite = NextTopWork;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 void GFX_SetFrameBottom(uint32_t pDestination, uint32_t x0, uint32_t y0, uint32_t width, uint32_t height)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 {
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
454 uint8_t NextBottomWork = FrameHandler.NextBottomWrite + 1;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
455
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
456 if(NextBottomWork == RING_BUF_SIZE)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
457 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
458 NextBottomWork = 0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
459 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 if(pDestination == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 pDestination = pInvisibleFrame;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
464 FrameHandler.nextBottom[NextBottomWork].pBuffer = pDestination;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
465 FrameHandler.nextBottom[NextBottomWork].height = height;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
466 FrameHandler.nextBottom[NextBottomWork].width = width;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
467 FrameHandler.nextBottom[NextBottomWork].leftStart = x0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
468 FrameHandler.nextBottom[NextBottomWork].bottomStart = y0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
469 FrameHandler.NextBottomWrite = NextBottomWork;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 void GFX_SetFramesTopBottom(uint32_t pTop, uint32_t pBottom, uint32_t heightBottom)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 GFX_SetFrameTop(pTop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 GFX_SetFrameBottom(pBottom, 0, 0, 800, heightBottom);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
480 static uint32_t GFX_get_pActualFrameTop(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 return FrameHandler.pActualTopBuffer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
486 static uint32_t GFX_get_pActualFrameBottom(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 return FrameHandler.actualBottom.pBuffer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 void GFX_start_VSYNC_IRQ(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 GPIO_InitTypeDef GPIO_InitStructure;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 GPIO_InitStructure.Pull = GPIO_NOPULL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 GPIO_InitStructure.Pin = VSYNC_IRQ_PIN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 HAL_GPIO_Init(VSYNC_IRQ_GPIO_PORT, &GPIO_InitStructure);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 HAL_NVIC_SetPriority(VSYNC_IRQ_EXTI_IRQn, 1, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 HAL_NVIC_EnableIRQ(VSYNC_IRQ_EXTI_IRQn);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 void GFX_change_LTDC(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 uint32_t pTop = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 uint32_t pBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 uint32_t heightBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 uint32_t widthBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 uint32_t leftStartBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 uint32_t bottomStartBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 uint8_t change_position = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 uint8_t change_size = 0;
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
517 uint8_t nextBottomBackup = FrameHandler.NextBottomRead; /* Restore entry value in case off logo handling */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
519 SIconHeader* pIconHeader = (SIconHeader*) ICON_HEADER_ADDR;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
520 uint32_t* pCLUT;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
521 pCLUT = (uint32_t *)indexHWcolor;
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
522
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
523
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 // Top Frame
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
525 if(FrameHandler.NextTopRead != FrameHandler.NextTopWrite)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
526 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
527 FrameHandler.NextTopRead++;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
528 if(FrameHandler.NextTopRead == RING_BUF_SIZE)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
529 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
530 FrameHandler.NextTopRead = 0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
531 }
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
532 }
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
533 pTop = FrameHandler.pNextTopBuffer[FrameHandler.NextTopRead];
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
534
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 if(FrameHandler.pActualTopBuffer != pTop)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 HAL_LTDC_SetAddress(&LtdcHandle, pTop, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 FrameHandler.pActualTopBuffer = pTop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 // Bottom Frame
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
542 if(FrameHandler.NextBottomRead != FrameHandler.NextBottomWrite)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
543 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
544 FrameHandler.NextBottomRead++;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
545 if(FrameHandler.NextBottomRead == RING_BUF_SIZE)
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
546 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
547 FrameHandler.NextBottomRead = 0;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
548 }
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
549 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 if(logoStatus != LOGOOFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 switch(logoStatus)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 case LOGOSTART:
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
555 if(pIconHeader->type == 0x20)
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
556 {
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
557 pCLUT = (uint32_t *)(pIconHeader + 1); /* First address behind the header */
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
558 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 HAL_LTDC_SetAlpha(&LtdcHandle, 0, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 HAL_LTDC_SetAlpha(&LtdcHandle, 34, 0);
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
561 HAL_LTDC_ConfigCLUT(&LtdcHandle, pCLUT, indexHWcolorSIZE, 0);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 HAL_LTDC_SetAddress(&LtdcHandle, pLogoFrame, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 logoStatus = 2;
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
566 FrameHandler.NextBottomRead = nextBottomBackup;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 case LOGOSTOP:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 HAL_LTDC_SetAlpha(&LtdcHandle, 255, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
573 pBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].pBuffer;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
574 heightBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].height;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
575 widthBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].width;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
576 leftStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].leftStart;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
577 bottomStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].bottomStart;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 HAL_LTDC_SetWindowSize(&LtdcHandle, heightBot, widthBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 HAL_LTDC_SetWindowPosition(&LtdcHandle, bottomStartBot, leftStartBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 HAL_LTDC_SetAddress(&LtdcHandle, pBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 HAL_LTDC_SetAlpha(&LtdcHandle, 255, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 FrameHandler.actualBottom.height = heightBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 FrameHandler.actualBottom.width = widthBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 FrameHandler.actualBottom.leftStart = leftStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 FrameHandler.actualBottom.bottomStart = bottomStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 FrameHandler.actualBottom.pBuffer = pBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 logoStatus = LOGOOFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 if(backgroundHwStatus == 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 backgroundHwStatus = LOGOSTART;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 if(logoStatus < 35)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 logoStatus++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 if(logoStatus <= 15)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 HAL_LTDC_SetAlpha(&LtdcHandle, 17*logoStatus, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 logoStatus +=20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 HAL_LTDC_SetAlpha(&LtdcHandle, logoStatus-55, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 HAL_LTDC_SetAlpha(&LtdcHandle, 255+55-logoStatus, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 }
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
607 FrameHandler.NextBottomRead = nextBottomBackup;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 else if (backgroundHwStatus != LOGOOFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
614
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 switch(backgroundHwStatus)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 case LOGOSTART:
1053
36fa1c44e597 Added upload command for icon:
Ideenmodellierer
parents: 1007
diff changeset
618 HAL_LTDC_ConfigCLUT(&LtdcHandle, pCLUT, indexHWcolorSIZE, 0);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 HAL_LTDC_SetAddress(&LtdcHandle, pBackgroundHwFrame, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 HAL_LTDC_SetWindowSize(&LtdcHandle, 480, 800, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 HAL_LTDC_SetWindowPosition(&LtdcHandle, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 backgroundHwStatus = 2;
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
623 FrameHandler.NextBottomRead = nextBottomBackup;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 case LOGOSTOP:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, 0);
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
628 pBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].pBuffer;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
629 heightBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].height;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
630 widthBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].width;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
631 leftStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].leftStart;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
632 bottomStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].bottomStart;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 HAL_LTDC_SetWindowSize(&LtdcHandle, heightBot, widthBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 HAL_LTDC_SetWindowPosition(&LtdcHandle, bottomStartBot, leftStartBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 HAL_LTDC_SetAddress(&LtdcHandle, pBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 HAL_LTDC_SetAlpha(&LtdcHandle, 255, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 FrameHandler.actualBottom.height = heightBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 FrameHandler.actualBottom.width = widthBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 FrameHandler.actualBottom.leftStart = leftStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 FrameHandler.actualBottom.bottomStart = bottomStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 FrameHandler.actualBottom.pBuffer = pBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 backgroundHwStatus = LOGOOFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 default:
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
646 FrameHandler.NextBottomRead = nextBottomBackup;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
649
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 {
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
654 pBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].pBuffer;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
655 heightBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].height;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
656 widthBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].width;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
657 leftStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].leftStart;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
658 bottomStartBot = FrameHandler.nextBottom[FrameHandler.NextBottomRead].bottomStart;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 if(FrameHandler.actualBottom.pBuffer == pBot)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 pBot = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 if((FrameHandler.actualBottom.height != heightBot) || (FrameHandler.actualBottom.width != widthBot))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 change_size = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 if((FrameHandler.actualBottom.leftStart != leftStartBot) || (FrameHandler.actualBottom.bottomStart != bottomStartBot))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 change_position = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 if(pBot || change_size || change_position)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 if(heightBot && widthBot)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 HAL_LTDC_SetWindowSize(&LtdcHandle, heightBot, widthBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 if(change_position || leftStartBot || bottomStartBot)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 HAL_LTDC_SetWindowPosition(&LtdcHandle, bottomStartBot, leftStartBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 if(pBot)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 HAL_LTDC_SetAddress(&LtdcHandle, pBot, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 if(change_size)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 FrameHandler.actualBottom.height = heightBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 FrameHandler.actualBottom.width = widthBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 if(change_position)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 FrameHandler.actualBottom.leftStart = leftStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 FrameHandler.actualBottom.bottomStart = bottomStartBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 if(pBot)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 FrameHandler.actualBottom.pBuffer = pBot;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 uint8_t GFX_is_colorschemeDiveStandard(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 return (ColorLUT[CLUT_Font027] == 0x00FFFFFF);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 void change_CLUT_entry(uint8_t entryToChange, uint8_t entryUsedForChange)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 /* bug fix
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 static uint8_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 if(entryToChange == 0x1C)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 ColorLUT[entryToChange] = ColorLUT[entryUsedForChange];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 if(logoStatus == LOGOOFF)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 void GFX_use_colorscheme(uint8_t colorscheme)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 uint8_t ColorSchemeStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 if(colorscheme > 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 colorscheme = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 ColorSchemeStart = CLUT_Colorscheme0 + (8 * colorscheme);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 for(int i=1; i<8; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 ColorLUT[CLUT_Font027 + i] = ColorLUT[ColorSchemeStart + i];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 change_CLUT_entry(CLUT_Font027, ColorSchemeStart);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 void GFX_VGA_transform(uint32_t pSource, uint32_t pDestination)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 int h, v;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 uint32_t offsetSource, offsetSourceStartOfLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 offsetSourceStartOfLine = 480 + 480 - 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 for(v=0;v<480;v++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 offsetSource = offsetSourceStartOfLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 for(h=0;h<640;h++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 *(__IO uint8_t*)pDestination = *(uint8_t*)(pSource + offsetSource);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 pDestination++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 offsetSource += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 *(__IO uint8_t*)pDestination = *(uint8_t*)(pSource + offsetSource);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 pDestination++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 offsetSource += 480 + 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 offsetSourceStartOfLine -= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
755
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
756 static void GFX_clear_frame_immediately(uint32_t pDestination)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 uint32_t i;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
759 uint32_t* pfill = (uint32_t*) pDestination;
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
760
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 for(i = 200*480; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 {
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
764 *pfill++ = 0;
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
765 *pfill++ = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 void GFX_clear_window_immediately(GFX_DrawCfgWindow* hgfx)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
771 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
772 uint32_t pDestination, i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
773 uint16_t left, width, bottom, height, nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
774
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
775 pDestination = (uint32_t)hgfx->Image->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
776
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
777 left = hgfx->WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
778 width = 1 + hgfx->WindowX1 - left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
779 bottom = hgfx->WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
780 height = 1 + hgfx->WindowY1 - bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
781 nextlineStep = hgfx->Image->ImageHeight - height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
782 nextlineStep *= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
783
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
784 pDestination += 2 * bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
785 pDestination += 2 * hgfx->Image->ImageHeight * left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
786
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
787 for(j = width; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
788 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
789 for(i = height; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
790 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
791 *(__IO uint16_t*)pDestination = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
792 pDestination += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
793 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
794 pDestination += nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
795 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
796 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
797
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
798
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
799 static void GFX_clear_frame_dma2d(uint8_t frameId)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
800 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
801 if(frameId >= MAXFRAMES)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
802 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
803
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
804 DMA2D_at_work = frameId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
805
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
806 if (HAL_DMA2D_Start_IT(&Dma2dHandle, 0x0000000000, frame[frameId].StartAddress, 480, 800) != HAL_OK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
807 GFX_Error_Handler();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
808 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
809
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
810
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
811 void GFX_fill_buffer(uint32_t pDestination, uint8_t alpha, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
812 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
813
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
814 union al88_u
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
815 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
816 uint8_t al8[2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
817 uint16_t al88;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
818 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
819 union al88_u colorcombination;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
820 uint32_t i;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
821 uint32_t* pfill = (uint32_t*) pDestination;
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
822 uint32_t fillpattern;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
823
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
824 colorcombination.al8[0] = color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
825 colorcombination.al8[1] = alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
826
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
827 fillpattern = (colorcombination.al88 << 16) | colorcombination.al88;
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
828 for(i = 800*480/2; i > 0; i--)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
829 {
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
830 *pfill++ = fillpattern;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
831 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
832 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
833
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
834
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
835 static void gfx_flip(point_t *p1, point_t *p2)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
836 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
837 point_t temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
838
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
839 temp = *p1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
840 *p1 = *p2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
841 *p2 = temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
842 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
843
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
844
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
845 static inline void gfx_brush(uint8_t thickness, GFX_DrawCfgScreen *hgfx, uint16_t x0, uint16_t y0, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
846 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
847 uint16_t* pDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
848 uint8_t offset = thickness/2;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
849 int16_t stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
850
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
851 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
852 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
853
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
854 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
855 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
856 pDestination = (uint16_t*)hgfx->FBStartAdress;
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
857 pDestination += (hgfx->ImageHeight * (hgfx->ImageWidth - x0 + offset)) + (480 - y0+offset);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
858 stepdir = -1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
859 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
860 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
861 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
862 pDestination = (uint16_t*)hgfx->FBStartAdress;
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
863 pDestination += (x0 - offset)*hgfx->ImageHeight + (y0-offset);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
864 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
865 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
866 for(int x=thickness;x>0;x--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
867 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
868 for(int y=thickness;y>0;y--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
869 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
870 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
871 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
872 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
873 pDestination += stepdir * (hgfx->ImageHeight - thickness);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
874 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
875 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
876
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
877
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
878 void GFX_draw_thick_line(uint8_t thickness, GFX_DrawCfgScreen *hgfx, point_t start, point_t stop, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
879 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
880 if(thickness < 2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
881 GFX_draw_line(hgfx, start, stop, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
882
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
883 int x0 = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
884 int y0 = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
885 int x1 = stop.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
886 int y1 = stop.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
887 int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
888 int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
889 int err = (dx>dy ? dx : -dy)/2, e2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
890
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
891
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
892 if(start.x == stop.x)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
893 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
894 if(start.y > stop.y) gfx_flip(&start,&stop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
895 for (int j = stop.y - start.y; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
896 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
897 gfx_brush(thickness,hgfx,start.x,start.y++,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
898 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
899 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
900 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
901 if(start.y == stop.y)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
902 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
903 if(start.x > stop.x) gfx_flip(&start,&stop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
904
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
905 for (int j = stop.x - start.x; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
906 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
907 gfx_brush(thickness,hgfx,start.x++,start.y,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
908 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
909 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
910 else // diagonal
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
911 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
912 for(;;)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
913 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
914 gfx_brush(thickness,hgfx,x0,y0,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
915 if (x0==x1 && y0==y1) break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
916 e2 = err;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
917 if (e2 >-dx) { err -= dy; x0 += sx; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
918 if (e2 < dy) { err += dx; y0 += sy; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
919 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
920 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
921 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
922
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
923
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
924 void GFX_draw_line(GFX_DrawCfgScreen *hgfx, point_t start, point_t stop, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
925 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
926 uint16_t* pDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
927 uint32_t j;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
928 int16_t stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
929 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
930 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
931
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
932
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
933 /* horizontal line */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
934 if(start.x == stop.x)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
935 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
936 if(start.y > stop.y) gfx_flip(&start,&stop);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
937
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
938 pDestination = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
939 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
940 {
622
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
941 pDestination += (799 - start.x) * hgfx->ImageHeight;
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
942 pDestination += (479 - start.y);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
943 stepdir = -1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
944 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
945 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
946 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
947 pDestination += start.x * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
948 pDestination += start.y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
949 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
950 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
951 for (j = stop.y - start.y; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
952 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
953 *(__IO uint16_t*)pDestination = 0xFF00 + color;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
954 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
955 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
956 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
957 else /* vertical line ? */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
958 if(start.y == stop.y)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
959 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
960 if(start.x > stop.x) gfx_flip(&start,&stop);
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
961 pDestination = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
962
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
963 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
964 {
622
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
965 pDestination += (799 - start.x) * hgfx->ImageHeight;
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
966 pDestination += (479 - start.y);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
967 stepdir = -1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
968 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
969 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
970 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
971 pDestination += start.x * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
972 pDestination += start.y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
973 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
974 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
975
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
976 for (j = stop.x - start.x; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
977 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
978 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
979 pDestination += stepdir * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
980 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
981 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
982 else /* diagonal */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
983 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
984 int x0 = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
985 int y0 = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
986 int x1 = stop.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
987 int y1 = stop.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
988 int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
989 int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
990 int err = (dx>dy ? dx : -dy)/2, e2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
991
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
992 for(;;)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
993 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
994 pDestination = (uint16_t*)hgfx->FBStartAdress;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
995
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
996 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
997 {
622
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
998 pDestination += (((799 - x0) * hgfx->ImageHeight) + (479 - y0));
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
999 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1000 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1001 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1002 pDestination += ((x0 * hgfx->ImageHeight) + y0);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1003 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1004
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1005 *(__IO uint16_t*)pDestination = 0xFF00 + color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1006 if (x0==x1 && y0==y1) break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1007 e2 = err;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1008 if (e2 >-dx) { err -= dy; x0 += sx; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1009 if (e2 < dy) { err += dx; y0 += sy; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1010 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1011 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1012 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1013
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1015 void GFX_draw_image_monochrome(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1016 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1017 uint16_t* pDestination;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1018 uint32_t j;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1019 point_t start, stop;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1020
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1021 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1022 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1023
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1024 start.x = window.left;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1025 start.y = (hgfx->ImageHeight - image->height - window.top);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1026 stop.y = start.y + image->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1027 stop.x = start.x + image->width;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1028 j = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1029
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1030 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1031 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1032 for(int xx = start.x; xx < stop.x; xx++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1033 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1034 pDestination = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1035 pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight) ;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1036 pDestination -= (xx - start.x) * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1037
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1038 for(int yy = start.y; yy < stop.y; yy++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1039 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1040 *(__IO uint16_t*)pDestination-- = (image->data[j++] << 8) + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1041 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1042 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1043 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1044 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1045 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1046 for(int xx = start.x; xx < stop.x; xx++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1047 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1048 pDestination = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1049 pDestination += xx * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1050 pDestination += start.y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1051 for(int yy = start.y; yy < stop.y; yy++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1052 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1053 *(__IO uint16_t*)pDestination++ = (image->data[j++] << 8) + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1054 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1055 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1056 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1057 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1058
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
1059 static void GFX_draw_image_color(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image)
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1060 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1061 uint16_t* pDestination;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1062
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1063 uint32_t j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1064 point_t start, stop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1065
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1066 start.x = window.left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1067 start.y = (hgfx->ImageHeight - image->height - window.top);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1068 stop.y = start.y + image->height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1069 stop.x = start.x + image->width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1070 j = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1071
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1072 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1073 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1074
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1075 if(pSettings->FlipDisplay)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1076 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1077 for(int xx = start.x; xx < stop.x; xx++)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1078 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1079 pDestination = (uint16_t*)hgfx->FBStartAdress;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1080 pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1081 pDestination -= (xx - start.x) * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1082
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1083 for(int yy = start.y; yy < stop.y; yy++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1084 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1085 *(__IO uint16_t*)pDestination-- = 0xFF << 8 | image->data[j++];
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1086 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1087 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1088 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1089 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1090 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1091 for(int xx = start.x; xx < stop.x; xx++)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1092 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1093 pDestination = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1094 pDestination += xx * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1095 pDestination += start.y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1096 for(int yy = start.y; yy < stop.y; yy++)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1097 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1098 *(__IO uint16_t*)pDestination++ = 0xFF << 8 | image->data[j++];
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1099 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1100 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1101 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1102 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1103
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1104
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1105 /* this is NOT fast nor optimized */
1007
65d35e66efb9 Improve compass calibration dialog:
Ideenmodellierer
parents: 1006
diff changeset
1106 void GFX_draw_pixel(GFX_DrawCfgScreen *hgfx, int16_t x, int16_t y, uint8_t color)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1107 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1108 uint16_t* pDestination;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1109
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1110 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1111 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1112
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1113 pDestination = (uint16_t*)hgfx->FBStartAdress;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1114 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1115 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1116 pDestination += (800 - x) * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1117 pDestination += (480 - y);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1118 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1119 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1120 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1121 pDestination += x * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1122 pDestination += y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1123 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1124 *(__IO uint16_t*)pDestination = 0xFF << 8 | color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1125 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1127 /* this is NOT fast nor optimized */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1128 void GFX_draw_circle(GFX_DrawCfgScreen *hgfx, point_t center, uint8_t radius, int8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1129 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1130 int x, y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1131 int l;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1132 int r2, y2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1133 int y2_new;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1134 int ty;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1136 /* cos pi/4 = 185363 / 2^18 (approx) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1137 l = (radius * 185363) >> 18;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1138
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1139 /* hw */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1140 l += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1141
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1142 /* At x=0, y=radius */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1143 y = radius;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1145 r2 = y2 = y * y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1146 ty = (2 * y) - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1147 y2_new = r2 + 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1148
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1149 for (x = 0; x <= l; x++) {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1150 y2_new -= (2 * x) - 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1152 if ((y2 - y2_new) >= ty) {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1153 y2 -= ty;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1154 y -= 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1155 ty -= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1156 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1158 GFX_draw_pixel (hgfx, x + center.x, y + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1159 GFX_draw_pixel (hgfx, x + center.x, -y + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1160 GFX_draw_pixel (hgfx, -x + center.x, y + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1161 GFX_draw_pixel (hgfx, -x + center.x, -y + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1163 GFX_draw_pixel (hgfx, y + center.x, x + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1164 GFX_draw_pixel (hgfx, y + center.x, -x + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1165 GFX_draw_pixel (hgfx, -y + center.x, x + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1166 GFX_draw_pixel (hgfx, -y + center.x, -x + center.y, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1167 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1168 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1170
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1171 void GFX_draw_colorline(GFX_DrawCfgScreen *hgfx, point_t start, point_t stop, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1172 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1173 uint32_t pDestination;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1174 uint32_t j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1175 uint32_t temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1176
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1177 if(start.x == stop.x)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1178 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1179 if(stop.y < start.y)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1180 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1181 temp = stop.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1182 stop.y = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1183 start.y = temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1184 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1185 pDestination = (uint32_t)hgfx->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1186 pDestination += start.x * hgfx->ImageHeight * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1187 pDestination += start.y * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1188 for (j = stop.y - start.y; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1189 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1190 *(__IO uint8_t*)pDestination = color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1191 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1192 *(__IO uint8_t*)pDestination = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1193 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1194 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1195 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1196 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1197 if(start.y == stop.y)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1198 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1199 if(stop.x < start.x)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1200 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1201 temp = stop.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1202 stop.x = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1203 start.x = temp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1204 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1205 pDestination = (uint32_t)hgfx->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1206 pDestination += start.x * hgfx->ImageHeight * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1207 pDestination += start.y * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1208 for (j = stop.x - start.x; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1209 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1210 *(__IO uint8_t*)pDestination = color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1211 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1212 *(__IO uint8_t*)pDestination = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1213 pDestination -= 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1214 pDestination += hgfx->ImageHeight * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1215 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1217 else // diagonal Bresenham's_line_algorithm
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1218 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1219 int x0 = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1220 int y0 = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1221 int x1 = stop.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1222 int y1 = stop.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1223 int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1224 int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1225 int err = (dx>dy ? dx : -dy)/2, e2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1227 for(;;)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1228 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1229 pDestination = (uint32_t)hgfx->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1230 pDestination += ((x0 * hgfx->ImageHeight) + y0) * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1231 *(__IO uint8_t*)pDestination = color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1232 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1233 *(__IO uint8_t*)pDestination = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1234 if (x0==x1 && y0==y1) break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1235 e2 = err;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1236 if (e2 >-dx) { err -= dy; x0 += sx; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1237 if (e2 < dy) { err += dx; y0 += sy; }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1238 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1239 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1240 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1241
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1243 void GFX_draw_Grid(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, int vlines, float vdeltaline, int hlines, float hdeltalines, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1244 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1245 point_t p1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1246 point_t p2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1247 int winthight = window.bottom - window.top;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1248 int winwidth = window.right - window.left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1249 float deltaline = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1251 if(vlines > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1252 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1253 deltaline = ((float)winwidth) /vlines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1254
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1255 p1.y = 479 - window.top;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1256 p2.y = 479 - window.bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1257 for(int i = 0; i <= vlines; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1258 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1259 p1.x = window.left + (int)(i * deltaline + 0.5f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1260 p2.x = p1.x ;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1261 //GFX_draw_colorline(hgfx, p1,p2, color );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1262 GFX_draw_line(hgfx, p1,p2, color );
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1263 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1264 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1265 if(vdeltaline > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1266 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1267 p1.y = 479 - window.top;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1268 p2.y = 479 - window.bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1269 for(int i = 0; i < winwidth/vdeltaline; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1270 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1271 p1.x = window.left + (int)(i * vdeltaline + 0.5f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1272 p2.x = p1.x ;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1273 // GFX_draw_colorline(hgfx, p1,p2, color );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1274 GFX_draw_line(hgfx, p1,p2, color );
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1275 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1276 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1277 if(hlines > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1278 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1279 deltaline = ((float)winthight)/hlines;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1280 p1.x = window.left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1281 p2.x = window.right;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1282 for(int i = 0; i <= hlines; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1283 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1284 p1.y = 479 - window.top - (int)(i * deltaline + 0.5f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1285 p2.y = p1.y;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1286 // GFX_draw_colorline(hgfx, p1,p2, color );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1287 GFX_draw_line(hgfx, p1,p2, color );
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1288 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1289 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1290 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1291
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1292 // ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1293 // GFX_graph_print
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1294 /// @brief Print all those nice curves, especially in logbook und miniLiveLogGraph
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1295 /// @version 0.0.2 hw 160519
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1296 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1297 /// 151022 hw -bug fix
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1298 /// - die aktuelle Version macht keine Linien mehr �ber die gesamte Bildschirmh�he.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1299 /// - daf�r sind L�cher in der Kurve (z.B. Temperaturgraph Tauchgang Matthias 17.10.15 15:19)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1300 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1301 /// more details about range can be found in show_logbook_logbook_show_log_page2() - temperature graph
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1302 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1303 /// @param window: top and bottom is only the range used by the data of the graph, not the entire screen / scale
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1304 /// @param drawVeilUntil: ist auff�llen des Bereichs unter der Kurve mit etwas hellerer Farbe
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1305 /// @param Xdivide: wird bisher nichr benutzt.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1306 // ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1307
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1308
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1309 void GFX_graph_print(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, const int16_t drawVeilUntil, uint8_t Xdivide, uint16_t dataMin, uint16_t dataMax, uint16_t *data, uint16_t datalength, uint8_t color, uint8_t *colour_data)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1310 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1311 uint16_t* pDestination_tmp;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1312 uint16_t* pDestination_start;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1313 uint16_t* pDestination_end;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1314 uint16_t* pDestination_zero_veil;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1315
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1316 SSettings* pSettings;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1318 uint32_t max = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1319 int windowheight = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1320 int windowwidth = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1321 int i = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1322 int w1 = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1323 int w2 = -1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1325 uint32_t h_ulong = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1326 uint32_t h_ulong_old = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1327 _Bool invert = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1328
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1329 uint16_t dataDelta = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1330 uint16_t dataDeltaHalve = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1331 uint16_t dataTemp = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1332
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1333 uint8_t colorDataTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1334 uint8_t colormask = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1335
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1336 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1337 pDestination_zero_veil = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1338
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1339 if(dataMin > dataMax)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1340 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1341 uint16_t dataFlip;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1342 dataFlip = dataMin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1343 dataMin = dataMax;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1344 dataMax = dataFlip;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1345 invert = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1346 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1347 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1348 invert = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1349
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1350 colormask = color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1351
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1352 pSettings = settingsGetPointer();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1353
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1354 if(window->bottom > 479)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1355 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1356 if(window->top > 479)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1357 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1358 if(window->right > 799)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1359 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1360 if(window->left > 799)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1361 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1362 if(window->bottom < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1363 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1364 if(window->top < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1365 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1366 if(window->right < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1367 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1368 if(window->left < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1369 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1370 if(window->bottom <= window->top)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1371 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1372 if(window->right <= window->left)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1373 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1375 windowheight = window->bottom - window->top ;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1376 windowwidth = window->right - window->left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1377 w1 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1378 w2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1379 if(dataMax == dataMin)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1380 dataMax++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1381 dataDelta = (unsigned long)(dataMax - dataMin);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1382 dataDeltaHalve = dataDelta / 2;
296
87f83879cecb Possible bugfix: do not use bitwise and (&)
Jan Mulder <jlmulder@xs4all.nl>
parents: 121
diff changeset
1383 while((w1 <= windowwidth) && (w2 < datalength))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1384 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1385 int tmp = (10 * w1 * (long)datalength)/windowwidth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1386 w2 = tmp/10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1387 int rest = tmp - w2*10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1388 if(rest >= 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1389 w2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1391 if((datalength - 1) < w2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1392 w2 = datalength-1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1393
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1394 if(colour_data != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1395 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1396 colorDataTemp = colour_data[w2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1397 colormask = color + colorDataTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1398 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1399
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1400 dataTemp = data[w2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1401 if(Xdivide > 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1402 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1403 w2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1404 for(i=1;i<Xdivide;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1405 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1406 if(data[w2]>dataTemp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1407 dataTemp = data[w2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1408 w2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1409 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1410 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1412 if(dataTemp > dataMin)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1413 dataTemp -= dataMin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1414 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1415 dataTemp = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1416
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1417 if(invert)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1418 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1419 if(dataTemp < dataDelta)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1420 dataTemp = dataDelta - dataTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1421 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1422 dataTemp = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1423 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1424
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1425 h_ulong = (unsigned long)dataTemp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1426 h_ulong *= windowheight;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1427 h_ulong += dataDeltaHalve;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1428 h_ulong /= dataDelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1429
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1430 if(h_ulong > (window->bottom - window->top))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1431 h_ulong = (window->bottom - window->top);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1432
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1433 if(!pSettings->FlipDisplay)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1434 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1435 if(drawVeilUntil > 0)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1436 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1437 pDestination_zero_veil = (uint16_t*)hgfx->FBStartAdress;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1438 pDestination_zero_veil += ((479 - (drawVeilUntil - 2) ) + ((w1 + window->left) * hgfx->ImageHeight) );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1439 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1440 else if(drawVeilUntil < 0 )
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1441 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1442 pDestination_zero_veil = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1443 pDestination_zero_veil += ((479 + (drawVeilUntil)) + ((w1 + window->left) * hgfx->ImageHeight) );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1444 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1445 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1446 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1447 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1448 if(drawVeilUntil > 0)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1449 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1450 pDestination_zero_veil = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1451 pDestination_zero_veil += (((drawVeilUntil) ) + ( (window->right - w1) * hgfx->ImageHeight) );
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1452 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1453 else if(drawVeilUntil < 0 )
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1454 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1455 pDestination_zero_veil = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1456 pDestination_zero_veil += 479 - drawVeilUntil + ( (window->right - w1 -1) * hgfx->ImageHeight);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1457 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1458 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1459 if(h_ulong + window->top > max)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1460 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1461 max = h_ulong + window->top;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1462 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1463
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1464 // hw 160519 wof�r ist das? Damit funktioniert Temperatur 25,5�C nicht!
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1465 // if((dataMax == 255) || (data[w2] != 255))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1466 // {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1467 //output_content[pointer] = colormask;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1468 //output_mask[pointer] = true;
593
3a6f922b73ea Added PrintGraph option to skip invalid data entries:
Ideenmodellierer
parents: 583
diff changeset
1469 if(dataTemp != 0xFFFF) /* do not draw invalid data pixels */
3a6f922b73ea Added PrintGraph option to skip invalid data entries:
Ideenmodellierer
parents: 583
diff changeset
1470 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1471 if(w1 > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1472 {
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1473 pDestination_start = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1474 if(!pSettings->FlipDisplay)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1475 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1476 pDestination_start += (((479 - (window->top)) + ((w1 + window->left) * hgfx->ImageHeight)));
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1477 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1478 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1479 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1480 pDestination_start += (((window->top) + ((window->right - w1) * hgfx->ImageHeight)));
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1481 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1482 pDestination_end = pDestination_start;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1483
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1484 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1485 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1486 if(h_ulong >= h_ulong_old)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1487 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1488 pDestination_start -= h_ulong_old;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1489 pDestination_end -= h_ulong;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1490 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1491 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1492 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1493 pDestination_start -= h_ulong;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1494 pDestination_end -= h_ulong_old;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1495 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1496 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1497 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1498 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1499 if(h_ulong < h_ulong_old)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1500 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1501 pDestination_start += h_ulong_old;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1502 pDestination_end += h_ulong;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1503 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1504 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1505 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1506 pDestination_start += h_ulong;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1507 pDestination_end += h_ulong_old;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1508 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1509 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1510
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1511
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1512 // deco stops
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1513 if(drawVeilUntil < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1514 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1515 if(!pSettings->FlipDisplay)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1516 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1517 pDestination_tmp = pDestination_end;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1518 while(pDestination_tmp <= pDestination_zero_veil)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1519 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1520 *(__IO uint16_t*)pDestination_tmp = (0x80 << 8) | colormask;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1521 pDestination_tmp++;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1522 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1523 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1524 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1525 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1526 pDestination_tmp = pDestination_zero_veil;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1527 while(pDestination_tmp <= pDestination_end)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1528 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1529 *(__IO uint16_t*)pDestination_tmp = (0x80 << 8) | colormask;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1530 pDestination_tmp++;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1531 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1532 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1533 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1534 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1535 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1536 // regular graph with veil underneath if requested
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1537 // von oben nach unten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1538 // von grossen pDestination Werten zu kleinen pDestination Werten
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1539 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1540 pDestination_tmp = pDestination_start;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1541 while(pDestination_tmp >= pDestination_end)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1542 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1543 *(__IO uint16_t*)pDestination_tmp = (0xFF << 8) | colormask ;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1544 pDestination_tmp--;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1545 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1546 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1547
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1548 if(!pSettings->FlipDisplay)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1549 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1550 while((drawVeilUntil > 0) && (pDestination_tmp >= pDestination_zero_veil))
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1551 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1552 *(__IO uint16_t*)pDestination_tmp = (0x20 << 8) | colormask ;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1553 pDestination_tmp--;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1554 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1555 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1556 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1557 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1558 pDestination_tmp = pDestination_start;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1559 while((drawVeilUntil > 0) && (pDestination_tmp <= pDestination_zero_veil))
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1560 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1561 *(__IO uint16_t*)pDestination_tmp = (0x20 << 8) | colormask ;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1562 pDestination_tmp++;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1563 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1564 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1565 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1566 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1567 h_ulong_old = h_ulong;
593
3a6f922b73ea Added PrintGraph option to skip invalid data entries:
Ideenmodellierer
parents: 583
diff changeset
1568 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1569 w1++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1570 w2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1571 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1572 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1573
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1574
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1575 void GFX_draw_header(GFX_DrawCfgScreen *hgfx, uint8_t colorId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1576 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1577 uint32_t pDestination;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1578 point_t start, stop, now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1579 uint8_t alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1580
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1581 /* display coordinate system */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1582 start.y = 400;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1583 stop.y = 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1584
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1585 start.x = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1586 stop.x = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1587
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1588 now.y = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1589 now.x = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1590
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1591 while (now.x <= stop.x)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1592 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1593 now.y = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1594 pDestination = (uint32_t)hgfx->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1595 pDestination += now.x * hgfx->ImageHeight * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1596 pDestination += now.y * 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1597 now.x += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1598
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1599 alpha = 27;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1600 while(alpha < 246)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1601 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1602 alpha += 9;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1603 *(__IO uint8_t*)pDestination = colorId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1604 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1605 *(__IO uint8_t*)pDestination = alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1606 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1607 now.y += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1608 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1609
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1610 while(now.y <= stop.y)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1611 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1612 *(__IO uint8_t*)pDestination = colorId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1613 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1614 *(__IO uint8_t*)pDestination = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1615 pDestination += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1616 now.y += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1617 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1618 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1619 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1620
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1621 void GFX_draw_box2(GFX_DrawCfgScreen *hgfx, point_t start, point_t stop, uint8_t color, uint8_t roundCorners)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1622 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1623 point_t point2, point4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1625 if(roundCorners)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1626 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1627 point2.x = stop.x - start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1628 point2.y = stop.y - start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1629 GFX_draw_box(hgfx,start,point2,1,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1630 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1631 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1632 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1633 point2.x = stop.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1634 point2.y = start.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1635
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1636 point4.x = start.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1637 point4.y = stop.y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1638
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1639 GFX_draw_line(hgfx,start,point2,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1640 GFX_draw_line(hgfx,point2,stop,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1641 GFX_draw_line(hgfx,stop,point4,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1642 GFX_draw_line(hgfx,point4,start,color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1643 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1644 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1645
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1646 void GFX_draw_box(GFX_DrawCfgScreen *hgfx, point_t LeftLow, point_t WidthHeight, uint8_t Style, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1647 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1648 uint16_t* pDestination;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1649 uint16_t* pStart;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1650 uint32_t j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1651 uint32_t lineWidth, lineHeight;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1652 int x, y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1653 uint8_t intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1654 int stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1655
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1656 typedef struct {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1657 int x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1658 int y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1659 uint8_t intensity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1660 } corner_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1661 const corner_t corner[16] = {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1662 {3,3,255}, // nur einmal
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1663 {9,0,242},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1664 {8,0,194},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1665 {7,0,115},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1666 {6,0,36},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1667 {9,1,33},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1668 {8,1,84},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1669 {7,1,161},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1670 {6,1,255},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1671 {5,1,242},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1672 {4,1,36},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1673 {6,2,33},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1674 {5,2,84},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1675 {4,2,255},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1676 {3,2,84},
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1677 {4,3,110}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1678 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1679
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1680 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1681 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1682
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1683 lineWidth = WidthHeight.x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1684 lineHeight = WidthHeight.y;
114
79b19d56ab08 Eliminate warnings
Ideenmodellierer
parents: 110
diff changeset
1685 pStart = (uint16_t*)hgfx->FBStartAdress;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1686
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1687 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1688 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1689 pStart += LeftLow.x * hgfx->ImageHeight;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1690 pStart += LeftLow.y;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1691 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1692 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1693 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1694 {
622
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
1695 pStart += (799 - LeftLow.x) * hgfx->ImageHeight;
8f78faf88fc5 Adjustments for flipped display view:
Ideenmodellierer
parents: 612
diff changeset
1696 pStart += (479 - LeftLow.y);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1697 stepdir = -1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1698 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1699
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1700 // Untere Linie
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1701 pDestination = pStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1702 if(Style)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1703 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1704 pDestination += stepdir * 10 * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1705 lineWidth -= 18;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1706 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1707 for (j = lineWidth; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1708 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1709
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1710 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1711 pDestination += stepdir * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1712 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1713
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1714 // Obere Linie
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1715
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1716 pDestination = pStart + stepdir * WidthHeight.y;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1717 if(Style)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1718 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1719 pDestination += stepdir * 10 * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1720 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1721
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1722 for (j = lineWidth; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1723 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1724 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1725 pDestination += stepdir * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1726 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1727
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1728 // Linke Linie
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1729 pDestination = pStart;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1730
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1731 if(Style)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1732 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1733 pDestination += stepdir * 10;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1734 lineHeight -= 18;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1735 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1736
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1737 for (j = lineHeight; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1738 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1739 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1740 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1741 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1742
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1743
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1744 // Rechte Linie
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1745
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1746 pDestination = pStart + stepdir * WidthHeight.x * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1747 if(Style)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1748 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1749 pDestination += stepdir * 10;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1750 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1751
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1752 for (j = lineHeight; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1753 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1754 *(__IO uint16_t*)pDestination = 0xFF00 + color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1755 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1756 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1757
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1758
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1759 // Ecken wenn notwendig == Style
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1760 if(Style)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1761 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1762 // links unten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1763 pDestination = pStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1764 x = corner[0].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1765 y = corner[0].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1766 intensity = corner[0].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1767
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1768 *(__IO uint16_t*)(pDestination + stepdir * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1769
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1770 for(j = 15; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1771 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1772 x = corner[j].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1773 y = corner[j].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1774 intensity = corner[j].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1775 *(__IO uint16_t*)(pDestination + stepdir * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1776 *(__IO uint16_t*)(pDestination + stepdir * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1777 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1778 // links oben
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1779 pDestination = pStart + stepdir * WidthHeight.y;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1780 x = corner[0].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1781 y = corner[0].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1782 intensity = corner[0].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1783 *(__IO uint16_t*)(pDestination + stepdir * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1784
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1785 for(j = 15; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1786 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1787 x = corner[j].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1788 y = corner[j].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1789 intensity = corner[j].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1790 *(__IO uint16_t*)(pDestination + stepdir * (-y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1791 *(__IO uint16_t*)(pDestination + stepdir * (-x + (y * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1792 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1793 // rechts unten
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1794 pDestination = pStart + stepdir * WidthHeight.x * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1795 x = corner[0].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1796 y = corner[0].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1797 intensity = corner[0].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1798 *(__IO uint16_t*)(pDestination + stepdir * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1799
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1800 for(j = 15; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1801 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1802 x = corner[j].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1803 y = corner[j].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1804 intensity = corner[j].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1805 *(__IO uint16_t*)(pDestination + stepdir * (y - (x * hgfx->ImageHeight))) = (intensity << 8) + color;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1806 *(__IO uint16_t*)(pDestination + stepdir * (x - (y * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1807 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1808 // rechts oben
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1809 pDestination = pStart + stepdir * WidthHeight.y + stepdir * WidthHeight.x * hgfx->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1810 x = corner[0].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1811 y = corner[0].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1812 intensity = corner[0].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1813 *(__IO uint16_t*)(pDestination + stepdir * -1 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1814
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1815 for(j = 15; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1816 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1817 x = corner[j].x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1818 y = corner[j].y;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1819 intensity = corner[j].intensity;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1820 *(__IO uint16_t*)(pDestination + stepdir * -1 * (y + (x * hgfx->ImageHeight))) = (intensity << 8) + color;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1821 *(__IO uint16_t*)(pDestination + stepdir * -1 * (x + (y * hgfx->ImageHeight))) = (intensity << 8) + color;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1822 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1823 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1824 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1825
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1826
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1827 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1828 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1829 * @brief GFX write label. / Write string with defined color
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1830 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1831 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1832 * @date 07-July-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1833 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1834 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1835 * @param hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1836 * @param color: 16bit Alpha+CLUT.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1837 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1838 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1839
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1840 uint32_t GFX_write_label(const tFont *Font, GFX_DrawCfgWindow* hgfx, const char *pText, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1841 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1842 return GFX_write_string_color(Font, hgfx, pText, 0, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1843 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1844
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1845
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1846 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1847 ******************************************************************************
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
1848 * @brief GFX writeGfx_write_label_varstring. / Write string with all parameters and font color options
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
1849 heinrichs weikamp gmbh
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1850 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1851 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1852 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1853 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1854 * @param XleftGimpStyle:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1855 * @param XrightGimpStyle:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1856 * @param YtopGimpStyle:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1857 * @param color:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1858 * @param tFont:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1859 * @param text: text to be printed
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1860 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1861 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1862
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1863 void Gfx_write_label_var(GFX_DrawCfgScreen *screenInput, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const uint8_t color, const char *text)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1864 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1865
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1866 GFX_DrawCfgWindow hgfx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1867
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1868
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1869 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1870 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1871
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1872
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1873 if(XrightGimpStyle > 799)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1874 XrightGimpStyle = 799;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1875 if(XleftGimpStyle >= XrightGimpStyle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1876 XleftGimpStyle = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1877 if(YtopGimpStyle > 479)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1878 YtopGimpStyle = 479;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1879 hgfx.Image = screenInput;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1880 hgfx.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1881 hgfx.WindowLineSpacing = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1882 hgfx.WindowTab = 0;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1883
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1884 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1885 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1886 hgfx.WindowX0 = XleftGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1887 hgfx.WindowX1 = XrightGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1888 hgfx.WindowY1 = 479 - YtopGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1889 if(hgfx.WindowY1 < Font->height)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1890 hgfx.WindowY0 = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1891 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1892 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1893 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1894 else
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1895 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1896 hgfx.WindowX0 = 800 - XrightGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1897 hgfx.WindowX1 = 800 - XleftGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1898 hgfx.WindowY0 = YtopGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1899 if(hgfx.WindowY0 + Font->height > 480)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1900 hgfx.WindowY1 = 480;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1901 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1902 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
1903 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1904 GFX_write_label(Font, &hgfx, text, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1905 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1906
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1907 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1908 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1909 * @brief GFX write string. / Write string with all parameters and font options
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1910 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1911 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1912 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1913 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1914 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1915 * @param hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1916 * @param color: 32bit ARGB8888.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1917 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1918 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1919
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1920 uint16_t GFX_return_offset(const tFont *Font, char *pText, uint8_t position)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1921 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1922 char character;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1923 uint16_t digit, i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1924 uint8_t found;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1925 uint16_t distance;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1926
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1927 if(position == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1928 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1929
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1930 distance = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1931 for(digit = 0; digit < position; digit++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1932 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1933 character = pText[digit];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1934 if(character == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1935 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1936
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1937 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1938 for(i=0;i<Font->length;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1939 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1940 if(Font->chars[i].code == character)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1941 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1942 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1943 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1944 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1945 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1946 if(found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1947 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1948 distance += (uint16_t)(Font->chars[i].image->width);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1949 if(Font == &FontT144)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1950 distance += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1951 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1952 if(Font == &FontT105)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1953 distance += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1954 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1955 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1956 return distance;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1957
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1958 /* FEHLT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1959 if(*pText < ' ')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1960 if((*pText) & 0x80)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1961
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1962 if(((tFont *)settings.font == &FontT105) && settings.dualFont && ((*pText == '.') || (*pText == ':')))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1963 settings.font = (uint32_t)&FontT54;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1964 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1965 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1966
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1967 void GFX_clean_line(GFX_DrawCfgWindow* hgfx, uint32_t line_number)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1968 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1969 uint16_t height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1970 uint32_t pDestination, i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1971 uint16_t left, width, bottom, nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1972
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1973 bottom = hgfx->WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1974
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1975 if(hgfx->WindowNumberOfTextLines && line_number && (line_number <= hgfx->WindowNumberOfTextLines))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1976 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1977 bottom += hgfx->WindowLineSpacing * (hgfx->WindowNumberOfTextLines - line_number);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1978 height = hgfx->WindowLineSpacing;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1979 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1980 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1981 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1982 height = 1 + hgfx->WindowY1 - bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1983 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1984
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1985 pDestination = (uint32_t)hgfx->Image->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1986
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1987 left = hgfx->WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1988 width = 1 + hgfx->WindowX1 - left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1989 nextlineStep = hgfx->Image->ImageHeight - height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1990 nextlineStep *= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1991 pDestination += 2 * bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1992 pDestination += 2 * hgfx->Image->ImageHeight * left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1993
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1994 for(j = width; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1995 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1996 for(i = height; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1997 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1998 *(__IO uint16_t*)pDestination = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1999 pDestination += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2000 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2001 pDestination += nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2002 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2003 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2004
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2005
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2006 void GFX_clean_area(GFX_DrawCfgScreen *tMscreen, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, uint16_t YBottomGimpStyle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2007 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2008 uint16_t height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2009 uint32_t pDestination, i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2010 int32_t left, width, bottom, nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2011
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2012 bottom = tMscreen->ImageHeight - YBottomGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2013 height = 1 + YBottomGimpStyle - YtopGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2015 if(bottom < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2016 bottom = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2017 if(height > tMscreen->ImageHeight)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2018 height = tMscreen->ImageHeight;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2019
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2020 pDestination = tMscreen->FBStartAdress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2021
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2022 left = XleftGimpStyle;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2023 width = 1 + XrightGimpStyle - left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2024 if(width < 1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2025 width = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2026
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2027 if(width > tMscreen->ImageWidth)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2028 width = tMscreen->ImageWidth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2029
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2030 nextlineStep = tMscreen->ImageHeight - height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2031 nextlineStep *= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2032 pDestination += 2 * bottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2033 pDestination += 2 * tMscreen->ImageHeight * left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2034
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2035 for(j = width; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2036 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2037 for(i = height; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2038 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2039 *(__IO uint16_t*)pDestination = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2040 pDestination += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2041 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2042 pDestination += nextlineStep;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2043 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2044 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2045
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2046
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2047 uint32_t GFX_write_string(const tFont *Font, GFX_DrawCfgWindow* hgfx, const char *pText, uint32_t line_number)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2048 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2049 return GFX_write_string_color(Font, hgfx, pText, line_number, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2050 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2051
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2052 uint32_t GFX_write_string_color(const tFont *Font, GFX_DrawCfgWindow* hgfx, const char *pText, uint32_t line_number, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2053 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2054 if(hgfx->Image->FBStartAdress < FBGlobalStart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2055 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2056
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2057 GFX_CfgWriteString settings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2058 uint32_t newXdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2059 uint8_t minimal = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2060 // uint32_t try_again;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2061
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2062 if(hgfx->WindowNumberOfTextLines && line_number && (line_number <= hgfx->WindowNumberOfTextLines))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2063 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2064 settings.Ydelta = hgfx->WindowLineSpacing * (hgfx->WindowNumberOfTextLines - line_number);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2065 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2066 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2067 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2068 settings.Ydelta = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2069 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2070 settings.font = (uint32_t)Font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2071 settings.Xdelta = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2072 settings.color = color;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2073 settings.invert = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2074 settings.resize = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2075 settings.dualFont = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2076 settings.spaceMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2077 settings.singleSpaceWithSizeOfNextChar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2078 settings.useTinyFont = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2079 settings.TinyFontExtraYdelta = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2080 settings.TinyFont = (uint32_t)Font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2081 settings.doubleSize = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2082
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2083 if((*pText) == TXT_MINIMAL) // for customtext and anything with Sonderzeichen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2084 minimal = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2085 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2086 minimal = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2087
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2088 if(Font == &FontT144)
884
940f8e132638 Minor screen cleanup:
Ideenmodellierer
parents: 875
diff changeset
2089 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2090 settings.TinyFont = (uint32_t)&FontT84;
884
940f8e132638 Minor screen cleanup:
Ideenmodellierer
parents: 875
diff changeset
2091 settings.Ydelta = 12;
940f8e132638 Minor screen cleanup:
Ideenmodellierer
parents: 875
diff changeset
2092 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2093 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2094 if(Font == &FontT105)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2095 settings.TinyFont = (uint32_t)&FontT54;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2096 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2097 if(Font == &FontT54)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2098 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2099 settings.TinyFont = (uint32_t)&FontT48;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2100 settings.TinyFontExtraYdelta = -9;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2101 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2102 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2103 if(Font == &FontT48)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2104 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2105 settings.TinyFont = (uint32_t)&FontT24;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2106 settings.TinyFontExtraYdelta = 6;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2107 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2108 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2109 if(Font == &FontT42)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2110 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2111 settings.TinyFont = (uint32_t)&FontT24;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2112 settings.TinyFontExtraYdelta = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2113 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2114
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2115 settings.actualFont = (tFont *)settings.font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2117 while ((*pText != 0) && (settings.Xdelta != 0x0000FFFF))// und fehlend: Abfrage window / image size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2118 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2119 // try_again = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2121 if((*pText == '\177') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2122 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2123 if(settings.singleSpaceWithSizeOfNextChar)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2124 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2125 settings.singleSpaceWithSizeOfNextChar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2126 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2127 settings.Xdelta += *pText;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2128 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2129 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2130 settings.singleSpaceWithSizeOfNextChar = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2131 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2132 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2133 if(*pText < ' ')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2134 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2135 /* Xdelta -inline- changes */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2136 if((*pText == '\t') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2137 settings.Xdelta = hgfx->WindowTab - hgfx->WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2138 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2139 if(*pText == '\r') // carriage return, no newline
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2140 settings.Xdelta = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2141 else
537
0ad0b26ec56b Added center / right alignment option to custom text display:
Ideenmodellierer
parents: 509
diff changeset
2142 if((*pText == '\001')) // center
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2143 settings.Xdelta = GFX_write__Modify_Xdelta__Centered(&settings, hgfx, pText+1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2144 else
537
0ad0b26ec56b Added center / right alignment option to custom text display:
Ideenmodellierer
parents: 509
diff changeset
2145 if((*pText == '\002')) // right
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2146 settings.Xdelta = GFX_write__Modify_Xdelta__RightAlign(&settings, hgfx, pText+1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2147 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2148 if((*pText == '\003') && !minimal) // doubleSize
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2149 settings.doubleSize = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2150 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2151 /* Xdelta -up/down changes */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2152 if((*pText == '\f') && !minimal) // form feed = top align
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2153 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2154 if((hgfx->WindowY1 - hgfx->WindowY0) >= ((tFont *)settings.font)->height)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2155 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2156 settings.Ydelta = hgfx->WindowY1 - hgfx->WindowY0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2157 settings.Ydelta -= ((tFont *)settings.font)->height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2158 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2159 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2160 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2161 if(*pText == '\n') // newline, no carriage return
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2162 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2163 if(hgfx->WindowNumberOfTextLines && (line_number < hgfx->WindowNumberOfTextLines))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2164 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2165 line_number++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2166 settings.Ydelta = hgfx->WindowLineSpacing * (hgfx->WindowNumberOfTextLines - line_number);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2167 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2168 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2169 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2170 /* Font style changes */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2171 if(*pText == '\a')
737
5071d554aaa5 NEW: Add mini compass with marker declination indication
heinrichsweikamp
parents: 705
diff changeset
2172 settings.invert = settings.invert ? 0 : 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2173 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2174 if((*pText == '\016') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2175 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2176 if(settings.dualFont == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2177 settings.dualFont = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2178 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2179 settings.actualFont = (tFont *)settings.TinyFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2180 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2181 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2182 if((*pText == '\017') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2183 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2184 settings.dualFont = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2185 settings.actualFont = (tFont *)settings.font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2186 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2187 else
874
heinrichsweikamp
parents: 873
diff changeset
2188 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2189 if((*pText == '\005') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2190 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2191 newXdelta = GFX_write_char(hgfx, &settings, 'a', (tFont *)&Awe48);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2192 settings.Xdelta = newXdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2193 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2194 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2195 if((*pText == '\006') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2196 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2197 newXdelta = GFX_write_char(hgfx, &settings, 'b', (tFont *)&Awe48);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2198 settings.Xdelta = newXdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2199 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2200 else
874
heinrichsweikamp
parents: 873
diff changeset
2201 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2202 if((*pText >= '\020') && (*pText <= '\032') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2203 settings.color = *pText - '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2204 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2205 if((*pText == '\034') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2206 settings.spaceMode = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2207 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2208 if((*pText == '\035') && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2209 settings.spaceMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2210 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2211 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2212 if(((*pText) == TXT_2BYTE) && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2213 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2214 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2215 settings.Xdelta = GFX_write_substring(&settings, hgfx, (uint8_t)TXT_2BYTE, (int8_t)*pText);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2217 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2218 if(((*pText) & 0x80) && !minimal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2219 settings.Xdelta = GFX_write_substring(&settings, hgfx, (uint8_t)*pText, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2220 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2221 if(!settings.invert && (*pText == ' '))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2222 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2223 if(settings.spaceMode == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2224 settings.Xdelta += ((tFont *)settings.font)->spacesize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2225 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2226 settings.Xdelta += ((tFont *)settings.font)->spacesize2Monospaced;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2227 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2228 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2229 if((settings.spaceMode == 1) && (*pText == ' '))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2230 settings.Xdelta += ((tFont *)settings.font)->spacesize2Monospaced;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2231 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2232 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2233 if(((tFont *)settings.font == &FontT144) && ((*pText == '.') || (*pText == ':')))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2234 settings.actualFont = (tFont *)settings.TinyFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2235 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2236 if(((tFont *)settings.font == &FontT105) && settings.dualFont && ((*pText == '.') || (*pText == ':')))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2237 settings.actualFont = (tFont *)settings.TinyFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2238
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2239 if(settings.actualFont == (tFont *)settings.TinyFont)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2240 settings.Ydelta += settings.TinyFontExtraYdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2241
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2242 newXdelta = GFX_write_char(hgfx, &settings, *(uint8_t *)pText, settings.actualFont);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2243 settings.Xdelta = newXdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2244
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2245 if(settings.actualFont == (tFont *)settings.TinyFont)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2246 settings.Ydelta -= settings.TinyFontExtraYdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2247 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2248 if(pText != 0) /* for TXT_2BYTE */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2249 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2250 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2251 return settings.Ydelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2252 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2254 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2255 /******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2256 Static Function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2257 *******************************************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2258
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2259 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2260 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2261 * @brief GFX write substring. / Write string without parameters
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2262 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2263 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2264 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2265 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2266 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2267 * @param hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2268 * @param color: 32bit ARGB8888.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2269 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2270 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2271
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2272 static uint32_t GFX_write_substring(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, uint8_t textId, int8_t nextCharFor2Byte)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2273 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2274 uint8_t i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2275 uint32_t found;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2276 uint32_t pText;
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2277 uint16_t decodeUTF8;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2278 #ifndef BOOTLOADER_STANDALONE
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2279 uint8_t gfx_selected_language = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2280 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2281 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2282 gfx_selected_language = pSettings->selected_language;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2283 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2284 #endif
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2285
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2286 // -----------------------------
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2287 if(textId != (uint8_t)TXT_2BYTE)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2288 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2289 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2290 j = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2291 for(i=(uint8_t)TXT_Language;i<(uint8_t)TXT_END;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2292 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2293 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2294 if(text_array[j].code == textId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2295 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2296 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2297 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2298 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2299 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2300 j++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2301 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2302 if(!found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2303 return cfg->Xdelta;
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2304
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2305 // -----------------------------
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2306 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2307 pText = (uint32_t)text_array[j].text[gfx_selected_language];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2308 if(!pText)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2309 pText = (uint32_t)text_array[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2310 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2311 if(*(char*)pText == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2312 pText = (uint32_t)text_array[j].text[0];
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2313 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2314 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2315 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2316 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2317 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2318 if(!nextCharFor2Byte)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2319 return cfg->Xdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2320
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2321 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2322 for(j=0;j<(uint8_t)TXT2BYTE_END-(uint8_t)TXT2BYTE_START;j++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2323 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2324 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2325 if((uint8_t)text_array2[j].code == (uint8_t)nextCharFor2Byte)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2326 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2327 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2328 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2329 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2330 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2331 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2332 if(!found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2333 return cfg->Xdelta;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2334 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2335 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2336 pText = (uint32_t)text_array2[j].text[gfx_selected_language];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2337 if(!pText)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2338 pText = (uint32_t)text_array2[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2339 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2340 if(*(char*)pText == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2341 pText = (uint32_t)text_array2[j].text[0];
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2342 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2343 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2344 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2345
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2346 if(cfg->actualFont == (tFont *)cfg->TinyFont)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2347 cfg->Ydelta += cfg->TinyFontExtraYdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2348
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2349 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2350 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2351 if(*(char*)pText == '\t')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2352 cfg->Xdelta = hgfx->WindowTab - hgfx->WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2353 else
612
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2354 if((*(char*)pText == ' ') && (cfg->invert == 0)) /* bypass drawing of white space only for not inverted mode */
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2355 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2356 cfg->Xdelta += ((tFont *)cfg->actualFont)->spacesize;
612
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2357 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2358 else
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2359 if((*(char*)pText) & 0x80) /* Identify a UNICODE character other than standard ASCII using the highest bit */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2360 {
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2361 decodeUTF8 = ((*(char*)pText) & 0x1F) << 6; /* use 5bits of first byte for upper part of unicode */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2362 pText++;
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2363 decodeUTF8 |= (*(char*)pText) & 0x3F; /* add lower 6bits as second part of the unicode */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2364 if (decodeUTF8 <= 0xff) /* The following function has a uint8 input parameter ==> no UNICODEs > 0xff supported */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2365 {
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2366 cfg->Xdelta = GFX_write_char(hgfx, cfg, (uint8_t)decodeUTF8, (tFont *)cfg->actualFont);
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2367 }
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2368 }
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
2369 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2370 cfg->Xdelta = GFX_write_char(hgfx, cfg, *(uint8_t *)pText, (tFont *)cfg->actualFont);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2371
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2372 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2373 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2375 if(cfg->actualFont == (tFont *)cfg->TinyFont)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2376 cfg->Ydelta -= cfg->TinyFontExtraYdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2378 return cfg->Xdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2379 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2380
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2381
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2382 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2383 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2384 * @brief GFX write char. / Write non-inverted, non-colored with entire 8 bit range
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2385 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2386 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2387 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2388 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2389 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2390 * @param hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2391 * @param Ydelta: input
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2392 * @param character: character
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2393 * @param *Font: pointer to font to be used for this char
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2394 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2395 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2396
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2397 static uint32_t GFX_write_char_doubleSize(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2398 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2399 uint32_t i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2400 uint32_t width, height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2401 uint32_t found;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2402 uint16_t* pDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2403 uint32_t pSource;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2404 uint32_t OffsetDestination;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2405 uint32_t width_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2406 uint32_t height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2407 uint32_t char_truncated_WidthFlag;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2408 uint32_t char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2409 uint8_t fill;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2410 uint32_t widthFont, heightFont;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2411 uint32_t nextLine;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2412 int32_t stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2413
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2414 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2415 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2416
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2417 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2418 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2419 stepdir = -1; /* decrement address while putting pixels */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2420 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2421 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2422 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2423 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2424 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2425
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2426
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2427 if(hgfx->Image->ImageWidth <= (hgfx->WindowX0 + cfg->Xdelta))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2428 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2429
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2430 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2431 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2432 for(i=0;i<Font->length;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2433 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2434 if(Font->chars[i].code == character)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2435 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2436 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2437 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2438 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2439 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2440 if(!found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2441 return cfg->Xdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2442
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2443 pSource = ((uint32_t)Font->chars[i].image->data);
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2444 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2445
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2446 heightFont = Font->chars[i].image->height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2447 widthFont = Font->chars[i].image->width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2449 height = heightFont*2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2450 width = widthFont*2;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2451
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2452
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2453 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2454 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2455 pDestination += (uint32_t)(hgfx->WindowX1 - cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2456 pDestination += (hgfx->WindowY1 - cfg->Ydelta); /* set pointer to delta colum */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2457 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2458 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2459 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2460 pDestination += (uint32_t)(hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2461 pDestination += (hgfx->WindowY0 + cfg->Ydelta); /* set pointer to delta colum */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2462 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2463 OffsetDestination = (hgfx->Image->ImageHeight - height);
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2464 nextLine = hgfx->Image->ImageHeight;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2465
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2466 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2467 char_truncated_WidthFlag = 0;
772
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2468 if(!pSettings->FlipDisplay)
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2469 {
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2470 width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2471 }
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2472 else
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2473 {
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2474 width_left = (hgfx->WindowX1 - cfg->Xdelta);
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2475 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2476 if(width_left < width)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2477 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2478 char_truncated_WidthFlag = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2479 width = width_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2480 widthFont = width/2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2481 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2482 // -----------------------------
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2483
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2484 char_truncated_Height = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2485 height_left = hgfx->Image->ImageHeight - (hgfx->WindowY0 + cfg->Ydelta);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2486 if(height_left < height)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2487 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2488 char_truncated_Height = height - height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2489 if((char_truncated_Height & 1) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2490 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2491 height_left -= 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2492 char_truncated_Height += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2493 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2494 height = height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2495 heightFont = height/2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2496 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2497
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2498 OffsetDestination += char_truncated_Height;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2499 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2500 if(height == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2501 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2502 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2503
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2504 if(cfg->singleSpaceWithSizeOfNextChar)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2505 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2506 cfg->singleSpaceWithSizeOfNextChar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2507
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2508 if(cfg->invert)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2509 fill = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2510 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2511 fill = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2512
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2513 height /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2514 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2515 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2516 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2517 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2518 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2519 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2520 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2521 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2522 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2523 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2524 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2525 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2526 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2527 if(cfg->invert)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2528 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2529 if((heightFont & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2530 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2531 heightFont /= 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2532 for(i = widthFont; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2533 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2534 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2535 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2536 for (j = heightFont; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2537 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2538 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2539 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2540 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2541 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2542 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2543 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2544 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2545
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2546 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2547 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2548 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2549 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2550 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2551 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2552 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2553
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2554 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2555 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2556 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2557 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2558 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2559 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2560 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2561
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2562 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2563 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2564 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2565 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2566 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2567 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2568 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2569 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2570 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2571 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2572 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2573 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2574 pSource++;
612
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2575 for (j = heightFont; j > 0; j--)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2576 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2577 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
612
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2578 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2579 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2580 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2581 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2582 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2583 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2584 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2585 pDestination += stepdir;
612
82d58470fd94 Bugfix inverted whitspace:
Ideenmodellierer
parents: 593
diff changeset
2586 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2587 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2588 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2589 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2590 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2591 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2592 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2593 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2594 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2595 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2596 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2597 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2598 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2599 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2600 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2601 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2602 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2603 pDestination += (OffsetDestination + nextLine) * stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2604 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2605 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2606 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2607 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2608 heightFont /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2609 for(i = widthFont; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2610 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2611 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2612 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2613 for (j = heightFont; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2614 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2615 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2616 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2617 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2618 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2619 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2620 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2621 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2622
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2623 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2624 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2625 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2626 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2627 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2628 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2629 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2630 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2631 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2632 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2633 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2634 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2635 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2636 for (j = heightFont; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2637 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2638 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2639 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2640 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2641 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2642 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2643 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2644 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2645 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2646 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2647 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2648 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2649 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2650 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2651 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2652 pDestination += (OffsetDestination + nextLine) * stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2653 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2654 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2655 } /* inverted */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2656 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2657 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2658 if((heightFont & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2659 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2660 heightFont /= 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2661 for(i = widthFont; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2662 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2663 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2664 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2665 for (j = heightFont; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2666 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2667 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2668 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2669 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2670 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2671 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2672 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2673 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2674
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2675 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2676 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2677 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2678 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2679 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2680 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2681 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2682
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2683 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2684 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2685 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2686 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2687 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2688 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2689 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2690
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2691 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2692 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2693 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2694 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2695 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2696 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2697 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2698 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2699 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2700 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2701 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2702 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2703 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2704 pDestination += stepdir * height;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2705 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2706 pDestination += stepdir * (OffsetDestination + nextLine);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2707 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2708 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2709 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2710 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2711 heightFont /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2712 for(i = widthFont; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2713 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2714 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2715 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2716 for (j = heightFont; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2717 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2718 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2719 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2720 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2721 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2722 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2723 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2724 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2725
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2726 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2727 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2728 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2729 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2730 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2731 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2732 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2733 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2734 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2735 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2736 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2737 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2738 pSource++;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2739 pDestination += stepdir * height;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2740 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2741 pDestination += stepdir * (OffsetDestination + nextLine);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2742 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2743 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2744 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2745
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2746 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2747
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2748 if(Font == &FontT144)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2749 width += 6;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2750 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2751 if(Font == &FontT105)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2752 width += 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2753
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2754 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2755
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2756 if(char_truncated_WidthFlag)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2757 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2758 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2759 return cfg->Xdelta + width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2760
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2761 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2762
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2763
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2764 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2765 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2766 * @brief GFX write char. / Write non-inverted, non-colored with entire 8 bit range
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2767 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2768 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2769 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2770 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2771 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2772 * @param hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2773 * @param Ydelta: input
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2774 * @param character: character
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2775 * @param *Font: pointer to font to be used for this char
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2776 * @retval Ydelta: 0x0000FFFF if not successful or char_truncated
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2777 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2778
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2779 static uint32_t GFX_write_char(GFX_DrawCfgWindow* hgfx, GFX_CfgWriteString* cfg, uint8_t character, tFont *Font)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2780 {
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2781
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2782 #ifndef BOOTLOADER_STANDALONE
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
2783 Font = GFX_Check_Extra_Font(character, Font);
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
2784 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2785 if(cfg->doubleSize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2786 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2787 return GFX_write_char_doubleSize(hgfx, cfg, character, Font);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2788 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2789
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2790 uint32_t i, j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2791 uint32_t width, height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2792 uint32_t found;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2793 uint16_t* pDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2794 uint32_t pSource;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2795 uint32_t OffsetDestination;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2796 uint32_t width_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2797 uint32_t height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2798 uint32_t char_truncated_WidthFlag;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2799 uint32_t char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2800 uint8_t fill;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2801 uint32_t fillpattern;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2802 int16_t stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2803
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2804 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2805 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2806
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2807 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2808 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2809 stepdir = -1; /* decrement address while putting pixels */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2810 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2811 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2812 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2813 stepdir = 1;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2814 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2815
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2816 if(hgfx->Image->ImageWidth <= (hgfx->WindowX0 + cfg->Xdelta))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2817 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2818
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2819 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2820 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2821 for(i=0;i<Font->length;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2822 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2823 if(Font->chars[i].code == character)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2824 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2825 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2826 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2827 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2828 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2829 if(!found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2830 return cfg->Xdelta;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2831 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2832 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2833 if(Font == &Font144)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2834 cfg->Xdelta += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2835 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2836 if(Font == &Font84)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2837 cfg->Xdelta += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2838 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2839 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2840
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2841
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2842 pSource = ((uint32_t)Font->chars[i].image->data);
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2843 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress);
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2844
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2845
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2846 height = Font->chars[i].image->height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2847 width = Font->chars[i].image->width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2848
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2849 OffsetDestination = hgfx->Image->ImageHeight - height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2850
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2851
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2852 /* Xyyyyy y= height */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2853 /* Xyyyyy x= width */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2854 /* Xyyyyy */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2855
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2856 if(pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2857 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2858 pDestination += (hgfx->WindowX1 - cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2859 pDestination += (hgfx->WindowY1 - cfg->Ydelta); /* set pointer to delta colum */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2860 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2861 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2862 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2863 pDestination += (hgfx->WindowX0 + cfg->Xdelta) * hgfx->Image->ImageHeight; /* set pointer to delta row */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2864 pDestination += (hgfx->WindowY0 + cfg->Ydelta); /* set pointer to delta colum */
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2865 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2866
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2867
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2868 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2869 char_truncated_WidthFlag = 0;
772
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2870 if(!pSettings->FlipDisplay)
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2871 {
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2872 width_left = hgfx->Image->ImageWidth - (hgfx->WindowX0 + cfg->Xdelta);
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2873 }
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2874 else
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2875 {
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2876 width_left = (hgfx->WindowX1 - cfg->Xdelta);
b7e43b28bee1 Fix character truncation when screen is flipped. This was causing the dive computer to lock up when in English Units with the screen flipped when the first decompression stop is shown using FONT_105.
izzni
parents: 763
diff changeset
2877 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2878 if(width_left < width)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2879 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2880 char_truncated_WidthFlag = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2881 width = width_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2882 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2883 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2884 char_truncated_Height = 0;
681
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2885 if(!pSettings->FlipDisplay)
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2886 {
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2887 height_left = hgfx->Image->ImageHeight - (hgfx->WindowY0 + cfg->Ydelta);
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2888 }
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2889 else
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2890 {
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2891 height_left = (hgfx->WindowY1 - cfg->Ydelta);
7fa5ef6ae419 Bugfix screen clipping (Flipdisplay mode):
Ideenmodellierer
parents: 649
diff changeset
2892 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2893 if(height_left < height)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2894 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2895 char_truncated_Height = height - height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2896 if((char_truncated_Height & 1) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2897 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2898 height_left -= 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2899 char_truncated_Height += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2900 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2901 height = height_left;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2902 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2903 OffsetDestination += char_truncated_Height;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2904 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2905 if(height == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2906 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2907 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2908
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2909 if(cfg->singleSpaceWithSizeOfNextChar)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2910 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2911 cfg->singleSpaceWithSizeOfNextChar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2912
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2913 if(cfg->invert)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2914 fill = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2915 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2916 fill = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2917
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2918 height /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2919 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2920 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2921 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2922 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2923 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2924 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2925 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2926 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2927 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2928 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2929 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2930 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2931 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2932 if(cfg->invert)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2933 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2934 if((height & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2935 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2936 height /= 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2937 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2938 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2939 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2940 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2941
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2942 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2943 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2944 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2945 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2946 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2947 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2948 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2949 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2950 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2951 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2952 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2953 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2954 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2955 else /* empty line => fast fill */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2956 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2957 pSource++;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2958 fillpattern = (( 0xFF << 8 | cfg->color) << 16) | ( 0xFF << 8 | cfg->color);
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2959 if(pSettings->FlipDisplay) pDestination--; /* address fill from high to low */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2960 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2961 {
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2962 *(__IO uint32_t*)pDestination = fillpattern;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2963 pDestination += stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2964 pDestination += stepdir;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2965 *(__IO uint32_t*)pDestination = fillpattern;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2966 pDestination += stepdir;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2967 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2968 }
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
2969 if(pSettings->FlipDisplay) pDestination++;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2970 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2971 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2972 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2973 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2974 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2975 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2976 height /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2977 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2978 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2979 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2980 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2981 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2982 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2983 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2984 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2985 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2986 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2987 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2988 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2989 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2990 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2991 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2992 pSource++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2993 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2994 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2995 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2996 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
2997 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
2998 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2999 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3000 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3001 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3002 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3003 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3004 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3005 else /* not inverted */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3006 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3007 if((height & 3) == 0) /* unroll for perfomance, by 4 if possible, by 2 (16bit) otherwise */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3008 {
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3009
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3010 height /= 4;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3011
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3012 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3013 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3014 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3015 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3016 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3017 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3018 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3019 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3020 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3021 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3022 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3023 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3024 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3025 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3026 }
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3027
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3028 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3029 }
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3030 else /* clear line */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3031 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3032 pSource++;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3033 fillpattern = (cfg->color << 16) | cfg->color;
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3034 if(pSettings->FlipDisplay) pDestination--; /* address fill from high to low */
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3035
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3036 for (j = height; j > 0; j--)
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3037 {
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3038 *(__IO uint32_t*)pDestination = fillpattern;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3039 pDestination += stepdir;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3040 pDestination += stepdir;
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3041 *(__IO uint32_t*)pDestination = fillpattern;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3042 pDestination += stepdir;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3043 pDestination += stepdir;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3044 }
121
0d97971b771b Use 32bit operations for buffer fills
Ideenmodellierer
parents: 119
diff changeset
3045 if(pSettings->FlipDisplay) pDestination++;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3046 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3047 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3048 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3049 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3050 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3051 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3052 height /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3053 for(i = width; i > 0; i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3054 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3055 if(*(uint8_t*)pSource != 0x01)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3056 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3057 for (j = height; j > 0; j--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3058 {
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3059 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3060 pDestination += stepdir;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3061 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3062 pDestination += stepdir;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3063 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3064 pSource += char_truncated_Height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3065 }
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3066 else /* clear line */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3067 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3068 pSource++;
119
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3069 for (j = height; j > 0; j--)
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3070 {
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3071 *(__IO uint16_t*)pDestination = cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3072 pDestination += stepdir;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3073 *(__IO uint16_t*)pDestination = cfg->color;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3074 pDestination += stepdir;
76fa42fc0b20 Cleanup writechar pointers
Ideenmodellierer
parents: 114
diff changeset
3075 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3076 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3077 pDestination += stepdir * OffsetDestination;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3078 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3079 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3080 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3081
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3082 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3083
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3084 if(Font == &FontT144)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3085 width += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3086 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3087 if(Font == &FontT105)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3088 width += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3089 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3090 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3091 if(Font == &Font144)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3092 width += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3093 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3094 if(Font == &Font84)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3095 width += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3096 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3097 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3098
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3099 if(char_truncated_WidthFlag)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3100 return 0x0000FFFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3101 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3102 return cfg->Xdelta + width;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3103 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3104
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3105 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3107 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3108 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3109 * @brief GFX write Modify helper for center and right align.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3110 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3111 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3112 * @date 17-March-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3113 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3114 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3115 * @param *cText: output
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3116 * @param *pTextInput: input
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3117 * @param gfx_selected_language: gfx_selected_language
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3118 * @retval counter and *cText content
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3119 */
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
3120 static int8_t GFX_write__Modify_helper(char *cText, const char *pTextInput, uint8_t gfx_selected_language)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3121 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3122 uint32_t pText, backup;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3123 uint8_t textId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3124 int8_t counter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3125 uint32_t found;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3126 uint32_t j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3127
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3128 pText = (uint32_t)pTextInput;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3129 counter = 0;
537
0ad0b26ec56b Added center / right alignment option to custom text display:
Ideenmodellierer
parents: 509
diff changeset
3130 while((counter < 100) && (*(char*)pText != 0) && (*(char*)pText != '\r') && (*(char*)pText != '\n'))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3131 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3132 if((*(char*)pText) == TXT_2BYTE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3133 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3134 backup = pText;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3136 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3137 j = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3138 textId = (int8_t)*(char*)(pText + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3139 if(textId != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3140 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3141 for(j=0;j<(uint8_t)TXT2BYTE_END-(uint8_t)TXT2BYTE_START;j++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3142 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3143 if((uint8_t)text_array2[j].code == (uint8_t)textId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3144 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3145 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3146 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3147 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3148 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3149 if(found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3150 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3151 pText = (uint32_t)text_array2[j].text[gfx_selected_language];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3152 if(!pText)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3153 pText = (uint32_t)text_array2[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3154 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3155 if(*(char*)pText == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3156 pText = (uint32_t)text_array2[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3158 while((counter < 100) && (*(char*)pText != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3159 cText[counter++] = *(char*)pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3160 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3161 pText = backup + 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3162 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3163 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3164 pText = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3165 }
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
3166 if(0 != pText && ((*(char*)pText) & 0x80))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3167 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3168 backup = pText;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3170 found = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3171 j = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3172 textId = (uint8_t)*(char*)pText;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3173 for(uint8_t ii=(uint8_t)TXT_Language;ii<(uint8_t)TXT_END;ii++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3174 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3175 if(text_array[j].code == textId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3176 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3177 found = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3178 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3179 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3180 j++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3181 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3182 if(found)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3183 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3184 pText = (uint32_t)text_array[j].text[gfx_selected_language];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3185 if(!pText)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3186 pText = (uint32_t)text_array[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3187 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3188 if(*(char*)pText == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3189 pText = (uint32_t)text_array[j].text[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3190
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3191 while((counter < 100) && (*(char*)pText != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3192 cText[counter++] = *(char*)pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3193 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3194 pText = backup + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3195 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3196 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3197 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3198 cText[counter++] = *(char*)pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3199 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3200 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3201 cText[counter] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3202 return counter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3203 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3204
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3205 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3206 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3207 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3208 * @brief GFX write Modify Ydelta for align. / calc Ydelta for start
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3209 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3210 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3211 * @date 22-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3212 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3213 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3214 * @param *hgfx: check gfx_engine.h.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3215 * @param *cfg: Ydelta, Font
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3216 * @param *pText: character
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3217 * @retval Ydelta: 0 if text has to start left ( and probably does not fit)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3218 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3219
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
3220 static uint32_t GFX_write__Modify_Xdelta__Centered(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3221 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3222 char cText[101];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3223 uint32_t result;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3224 uint32_t Xsum;
583
3860b8fa4b29 Solved minor warnings
Ideenmodellierer
parents: 567
diff changeset
3225 uint32_t j;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3226 uint32_t pText;
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3227 uint16_t decodeUTF8;
481
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3228 uint8_t tinyState = 0; /* used to identify the usage of tiny font */
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3229 tFont* ptargetFont;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3231 #ifndef BOOTLOADER_STANDALONE
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3232 uint8_t gfx_selected_language = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3233 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3234 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3235 gfx_selected_language = pSettings->selected_language;
875
943918a69836 DevBugfix: Added missing default language value
Ideenmodellierer
parents: 874
diff changeset
3236 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3237 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3238 // -----------------------------
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3239 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3240 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language);
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3241 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3242 pText = (uint32_t)&cText[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3243 Xsum = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3244 j = 0;
565
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3245 ptargetFont = (tFont *)cfg->font;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3246 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3247 {
481
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3248 if(*(char*)pText == '\016') /* request font change */
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3249 {
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3250 tinyState++;
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3251 }
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3252 if(*(char*)pText == '\017') /* request font reset */
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3253 {
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3254 tinyState = 0;
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3255 }
565
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3256
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3257 if((ptargetFont == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3258 {
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3259 tinyState++;
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3260 }
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3261
481
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3262 if(tinyState > 1)
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3263 {
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3264 ptargetFont = (tFont *)cfg->TinyFont;
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3265 }
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3266 else
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3267 {
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3268 ptargetFont = (tFont *)cfg->font;
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3269 }
649
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3270
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
3271 decodeUTF8 = *(char*)pText; /* place ASCII char */
649
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3272 if((*(char*)pText == '\005') || (*(char*)pText == '\006'))
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3273 {
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3274 Xsum += 45;
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3275 }
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3276 else
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3277 {
698
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3278 if((*(char*)pText) & 0x80) /* Identify a UNICODE character other than standard ASCII using the highest bit */
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3279 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3280 decodeUTF8 = ((*(char*)pText) & 0x1F) << 6; /* use 5bits of first byte for upper part of unicode */
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3281 pText++;
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3282 decodeUTF8 |= (*(char*)pText) & 0x3F; /* add lower 6bits as second part of the unicode */
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3283 }
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3284 else
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3285 {
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3286 decodeUTF8 = *(char*)pText; /* place ASCII char */
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3287 }
2c2b9c6eb089 Bugfix Empty menu:
Ideenmodellierer
parents: 681
diff changeset
3288 Xsum += GFX_Character_Width(decodeUTF8, ptargetFont);
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3289 }
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
3290
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3291 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3292 j++;
481
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3293 if((ptargetFont == &FontT144) && (*(char*)pText != 0))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3294 Xsum += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3295 else
481
89f6857276f8 Bugfix calculation of string center position:
ideenmodellierer
parents: 314
diff changeset
3296 if((ptargetFont == &FontT105) && (*(char*)pText != 0))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3297 Xsum += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3298 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3299 pText -= j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3301 if(cfg->doubleSize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3302 Xsum *= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3303
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3304 result = hgfx->WindowX1 - hgfx->WindowX0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3305 if(Xsum < result)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3306 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3307 result -= Xsum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3308 result /= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3309 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3310 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3311 result = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3312 return result;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3313 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3314
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3315
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
3316 static uint32_t GFX_write__Modify_Xdelta__RightAlign(GFX_CfgWriteString* cfg, GFX_DrawCfgWindow* hgfx, const char *pTextInput)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3317 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3318 uint32_t result;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3319 uint32_t Xsum;
583
3860b8fa4b29 Solved minor warnings
Ideenmodellierer
parents: 567
diff changeset
3320 uint32_t j;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3321 tFont *font;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3322 char cText[101];
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3323 uint32_t pText;
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3324 uint16_t decodeUTF8;
485
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3325 uint8_t tinyState = 0; /* used to identify the usage of tiny font */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3326
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3327 #ifndef BOOTLOADER_STANDALONE
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3328 uint8_t gfx_selected_language = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3329 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3330 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3331 gfx_selected_language = pSettings->selected_language;
875
943918a69836 DevBugfix: Added missing default language value
Ideenmodellierer
parents: 874
diff changeset
3332 if(gfx_selected_language >= LANGUAGE_END) gfx_selected_language = 0;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3333 #else
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3334 cText[0] = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3335 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3336 // -----------------------------
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3337 #ifndef BOOTLOADER_STANDALONE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3338 GFX_write__Modify_helper(cText,pTextInput,gfx_selected_language);
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
3339 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3340 pText = (uint32_t)&cText[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3341 // -----------------------------
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3342
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3343 font = (tFont *)cfg->font;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3344 Xsum = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3345 j = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3346
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3347 while (*(char*)pText != 0)// und fehlend: Abfrage window / image size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3348 {
485
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3349 if(*(char*)pText == '\016') /* request font change */
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3350 {
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3351 tinyState++;
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3352 }
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3353 if(*(char*)pText == '\017') /* request font reset */
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3354 {
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3355 tinyState = 0;
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3356 }
565
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3357
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3358 if((font == &FontT144) && (*(char*)pText == '.'))
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3359 {
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3360 tinyState++;
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3361 }
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3362 if((font == &FontT105) && ((*(char*)pText == '.') || (*(char*)pText == ':')))
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3363 {
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3364 tinyState++;
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3365 }
7b56d4eda695 Bugfix center / right alignment if dualfont is used:
Ideenmodellierer
parents: 537
diff changeset
3366
485
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3367 if(tinyState > 1)
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3368 {
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3369 font = (tFont *)cfg->TinyFont;
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3370 }
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3371 else
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3372 {
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3373 font = (tFont *)cfg->font;
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3374 }
7a17bfc932b6 Bugfix right alignment of string:
ideenmodellierer
parents: 481
diff changeset
3375
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3376 if(*(char*)pText == ' ')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3377 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3378 Xsum += font->spacesize;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3379 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3380 else
649
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3381 if((*(char*)pText == '\005') || (*(char*)pText == '\006'))
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3382 {
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3383 Xsum += 45;
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3384 }
60162a939c06 Bugfix consider checkbox in calculation of right aligned and centered position:
Ideenmodellierer
parents: 623
diff changeset
3385 else
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3386 {
58
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3387 if((*(char*)pText) & 0x80) /* Identify a UNICODE character other than standard ASCII using the highest bit */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3388 {
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3389 decodeUTF8 = ((*(char*)pText) & 0x1F) << 6; /* use 5bits of first byte for upper part of unicode */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3390 pText++;
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3391 decodeUTF8 |= (*(char*)pText) & 0x3F; /* add lower 6bits as second part of the unicode */
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3392 }
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3393 else
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3394 {
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3395 decodeUTF8 = *(char*)pText;
e97deb6e2705 Added UTF8 decode function
Ideenmodellierer
parents: 38
diff changeset
3396 }
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
3397 Xsum += GFX_Character_Width(decodeUTF8, font); /* lookup character and add width */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3398 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3399 pText++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3400 j++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3401 if((font == &FontT144) && (*(char*)pText != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3402 Xsum += 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3403 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3404 if((font == &FontT105) && (*(char*)pText != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3405 Xsum += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3406 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3407 pText -= j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3408
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3409 if(cfg->doubleSize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3410 Xsum *= 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3412 result = hgfx->WindowX1 - hgfx->WindowX0 - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3413 if(Xsum < result)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3414 result -= Xsum;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3415 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3416 result = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3417
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3418 return result;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3419 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3421 void GFX_LTDC_Init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3422 {
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3423 if (isNewDisplay())
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3424 {
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3425 GFX_LTDC_Init_display1();
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3426 }
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3427 else
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3428 {
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3429 GFX_LTDC_Init_display0();
885
8d3f3a635397 Replaced global hardwareDisplay with unit access:
Ideenmodellierer
parents: 884
diff changeset
3430 }
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3431 }
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3432
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3433 void GFX_LTDC_Init_display0(void)
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3434 {
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3435 /* Timing configuration */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3436
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3437 #define ActiveH_d0 800
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3438 #define ActiveW_d0 480
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3439
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3440 #define Hsync_d0 10
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3441 #define HFP_d0 8
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3442 #define HBP_d0 10
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3443
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3444 #define Vsync_d0 2
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3445 #define VFP_d0 2
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3446 #define VBP_d0 2
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3447
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3448
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3449 /* Horizontal synchronization width = Hsync - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3450 LtdcHandle.Init.HorizontalSync = Hsync_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3451 /* Vertical synchronization height = Vsync - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3452 LtdcHandle.Init.VerticalSync = Vsync_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3453 /* Accumulated horizontal back porch = Hsync + HBP - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3454 LtdcHandle.Init.AccumulatedHBP = Hsync_d0 + HBP_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3455 /* Accumulated vertical back porch = Vsync + VBP - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3456 LtdcHandle.Init.AccumulatedVBP = Vsync_d0 + VBP_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3457 /* Accumulated active width = Hsync + HBP + Active Width - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3458 LtdcHandle.Init.AccumulatedActiveW = Hsync_d0 + HBP_d0 + ActiveW_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3459 /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3460 LtdcHandle.Init.AccumulatedActiveH = Vsync_d0 + VBP_d0 + ActiveH_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3461 /* Total width = Hsync + HBP + Active Width + HFP - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3462 LtdcHandle.Init.TotalWidth = Hsync_d0 + HBP_d0 + ActiveW_d0 + HFP_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3463 /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */
873
e373e90a48db merge new screen stuff
heinrichsweikamp
parents: 870 871
diff changeset
3464 LtdcHandle.Init.TotalHeigh = Vsync_d0 + VBP_d0 + ActiveH_d0 + VFP_d0 - 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3465
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3466 /* Configure R,G,B component values for LCD background color */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3467 LtdcHandle.Init.Backcolor.Red= 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3468 LtdcHandle.Init.Backcolor.Blue= 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3469 LtdcHandle.Init.Backcolor.Green= 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3470
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3471 /* LCD clock configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3472 /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3473 /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3474 /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3475 /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3476
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3477 /* done in base.c SystemClockConfig
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3478
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3479 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3480 PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3481 PeriphClkInitStruct.PLLSAI.PLLSAIR = 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3482 PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3483 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3484 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3485 /* Polarity */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3486 LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3487 LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3488 LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3489 LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IIPC;//LTDC_PCPOLARITY_IPC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3490
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3491 LtdcHandle.Instance = LTDC;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3492
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3493 /* Configure the LTDC */
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3494 if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // initialize GPIO Pins, too
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3495 {
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3496 /* Initialization Error */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3497 GFX_Error_Handler();
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3498 }
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3499 }
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3500
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3501
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3502 void GFX_LTDC_Init_display1(void)
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3503 {
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3504 /* Timing configuration */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3505 #define ActiveH_d1 800
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3506 #define ActiveW_d1 480
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3507
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3508 #define Hsync_d1 2
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3509 #define HFP_d1 8
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3510 #define HBP_d1 8
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3511
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3512 #define Vsync_d1 2
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3513 #define VFP_d1 4 // make sure this value * VSYNC is also set in display.c for OLED_VFP_SET
1006
75f958ca5d0e Minor modification activ gas indicator:
Ideenmodellierer
parents: 999
diff changeset
3514 #define VBP_d1 6 // make sure this value * VSYNC is also set in display.c for OLED_VBP_SET
871
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3515
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3516 /* Horizontal synchronization width = Hsync - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3517 LtdcHandle.Init.HorizontalSync = Hsync_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3518 /* Vertical synchronization height = Vsync - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3519 LtdcHandle.Init.VerticalSync = Vsync_d1 -1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3520 /* Accumulated horizontal back porch = Hsync + HBP - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3521 LtdcHandle.Init.AccumulatedHBP = Hsync_d1 + HBP_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3522 /* Accumulated vertical back porch = Vsync + VBP - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3523 LtdcHandle.Init.AccumulatedVBP = Vsync_d1 + VBP_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3524 /* Accumulated active width = Hsync + HBP + Active Width - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3525 LtdcHandle.Init.AccumulatedActiveW = Hsync_d1 + HBP_d1 + ActiveW_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3526 /* Accumulated active height = Vsync + VBP + Active Heigh - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3527 LtdcHandle.Init.AccumulatedActiveH = Vsync_d1 + VBP_d1 + ActiveH_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3528 /* Total width = Hsync + HBP + Active Width + HFP - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3529 LtdcHandle.Init.TotalWidth = Hsync_d1 + HBP_d1 + ActiveW_d1 + HFP_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3530 /* Total height = Vsync + VBP + Active Heigh + VFP - 1 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3531 LtdcHandle.Init.TotalHeigh = Vsync_d1 + VBP_d1 + ActiveH_d1 + VFP_d1 - 1;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3532
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3533 /* Configure R,G,B component values for LCD background color */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3534 LtdcHandle.Init.Backcolor.Red= 0;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3535 LtdcHandle.Init.Backcolor.Blue= 0;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3536 LtdcHandle.Init.Backcolor.Green= 0;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3537
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3538 /* LCD clock configuration */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3539 /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3540 /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3541 /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/4 = 48 Mhz */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3542 /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_8 = 48/4 = 6Mhz */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3543
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3544 /* done in base.c SystemClockConfig
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3545
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3546 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3547 PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3548 PeriphClkInitStruct.PLLSAI.PLLSAIR = 4;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3549 PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_8;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3550 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3551 */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3552 /* Polarity */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3553 LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3554 LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AL;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3555 LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3556 LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IIPC;//LTDC_PCPOLARITY_IPC;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3557
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3558 LtdcHandle.Instance = LTDC;
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3559
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3560 /* Configure the LTDC */
f7318457df4d support for new screen
heinrichsweikamp
parents: 772
diff changeset
3561 if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) // initialize GPIO Pins, too
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3562 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3563 /* Initialization Error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3564 GFX_Error_Handler();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3565 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3566 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3567
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3568 void GFX_LTDC_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3569 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3570 LTDC_LayerCfgTypeDef Layercfg;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3571
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3572 /* Layer Init */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3573 Layercfg.WindowX0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3574 Layercfg.WindowX1 = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3575 Layercfg.WindowY0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3576 Layercfg.WindowY1 = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3577 Layercfg.PixelFormat = LTDC_PIXEL_FORMAT_AL88;//LTDC_PIXEL_FORMAT_ARGB8888;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3578 Layercfg.FBStartAdress = FB_Address;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3579 Layercfg.Alpha = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3580 Layercfg.Alpha0 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3581 Layercfg.Backcolor.Blue = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3582 Layercfg.Backcolor.Green = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3583 Layercfg.Backcolor.Red = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3584 Layercfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3585 Layercfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3586 Layercfg.ImageWidth = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3587 Layercfg.ImageHeight = 800;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3588
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3589 HAL_LTDC_ConfigCLUT(&LtdcHandle, ColorLUT, CLUT_END, LayerIndex);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3590 HAL_LTDC_ConfigLayer(&LtdcHandle, &Layercfg, LayerIndex);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3591 HAL_LTDC_EnableCLUT(&LtdcHandle, LayerIndex);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3592 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3593
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
3594 static uint32_t GFX_doubleBufferOne(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3595 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3596 return SDRAM_DOUBLE_BUFFER_ONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3597 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3598
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3599
297
87d54b4fd946 cleanup: remove unused code, make static, remove commented code
Jan Mulder <jlmulder@xs4all.nl>
parents: 296
diff changeset
3600 static uint32_t GFX_doubleBufferTwo(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3601 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3602 return SDRAM_DOUBLE_BUFFER_TWO;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3603 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3604
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3605 uint32_t getFrame(uint8_t callerId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3606 {
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3607 static uint8_t lastFrameProvided = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3608 uint8_t i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3609
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3610 /* first iteration: look for a clear frame */
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3611 i = lastFrameProvided;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3612 do
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3613 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3614 i++;
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3615 if(i == MAXFRAMES)
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3616 {
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3617 i = 0;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3618 }
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3619 } while((i != lastFrameProvided) && (frame[i].status != CLEAR));
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3620
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3621 if((i < MAXFRAMES) && (frame[i].status == CLEAR))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3622 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3623 frame[i].status = BLOCKED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3624 frame[i].caller = callerId;
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3625 lastFrameProvided = i;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3626 return frame[i].StartAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3627 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3628
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3629 /* second iteration: look for a frame which may be reused after clearing */
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3630 i = lastFrameProvided;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3631 do
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3632 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3633 i++;
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3634 if(i == MAXFRAMES)
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3635 {
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3636 i = 0;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3637 }
705
158d612a9f4d Bugfix release frame:
Ideenmodellierer
parents: 699
diff changeset
3638 }while((i != lastFrameProvided) && (frame[i].status != RELEASED));
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3639
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3640
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3641 if((i < MAXFRAMES) && (frame[i].status == RELEASED))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3642 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3643 GFX_clear_frame_immediately(frame[i].StartAddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3644 frame[i].status = BLOCKED;
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3645 lastFrameProvided = i;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3646 return frame[i].StartAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3647 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3648 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3649 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3650
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3651
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3652 void GFX_forceReleaseFramesWithId(uint8_t callerId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3653 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3654 for(int i=0; i<MAXFRAMES; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3655 if((frame[i].caller == callerId) && (frame[i].status == BLOCKED))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3656 frame[i].status = RELEASED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3657 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3658
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3659
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3660 void releaseAllFramesExcept(uint8_t callerId, uint32_t frameStartAddress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3661 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3662 for(int i=0; i<MAXFRAMES; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3663 if((frame[i].caller == callerId) && (frame[i].status == BLOCKED) && (frame[i].StartAddress != frameStartAddress))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3664 frame[i].status = RELEASED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3665 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3666
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3667
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3668 uint8_t releaseFrame(uint8_t callerId, uint32_t frameStartAddress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3669 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3670 static uint8_t countErrorCalls = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3672 if(frameStartAddress < FBGlobalStart)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3673 return 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3674
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3675
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3676 uint8_t i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3677
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3678 i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3679 while((i < MAXFRAMES) && (frame[i].StartAddress != frameStartAddress))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3680 i++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3681
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3682 if((i < MAXFRAMES) && (frame[i].StartAddress == frameStartAddress))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3683 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3684 if(frame[i].caller == callerId)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3685 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3686 frame[i].status = RELEASED;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3687 return 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3688 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3689 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3690 countErrorCalls++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3691 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3692 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3693 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3694
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3695
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3696 uint16_t blockedFramesCount(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3697 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3698 uint16_t count = MAXFRAMES;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3699
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3700 for(int i = 0;i<MAXFRAMES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3701 if(frame[i].status == BLOCKED)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3702 count--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3703
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3704 return count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3705 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3706
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3707
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3708 uint8_t housekeepingFrame(void)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3709 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3710 static uint8_t countLogClear = 0;
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3711 uint8_t i;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3712 uint8_t retVal = 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3713
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3714 if(DMA2D_at_work == 255)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3715 {
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3716 i = 0;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3717 /* skip frame cleaning for actual frames which have not yet been replaced by new top/bottom frames */
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3718 while((i < MAXFRAMES) && ((frame[i].status != RELEASED) || (frame[i].StartAddress == GFX_get_pActualFrameTop()) || (frame[i].StartAddress == GFX_get_pActualFrameBottom())))
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3719 i++;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3720
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3721 if((i < MAXFRAMES) && (frame[i].status == RELEASED))
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3722 {
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3723 if(frame[i].caller == 15)
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3724 countLogClear++;
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3725 GFX_clear_frame_dma2d(i);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3726 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3727 else
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3728 {
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3729 retVal = 0; /* no more frame to be cleaned found */
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3730 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3731 }
623
ba83a8ef9bad Improvment frame Handling:
Ideenmodellierer
parents: 622
diff changeset
3732 return retVal;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3733 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3734
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3735
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3736 static void GFX_Dma2d_TransferComplete(DMA2D_HandleTypeDef* Dma2dHandle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3737 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3738 if(DMA2D_at_work < MAXFRAMES)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3739 frame[DMA2D_at_work].status = CLEAR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3740
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3741 DMA2D_at_work = 255;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3742 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3743
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3744
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3745 static void GFX_Dma2d_TransferError(DMA2D_HandleTypeDef* Dma2dHandle)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3746 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3747
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3748 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3749
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3750 static void GFX_Error_Handler(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3751 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3752 /* Turn LED3 on */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3753 // BSP_LED_On(LED3);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3754 while(1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3755 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3756 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3757 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3758
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3759 void write_content_simple(GFX_DrawCfgScreen *tMscreen, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3760 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3761 GFX_DrawCfgWindow hgfx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3762
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3763 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3764 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3765
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3766 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3767 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3768 if(XrightGimpStyle > 799)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3769 XrightGimpStyle = 799;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3770 if(XleftGimpStyle >= XrightGimpStyle)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3771 XleftGimpStyle = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3772 if(YtopGimpStyle > 479)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3773 YtopGimpStyle = 479;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3774 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3775 hgfx.Image = tMscreen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3776 hgfx.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3777 hgfx.WindowLineSpacing = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3778 hgfx.WindowTab = 0;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3779
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3780 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3781 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3782 hgfx.WindowX0 = XleftGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3783 hgfx.WindowX1 = XrightGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3784 hgfx.WindowY1 = 479 - YtopGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3785 if(hgfx.WindowY1 < Font->height)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3786 hgfx.WindowY0 = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3787 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3788 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3789 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3790 else
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3791 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3792 hgfx.WindowX0 = 800 - XrightGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3793 hgfx.WindowX1 = 800 - XleftGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3794 hgfx.WindowY0 = YtopGimpStyle;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3795 if(hgfx.WindowY0 + Font->height >= 479)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3796 hgfx.WindowY1 = 479;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3797 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3798 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3799 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3800 GFX_write_string_color(Font, &hgfx, text, 0, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3801 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3802
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3803
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3804 void gfx_write_topline_simple(GFX_DrawCfgScreen *tMscreen, const char *text, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3805 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3806 GFX_DrawCfgWindow hgfx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3807 const tFont *Font = &FontT48;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3808
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3809 hgfx.Image = tMscreen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3810 hgfx.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3811 hgfx.WindowLineSpacing = 0;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3812
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3813 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3814 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3815
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3816 hgfx.WindowTab = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3817 hgfx.WindowX0 = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3818 hgfx.WindowX1 = 779;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3819
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3820 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3821 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3822 hgfx.WindowY1 = 479;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3823 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3824 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3825 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3826 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3827 hgfx.WindowY0 = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3828 hgfx.WindowY1 = Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3829 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3830 GFX_write_label(Font, &hgfx, text, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3831 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3832
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3833
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3834 void gfx_write_page_number(GFX_DrawCfgScreen *tMscreen, uint8_t page, uint8_t total, uint8_t color)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3835 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3836 GFX_DrawCfgWindow hgfx;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3837 const tFont *Font = &FontT48;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3838 char text[7];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3839 uint8_t i, secondDigitPage, secondDigitTotal;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3840
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3841 SSettings* pSettings;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3842 pSettings = settingsGetPointer();
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3843
509
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3844 if(total > 8)
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3845 {
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3846 Font = &FontT24;
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3847 }
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3848
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3849 hgfx.Image = tMscreen;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3850 hgfx.WindowNumberOfTextLines = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3851 hgfx.WindowLineSpacing = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3852 hgfx.WindowTab = 0;
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3853
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3854 if(!pSettings->FlipDisplay)
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3855 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3856 hgfx.WindowX1 = 779;
509
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3857 if(Font == &FontT24)
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3858 {
999
ac25c35a3c97 New Tab for dynamic configuration:
Ideenmodellierer
parents: 885
diff changeset
3859 hgfx.WindowX0 = hgfx.WindowX1 - (Font->spacesize*7);
509
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3860 }
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3861 else
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3862 {
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3863 hgfx.WindowX0 = hgfx.WindowX1 - (Font->spacesize2Monospaced*3);
56824129dd56 Show page number in small letters if more than 8 tabs are active
Ideenmodellierer
parents: 494
diff changeset
3864 }
110
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3865 hgfx.WindowY1 = 479;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3866 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3867 }
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3868 else
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3869 {
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3870 hgfx.WindowX1 = 25*5;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3871 hgfx.WindowX0 = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3872 hgfx.WindowY1 = Font->height;;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3873 hgfx.WindowY0 = 0;
cc8e24374b83 Added option to handled mirrored display to existing functions
Ideenmodellierer
parents: 58
diff changeset
3874 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3875 if(page > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3876 page = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3877 if(total > 99)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3878 total = 99;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3879
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3880 i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3881 text[i++] = '\002';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3882
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3883 secondDigitPage = page / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3884 page -= secondDigitPage * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3885
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3886 secondDigitTotal = total / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3887 total -= secondDigitTotal * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3888
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3889 if(secondDigitPage)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3890 text[i++] = '0' + secondDigitPage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3891 text[i++] = '0' + page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3892
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3893 text[i++] = '/';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3894
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3895 if(secondDigitTotal)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3896 text[i++] = '0' + secondDigitTotal;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3897 text[i++] = '0' + total;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3898
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3899 text[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3900
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3901 GFX_clear_window_immediately(&hgfx);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3902 GFX_write_label(Font, &hgfx, text, color);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3903 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3904
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3905
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3906 uint8_t gfx_number_to_string(uint8_t max_digits, _Bool fill, char *pText, uint32_t input)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3907 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3908 uint8_t digits[10];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3909 uint32_t number, divider;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3910 int first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3911 uint8_t out;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3912
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3913 number = input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3914 first = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3915 divider = 1000000000;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3916 for(int i=9;i>=0;i--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3917 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3918 digits[i] = (uint8_t)(number / divider);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3919 number -= digits[i] * divider;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3920 divider /= 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3921 if((first == 0) && (digits[i] != 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3922 first = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3923 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3924
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3925 if((first + 1) > max_digits)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3926 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3927 for(int i = 0; i<max_digits; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3928 pText[i] = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3929 out = max_digits;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3930 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3931 else if(fill)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3932 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3933 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3934 for(int k = max_digits; k>0; k--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3935 pText[i++] = digits[k -1] + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3936 out = max_digits;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3937 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3938 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3939 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3940 int i = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3941 for(int k = first; k>=0; k--)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3942 pText[i++] = digits[k] + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3943 out = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3944 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3945
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3946 return out;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3947 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3948
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3949
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3950 /* output is
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3951 * 0->
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3952 * |
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3953 * v
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3954 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3955 * input is
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3956 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3957 * ->
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3958 * A
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3959 * |
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3960 * 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3961 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3962 void GFX_screenshot(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3963 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3964 uint32_t pSource = GFX_get_pActualFrameTop();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3965 uint32_t pSourceBottom =GFX_get_pActualFrameBottom();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3966 uint32_t pBottomNew = getFrame(99);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3967 uint32_t pDestination = GFX_doubleBufferOne();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3968 uint32_t sourceNow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3969
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3970
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3971 uint32_t bot_leftStart = FrameHandler.actualBottom.leftStart; // x0 z.B. 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3972 uint32_t bot_bottomStart = FrameHandler.actualBottom.bottomStart; // y0 z.B. 25
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3973 uint32_t bot_width = FrameHandler.actualBottom.width; // 800
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3974 uint32_t bot_height = FrameHandler.actualBottom.height; // 390
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3975
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3976 struct split
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3977 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3978 uint8_t blue;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3979 uint8_t green;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3980 uint8_t red;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3981 uint8_t alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3982 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3983
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3984 union inout_u
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3985 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3986 uint32_t in;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3987 struct split out;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3988 };
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3989
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3990 union inout_u value;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3991
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3992 /* test
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3993 uint32_t pSourceTemp = pSource + (2*479);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3994 for (int j = 0xFFFF; j > 0x00FF; j -= 0x0100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3995 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3996 *(__IO uint16_t*)pSourceTemp = j;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3997 pSourceTemp += 480*2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3998 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3999 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4000 // Top Layer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4001 const unsigned width = 800, height = 480;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4002 const uint32_t heightX2 = height*2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4003
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4004 for(unsigned y = 0; y < height; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4005 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4006 sourceNow = pSource + 2 * ((height - 1) - y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4007 for(unsigned x = 0; x < width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4008 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4009 // sourceNow += 2 * height * x + 2 * (height - 1 - y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4010 value.in = ColorLUT[*(__IO uint8_t*)(sourceNow)];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4011 value.out.alpha = *(__IO uint8_t*)(sourceNow + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4012
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4013 *(__IO uint8_t*)(pDestination++) = value.out.red;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4014 *(__IO uint8_t*)(pDestination++) = value.out.green;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4015 *(__IO uint8_t*)(pDestination++) = value.out.blue;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4016 *(__IO uint8_t*)(pDestination++) = value.out.alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4017 sourceNow += heightX2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4018 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4019 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4020
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4021 // Bottom Layer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4022 // build newBottom
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4023 pSource = pSourceBottom;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4024 for(unsigned x = bot_leftStart; x < bot_leftStart+bot_width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4025 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4026 for(unsigned y = bot_bottomStart; y < bot_bottomStart+bot_height; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4027 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4028 pDestination = pBottomNew + (2 * y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4029 pDestination += heightX2 * x;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4030 *(__IO uint16_t*)(pDestination) = *(__IO uint16_t*)(pSource);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4031 pSource += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4032 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4033 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4034
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4035 // output Bottom Layer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4036 pSource = pBottomNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4037 pDestination = GFX_doubleBufferTwo();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4038
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4039 for(unsigned y = 0; y < height; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4040 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4041 sourceNow = pSource + 2 * ((height - 1) - y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4042 for(unsigned x = 0; x < width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4043 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4044 // sourceNow = pSource + 2 * height * x + 2 * (height - 1 - y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4045 value.in = ColorLUT[*(__IO uint8_t*)(sourceNow)];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4046 value.out.alpha = *(__IO uint8_t*)(sourceNow + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4047
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4048 *(__IO uint8_t*)(pDestination++) = value.out.red;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4049 *(__IO uint8_t*)(pDestination++) = value.out.green;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4050 *(__IO uint8_t*)(pDestination++) = value.out.blue;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4051 *(__IO uint8_t*)(pDestination++) = value.out.alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4052 sourceNow += heightX2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4053 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4054 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4055 releaseFrame(99,pBottomNew);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4056 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4057 // das kommt dazu!
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4058 unsigned yEnd = 480 - FrameHandler.actualBottom.bottomStart;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4059 unsigned yStart = yEnd - FrameHandler.actualBottom.height;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4060
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4061 if(yStart > 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4062 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4063 for(unsigned y = 0; y < yStart; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4064 for(unsigned x = 0; x < width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4065 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4066 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4067 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4068 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4069 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4070 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4071 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4072 for(unsigned y = yStart; y < yEnd; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4073 for(unsigned x = 0; x < width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4074 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4075 sourceNow = pSource + 2 * height * x + 2 * (height - 1 - y);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4076 value.in = ColorLUT[*(__IO uint8_t*)(sourceNow)];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4077 value.out.alpha = *(__IO uint8_t*)(sourceNow + 1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4078
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4079 *(__IO uint8_t*)(pDestination++) = value.out.red;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4080 *(__IO uint8_t*)(pDestination++) = value.out.green;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4081 *(__IO uint8_t*)(pDestination++) = value.out.blue;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4082 *(__IO uint8_t*)(pDestination++) = value.out.alpha;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4083 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4084 if(yEnd < 480)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4085 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4086 for(unsigned y = yEnd; y < 480; y++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4087 for(unsigned x = 0; x < width; x++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4088 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4089 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4090 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4091 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4092 *(__IO uint8_t*)(pDestination++) = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4093 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4094 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4095 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4096 }
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4097
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4098 #ifndef BOOTLOADER_STANDALONE
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4099 tFont* GFX_Check_Extra_Font(uint8_t character, tFont *Font)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4100 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4101 uint32_t i;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4102 uint32_t found;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4103
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4104 found = 0;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4105 for(i=0;i<Font->length;i++)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4106 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4107 if(Font->chars[i].code == character)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4108 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4109 found = 1;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4110 break;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4111 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4112 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4113 if (!found && Font == &FontT54)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4114 {
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4115 Font = (tFont *)&FontT54Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4116 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4117 else if (!found && (Font == &FontT84 || Font == &FontT84Spaced))
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4118 {
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4119 Font = (tFont *)&FontT84Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4120 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4121 else if (!found && Font == &FontT105)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4122 {
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4123 Font = (tFont *)&FontT105Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4124 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4125
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4126 return Font;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4127 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4128 #endif
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4129 uint32_t GFX_Character_Width(uint8_t character, tFont *Font)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4130 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4131 uint32_t i;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4132 #ifndef BOOTLOADER_STANDALONE
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4133 uint32_t found;
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4134 #endif
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4135
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4136 for(i=0;i<Font->length;i++)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4137 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4138 if(Font->chars[i].code == character)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4139 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4140 return Font->chars[i].image->width;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4141 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4142 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4143
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4144 #ifndef BOOTLOADER_STANDALONE
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4145 found = 0;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4146 if (Font == &FontT54)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4147 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4148 found = 1;
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4149 Font = (tFont *)&FontT54Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4150 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4151 else if (Font == &FontT84 || Font == &FontT84Spaced)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4152 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4153 found = 1;
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4154 Font = (tFont *)&FontT84Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4155 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4156 else if (Font == &FontT105)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4157 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4158 found = 1;
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 698
diff changeset
4159 Font = (tFont *)&FontT105Extra;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4160 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4161
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4162 if (found)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4163 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4164 for(i=0;i<Font->length;i++)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4165 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4166 if(Font->chars[i].code == character)
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4167 {
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4168 return Font->chars[i].image->width;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4169 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4170 }
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4171 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4172 #endif
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4173 return 0;
1c95f811967c -Add 12HR Time Support
izzni
parents: 565
diff changeset
4174 }
870
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4175
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4176 void Gfx_colorsscheme_mod(char *text, uint8_t alternativeColor)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4177 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4178 char *p = text;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4179 uint8_t index = 0;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4180
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4181 while ((*p) && (index < MAX_COLOR_STRING_LENGTH))
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4182 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4183 if (*p == '\020')
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4184 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4185 if(!GFX_is_colorschemeDiveStandard())
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4186 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4187 *p = '\027';
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4188 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4189 else if(alternativeColor != 0)
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4190 {
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4191 *p += alternativeColor;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4192 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4193 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4194 p++;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4195 index++;
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4196 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4197 }
bc6c90e20d9e Instrument code for Bootloader:
Ideenmodellierer
parents: 772
diff changeset
4198