Skip to content

Commit ca409aa

Browse files
author
Wegmann Peter
committed
implementing dips
1 parent 2a0ebc3 commit ca409aa

File tree

10 files changed

+546
-820
lines changed

10 files changed

+546
-820
lines changed

DispAdapter.c

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,35 @@
1717
#include "LCD.h"
1818
#include "display.h"
1919
#include "display_driver.h"
20+
#include "StringPixelCoordTable_ili9341.h"
2021

2122

2223

24+
MainscreenType MainScreen = {
25+
.Value.x = X_LEFT_EDGE,
26+
.Value.y = Y_VALUES_START,
27+
.Volume.x = X_LEFT_EDGE,
28+
.Volume.y = Y_VALUES_START + FONT2_H * 1,
29+
.Corr.x = X_LEFT_EDGE,
30+
.Corr.y = Y_VALUES_START + FONT2_H * 2,
31+
.Temp.x = X_LEFT_EDGE,
32+
.Temp.y = Y_VALUES_START + FONT2_H * 3,
33+
.Press.x = X_LEFT_EDGE,
34+
.Press.y = Y_VALUES_START + FONT2_H * 4,
35+
};
36+
37+
2338
void lcd_init(void){
2439
#ifdef ili9341
2540
LCD_Init();
26-
41+
2742
glcd_led_on();
2843
Orientation = Portrait;
2944
#endif
45+
46+
#ifdef old_LCD
47+
init_LCD();
48+
#endif
3049
}
3150

3251

@@ -94,4 +113,89 @@ void lcd_Draw_Cross(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1){
94113
#ifdef ili9341
95114
LCD_Draw_Cross(x0,y0,x1,y1);
96115
#endif
97-
}
116+
}
117+
118+
void Print_add_Line(char* Text,uint8_t first_line ){
119+
#ifdef ili9341
120+
InitScreen_AddLine_ili(Text,first_line);
121+
#endif
122+
#ifdef old_LCD
123+
LCD_InitScreen_AddLine(Text,first_line);
124+
#endif
125+
}
126+
127+
void setInitScreen(uint16_t fore, uint16_t back, uint8_t nextLine, uint8_t FontNr, uint8_t XScale, uint8_t YScale){
128+
#ifdef ili9341
129+
setInitScreen_ili(fore,back,nextLine,FontNr,XScale,YScale);
130+
#endif // ili9341
131+
}
132+
133+
void paint_info_line(char * line, _Bool update){
134+
#ifdef ili9341
135+
paint_info_line_ili(line,update);
136+
#endif
137+
138+
#ifdef old_LCD
139+
LCD_paint_info_line(*line,update);
140+
#endif
141+
}
142+
143+
144+
void paint_value(char* text,uint8_t update,char* unit){
145+
if (update)
146+
{
147+
lcd_Print(" ",MainScreen.Value.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Value.y,2,1,1,FGC,BGC);
148+
}
149+
lcd_Print(text,MainScreen.Value.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Value.y,2,1,1,FGC,BGC);
150+
151+
lcd_Print(unit,HALF_SPACE_WIDTH_FONT_2 + MainScreen.Value.x + (DESCRUPTOR_LEN+strlen(text)) * FONT2_W, MainScreen.Value.y,2,1,1,FGC,BGC);
152+
}
153+
void paint_volume(char* text,uint8_t update,char* unit){
154+
if (update)
155+
{
156+
lcd_Print(" ",MainScreen.Volume.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Volume.y,2,1,1,FGC,BGC);
157+
}
158+
lcd_Print(text,MainScreen.Volume.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Volume.y,2,1,1,FGC,BGC);
159+
160+
lcd_Print(unit,HALF_SPACE_WIDTH_FONT_2 + MainScreen.Volume.x + (DESCRUPTOR_LEN+strlen(text)) * FONT2_W, MainScreen.Volume.y,2,1,1,FGC,BGC);
161+
162+
}
163+
164+
void paint_corr(char* text,uint8_t update,char* unit){
165+
if (update)
166+
{
167+
lcd_Print(" ",MainScreen.Corr.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Corr.y,2,1,1,FGC,BGC);
168+
}
169+
lcd_Print(text,MainScreen.Corr.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Corr.y,2,1,1,FGC,BGC);
170+
171+
lcd_Print(unit,HALF_SPACE_WIDTH_FONT_2 + MainScreen.Corr.x + (DESCRUPTOR_LEN+strlen(text)) * FONT2_W, MainScreen.Corr.y,2,1,1,FGC,BGC);
172+
}
173+
void paint_temp(char* text,uint8_t update,char* unit){
174+
if (update)
175+
{
176+
lcd_Print(" ",MainScreen.Temp.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Temp.y,2,1,1,FGC,BGC);
177+
}
178+
lcd_Print(text,MainScreen.Temp.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Temp.y,2,1,1,FGC,BGC);
179+
180+
lcd_Print(unit,HALF_SPACE_WIDTH_FONT_2 + MainScreen.Temp.x + (DESCRUPTOR_LEN+strlen(text)) * FONT2_W, MainScreen.Temp.y,2,1,1,FGC,BGC);
181+
}
182+
183+
void paint_press(char* text,uint8_t update,char* unit){
184+
if (update)
185+
{
186+
lcd_Print(" ",MainScreen.Press.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Press.y,2,1,1,FGC,BGC);
187+
}
188+
lcd_Print(text,MainScreen.Press.x + DESCRUPTOR_LEN * FONT2_W,MainScreen.Press.y,2,1,1,FGC,BGC);
189+
190+
lcd_Print(unit,HALF_SPACE_WIDTH_FONT_2 + MainScreen.Press.x + (DESCRUPTOR_LEN+strlen(text)) * FONT2_W, MainScreen.Press.y,2,1,1,FGC,BGC);
191+
}
192+
193+
void paint_Main(void){
194+
lcd_Print("Val:",MainScreen.Value.x ,MainScreen.Value.y,2,1,1,FGC,BGC);
195+
lcd_Print("Vol:",MainScreen.Volume.x ,MainScreen.Volume.y,2,1,1,FGC,BGC);
196+
lcd_Print("Cor:",MainScreen.Corr.x ,MainScreen.Corr.y,2,1,1,FGC,BGC);
197+
lcd_Print("Tmp:",MainScreen.Temp.x ,MainScreen.Temp.y,2,1,1,FGC,BGC);
198+
lcd_Print("Prs:",MainScreen.Press.x ,MainScreen.Press.y,2,1,1,FGC,BGC);
199+
}
200+
201+

DispAdapter.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,40 @@
2626
#define grey 0b0011100011100111
2727
#define black 0b0000000000000000
2828

29+
///Layout Colors
30+
#define FGC 0b0101101011011111 ///< Foreground color
31+
#define BGC black ///< Background color
32+
#define ERR white ///< Warning/Active color
33+
#define D_BGC blue ///< Dialog Background color
34+
#define D_FGC white ///< Dialog Foreground color
35+
2936
#define HZB_Blue 0b0000001011010011
3037
#define HZB_Cyan 0b0000010011111100
3138

3239

40+
typedef struct {
41+
uint16_t ForeColor;
42+
uint16_t BackColor;
43+
uint8_t MaxNoOfLines;
44+
uint8_t NextLine;
45+
uint8_t LineFeed;
46+
uint8_t FontNr;
47+
uint8_t XScale;
48+
uint8_t YScale;
49+
}InitScreenType;
50+
51+
typedef struct{
52+
uint16_t x;
53+
uint16_t y;
54+
}PointType;
3355

56+
typedef struct {
57+
PointType Value;
58+
PointType Volume;
59+
PointType Corr;
60+
PointType Temp;
61+
PointType Press;
62+
}MainscreenType;
3463

3564
void lcd_init(void);
3665
void lcd_Print(const char* Text, uint16_t X, uint16_t Y, unsigned char FontNr, unsigned char XScale, unsigned char YScale, unsigned int ForeColor, unsigned int BackColor);
@@ -43,5 +72,13 @@ void lcd_Draw(uint16_t x1, uint16_t y1,uint16_t x2, uint16_t y2, unsigned char l
4372
void lcd_hline(unsigned int x0, unsigned int y0, unsigned int length, unsigned int color);
4473
void lcd_vline(unsigned int x0, unsigned int y0, unsigned int length, unsigned int color);
4574
void lcd_Draw_Cross(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1);
75+
void Print_add_Line(char* Text,uint8_t first_line );
76+
void setInitScreen(uint16_t fore, uint16_t back, uint8_t nextLine, uint8_t FontNr, uint8_t XScale, uint8_t YScale);
77+
void paint_info_line(char * line, _Bool update);
78+
void paint_press(char* text,uint8_t update,char* unit);
79+
void paint_temp(char* text,uint8_t update,char* unit);
80+
void paint_value(char* text,uint8_t update,char* unit);
81+
void paint_volume(char* text,uint8_t update,char* unit);
82+
void paint_corr(char* text,uint8_t update,char* unit);
4683

4784
#endif /* DISPADAPTER_H_ */

0 commit comments

Comments
 (0)