优化窗口移动的逻辑,显示还是有问题,需要继续优化

This commit is contained in:
2021-08-16 23:36:56 +08:00
parent 398d16f69f
commit 2eb96d763e
16 changed files with 13476 additions and 13390 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
66BE74F758C12D739921AEA421D593D3=3 66BE74F758C12D739921AEA421D593D3=3
8DF89ED150041C4CBC7CB9A9CAA90856=E458F13A42239457B89B956144879229 8DF89ED150041C4CBC7CB9A9CAA90856=49D03C461CB58C358FC38377BBF9225B
DC22A860405A8BF2F2C095E5B6529F12=E458F13A42239457B89B956144879229 DC22A860405A8BF2F2C095E5B6529F12=49D03C461CB58C358FC38377BBF9225B
eclipse.preferences.version=1 eclipse.preferences.version=1
+9 -3
View File
@@ -204,11 +204,11 @@ static void MX_GPIO_Init(void)
/*Configure GPIO pin Output Level */ /*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, TCLK_Pin|TCS_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOB, TCLK_Pin|TCS_Pin, GPIO_PIN_SET);
/*Configure GPIO pins : TDOUT_Pin TPEN_Pin */ /*Configure GPIO pin : TDOUT_Pin */
GPIO_InitStruct.Pin = TDOUT_Pin|TPEN_Pin; GPIO_InitStruct.Pin = TDOUT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); HAL_GPIO_Init(TDOUT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : TDIN_Pin */ /*Configure GPIO pin : TDIN_Pin */
GPIO_InitStruct.Pin = TDIN_Pin; GPIO_InitStruct.Pin = TDIN_Pin;
@@ -217,6 +217,12 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(TDIN_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(TDIN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : TPEN_Pin */
GPIO_InitStruct.Pin = TPEN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(TPEN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : LCD_BL_Pin */ /*Configure GPIO pin : LCD_BL_Pin */
GPIO_InitStruct.Pin = LCD_BL_Pin; GPIO_InitStruct.Pin = LCD_BL_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+2 -2
View File
@@ -2,5 +2,5 @@ main.c:69:5:main 8 static
main.c:114:6:SystemClock_Config 72 static main.c:114:6:SystemClock_Config 72 static
main.c:153:13:MX_I2C2_Init 8 static main.c:153:13:MX_I2C2_Init 8 static
main.c:187:13:MX_GPIO_Init 48 static main.c:187:13:MX_GPIO_Init 48 static
main.c:237:13:MX_FSMC_Init 40 static main.c:243:13:MX_FSMC_Init 40 static
main.c:301:6:Error_Handler 4 static,ignoring_inline_asm main.c:307:6:Error_Handler 4 static,ignoring_inline_asm
+3 -3
View File
@@ -4,6 +4,6 @@ touch.c:70:10:TP_Read_XOY 48 static
touch.c:97:6:TP_Read_XY_ADC 24 static touch.c:97:6:TP_Read_XY_ADC 24 static
touch.c:111:9:TP_Read_XY2 24 static touch.c:111:9:TP_Read_XY2 24 static
touch.c:131:6:TP_Server 16 static touch.c:131:6:TP_Server 16 static
touch.c:142:6:TP_XY 24 static touch.c:154:6:TP_XY 24 static
touch.c:155:6:TP_DrwaTrage 40 static touch.c:167:6:TP_DrwaTrage 40 static
touch.c:165:6:TP_adjustment 160 static touch.c:177:6:TP_adjustment 160 static
+1 -1
View File
@@ -1 +1 @@
Main_APP.c:17:6:main_app 32 static Main_APP.c:17:6:main_app 96 static
+11 -11
View File
@@ -1,11 +1,11 @@
windows.c:12:6:Inteface_SetCursor 16 static windows.c:13:6:Inteface_SetCursor 16 static
windows.c:18:6:Inteface_SetColor 16 static windows.c:19:6:Inteface_SetColor 16 static
windows.c:24:5:UI_Init 24 static windows.c:25:5:UI_Init 24 static
windows.c:64:9:New_Window 40 static windows.c:67:9:New_Window 40 static
windows.c:111:6:Close_Windows_Stack 16 static windows.c:114:6:Close_Windows_Stack 16 static
windows.c:151:6:Set_Windows_Title 24 static windows.c:154:6:Set_Windows_Title 24 static
windows.c:159:6:Set_Windows_XY_BY_ACC 24 static windows.c:162:6:Set_Windows_XY_BY_ACC 24 static
windows.c:166:6:Refresh_Window 32 static windows.c:169:6:Refresh_Window 32 static
windows.c:209:6:Refresh_UI 32 static windows.c:212:6:Refresh_UI 32 static
windows.c:285:9:Chack 32 static windows.c:288:9:Chack 32 static
windows.c:305:6:UI_Server 40 static windows.c:308:6:UI_Server 40 static
BIN
View File
Binary file not shown.
+12722 -12693
View File
File diff suppressed because it is too large Load Diff
+560 -561
View File
File diff suppressed because it is too large Load Diff
+13 -1
View File
@@ -132,10 +132,22 @@ void TP_Server()
{ {
if(TPEN==0) //如果有触摸 if(TPEN==0) //如果有触摸
{ {
TP_Read_XY2(&t0.adc_x,&t0.adc_y); //先读取ad值 if(TP_Read_XY2(&t0.adc_x,&t0.adc_y))
{//先读取ad值
t0.pix_x=(t0.adc_x/tconfig.x_acc)-tconfig.x_offset;//转换为像素坐标 t0.pix_x=(t0.adc_x/tconfig.x_acc)-tconfig.x_offset;//转换为像素坐标
t0.pix_y=(t0.adc_y/tconfig.y_acc)-tconfig.y_offset; t0.pix_y=(t0.adc_y/tconfig.y_acc)-tconfig.y_offset;
t0.d=1;
}else
{
t0.d=0;
}
t0.c=1;
}else
{
t0.c=0;
t0.pix_x=-1;
t0.pix_y=-1;
} }
} }
//直接读取 //直接读取
+3 -1
View File
@@ -32,7 +32,9 @@ typedef struct
uint16_t adc_y; uint16_t adc_y;
int pix_x; int pix_x;
int pix_y; int pix_y;
char move_flag; char move_flag:1;
char c:1; //有按键按下
char d:1; //成功读取adc值
}touch_device; }touch_device;
+2 -2
View File
@@ -39,8 +39,8 @@ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */ /* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x200 ; /* required amount of heap */ _Min_Heap_Size = 0x400 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */ _Min_Stack_Size = 0x800 ; /* required amount of stack */
/* Memories definition */ /* Memories definition */
MEMORY MEMORY
+3
View File
@@ -16,6 +16,7 @@ task run_loop;//
void main_app() void main_app()
{ {
char str[64];
LCDx_Init(); LCDx_Init();
EPPROM_SLOWWRITE_INIT(); EPPROM_SLOWWRITE_INIT();
@@ -34,6 +35,8 @@ void main_app()
while(1) while(1)
{ {
LCD_set_dot(t0.pix_x, t0.pix_y, RED); LCD_set_dot(t0.pix_x, t0.pix_y, RED);
sprintf(str,"%04d\n%04d\n%04d",t0.pix_x,t0.pix_y,t0.c);
LCD_ShowString(0, 0, &str, 16, RED, BLUE);
/* /*
switch(run_loop.sw) switch(run_loop.sw)
{ {
+42 -12
View File
@@ -7,6 +7,7 @@
#include "windows.h" #include "windows.h"
#include "touch.h" #include "touch.h"
extern touch_device t0;
//接口 //接口
//设置屏幕像素坐标 //设置屏幕像素坐标
void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos) void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos)
@@ -35,6 +36,8 @@ UI *UI_Init(COLOR_16 background)
ui->windows=NULL; ui->windows=NULL;
ui->last_windows=NULL; ui->last_windows=NULL;
ui->refresh_ui_flag=1; ui->refresh_ui_flag=1;
ui->moveed_windwos=NULL;
ui->First_click_flag==0;
/* /*
ui->touch=(touch_device*)malloc(sizeof(touch_device)); ui->touch=(touch_device*)malloc(sizeof(touch_device));
if(ui->touch!=NULL) if(ui->touch!=NULL)
@@ -314,9 +317,19 @@ void UI_Server(UI *ui)
int t_x,t_y; int t_x,t_y;
//touch //touch
//temp_touch=ui->touch; //temp_touch=ui->touch;
if(TP_XY(&t_x, &t_y))//Touch_Server(temp_touch)) if(t0.c)//TP_XY(&t_x, &t_y))
{ {
if(t0.d)
{
t_x=t0.pix_x;
t_y=t0.pix_y;
temp_window=NULL; temp_window=NULL;
if(ui->moveed_windwos==NULL)
{
if(ui->First_click_flag==0)
{
ui->First_click_flag=1;
temp_windows_stack=ui->last_windows; //获取ui中最前端的窗口 从前往后扫描 temp_windows_stack=ui->last_windows; //获取ui中最前端的窗口 从前往后扫描
do do
{ {
@@ -354,16 +367,10 @@ void UI_Server(UI *ui)
ui->refresh_ui_flag=1; //发生了变化 刷新ui的显示 ui->refresh_ui_flag=1; //发生了变化 刷新ui的显示
break; break;
case BAR: case BAR:
ui->moveed_windwos=temp_window;
ui->move_x=t_x-temp_window->x;
ui->move_y=t_y-temp_window->y;
if(ui->window_move_lock==0)
{
ui->window_move_x=t_x;
ui->window_move_y=t_y;
}
Set_Windows_XY_BY_ACC(temp_windows_stack->window,t_x-ui->window_move_x,t_y-ui->window_move_y);
ui->window_move_x=t_x;
ui->window_move_y=t_y;
ui->refresh_ui_flag=1; //发生了变化 刷新ui的显示
break; break;
case BODY: case BODY:
//ui->background=temp_windows_stack->window->background; //ui->background=temp_windows_stack->window->background;
@@ -380,10 +387,33 @@ void UI_Server(UI *ui)
flag=0; //一个窗口都没有 直接结束循环 flag=0; //一个窗口都没有 直接结束循环
} }
}while(flag); }while(flag);
ui->window_move_lock=1; }
}else }else
{ {
ui->window_move_lock=0; temp_window=ui->moveed_windwos;
temp_window->x=t_x-ui->move_x;
temp_window->y=t_y-ui->move_y;
ui->refresh_ui_flag=1;
//发生了变化 刷新ui的显示
}
}
}else
{
if(ui->First_click_flag==1)
{
ui->First_click_flag=0;
}
if(ui->moveed_windwos!=NULL)
{
ui->moveed_windwos=NULL;
}
} }
//display //display
if(ui->refresh_ui_flag==1) if(ui->refresh_ui_flag==1)
+8 -4
View File
@@ -18,6 +18,8 @@ typedef struct
uint16_t high; uint16_t high;
COLOR_16 background; COLOR_16 background;
char title[16]; char title[16];
}window; }window;
@@ -38,11 +40,13 @@ typedef struct
uint16_t high; uint16_t high;
windows_stack *windows; windows_stack *windows;
windows_stack *last_windows; windows_stack *last_windows;
//touch_device *touch; //Ò»¸öUI¹ÒÔØÒ»¸ö´¥¿ØÉ豸 window *moveed_windwos;//¼Ç¼ÕýÔÚ±»Òƶ¯µÄ´°¿Ú
int window_move_x; int move_x;
int window_move_y; int move_y;
uint8_t move_lock:1;
uint8_t First_click_flag:1;
uint8_t refresh_ui_flag:1; uint8_t refresh_ui_flag:1;
uint8_t window_move_lock:1;
}UI; }UI;
void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos); void Inteface_SetCursor(uint16_t Xpos, uint16_t Ypos);
+5 -4
View File
@@ -105,8 +105,9 @@ PE15.Signal=FSMC_D12_DA12
PE7.Signal=FSMC_D4_DA4 PE7.Signal=FSMC_D4_DA4
PE8.Signal=FSMC_D5_DA5 PE8.Signal=FSMC_D5_DA5
PE9.Signal=FSMC_D6_DA6 PE9.Signal=FSMC_D6_DA6
PF10.GPIOParameters=GPIO_Label PF10.GPIOParameters=GPIO_PuPd,GPIO_Label
PF10.GPIO_Label=TPEN PF10.GPIO_Label=TPEN
PF10.GPIO_PuPd=GPIO_PULLUP
PF10.Locked=true PF10.Locked=true
PF10.Signal=GPIO_Input PF10.Signal=GPIO_Input
PF8.GPIOParameters=GPIO_Label PF8.GPIOParameters=GPIO_Label
@@ -135,7 +136,7 @@ ProjectManager.DeviceId=STM32F103ZETx
ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.4 ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.4
ProjectManager.FreePins=false ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200 ProjectManager.HeapSize=0x400
ProjectManager.KeepUserCode=true ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=1 ProjectManager.LibraryCopy=1
@@ -146,11 +147,11 @@ ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=m3s.ioc ProjectManager.ProjectFileName=m3s.ioc
ProjectManager.ProjectName=m3s ProjectManager.ProjectName=m3s
ProjectManager.RegisterCallBack= ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400 ProjectManager.StackSize=0x800
ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_FSMC_Init-FSMC-false-HAL-true ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_FSMC_Init-FSMC-false-HAL-true,4-MX_I2C2_Init-I2C2-false-HAL-true
RCC.ADCFreqValue=36000000 RCC.ADCFreqValue=36000000
RCC.AHBFreq_Value=72000000 RCC.AHBFreq_Value=72000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2 RCC.APB1CLKDivider=RCC_HCLK_DIV2