📄 blind.h~
字号:
/*****************the touchscreen blind character input program*************/ /*******************Author : DONG Shengdong*****************/ /*you can set the property value by clicking the area,and you can use the default the property value,then start to input points.*/ #ifndef _BLIND_H #define _BLIND_H #include <stdio.h> #include <stdlib.h> #include <unistd.h>
#include <fcntl.h> #include "process.h" #include "time.h" #include "math.h" #include "pthread.h" #include "loadbmp.h" /*----------------------the head file----------------------*/ //内部有一个全局变量 character,调用函数返回一个汉字或词组charater int CharacterInput(); //启动盲文输入法 //内部有一个全局变量 character,调用函数返回一个汉字或词组charater int ProSetting(int *x_dis,int *y_dis); //设置特征值,x_dis:横间距,y_dis:列间距; //以地址传递方式 int CharacterInpuAgain(int x_distance,int y_distance); //根据特征值,来启动盲文输入法 //x_distance : x_dis //y_distance : y_dis /*--------------Wait until the blind points finish----------------*/ int ProSetting(int *x_dis,int *y_dis) { pthread_t th_b,th_c,th_d,th_e,th_f; //create four pthreads void *retval; init(); varinit(); initpro(); initpoint(); pthread_create(&th_e,NULL,overtime,0); //超时检测 pthread_create(&th_b,NULL,time_count,0); //记时 pthread_create(&th_d,NULL,property_set,(void *)&th_b); //特征值设置 pthread_create(&th_f,NULL,check_pro,(void *)&th_e); //检查是否输入完毕 pthread_join(th_b,&retval); pthread_join(th_d,&retval); pthread_join(th_e,&retval); pthread_join(th_f,&retval); *x_dis=property.pointx;
*y_dis=property.pointy; return 0; } int CharacterInput() { pthread_t th_a,th_b,th_c; void *retval; init(); varinit(); initpro(); initpoint(); initmatrix(); pthread_create(&th_a,NULL,point_receive,0); //接收盲点 pthread_create(&th_b,NULL,time_count,(void *)&th_a); //记时 pthread_create(&th_c,NULL,process,(void *)&th_b); //盲点处理 pthread_join(th_a,&retval); pthread_join(th_b,&retval); pthread_join(th_c,&retval); return 0; } int CharacterInpuAgain(int x_distance,int y_distance) { pthread_t th_a,th_b,th_c; void *retval; init(); varinit(); initpro(); initpoint(); initmatrix(); property.pointx=x_distance; property.pointy=y_distance; pthread_create(&th_a,NULL,point_receive,0); pthread_create(&th_b,NULL,time_count,(void *)&th_a); pthread_create(&th_c,NULL,process,(void *)&th_b); pthread_join(th_a,&retval); pthread_join(th_b,&retval); pthread_join(th_c,&retval); return 0; } #endif /****************coding over****************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -