annotate Discovery/Src/gfx_engine.c @ 117:e6b190f5fbc7 FlipDisplay

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