欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
MINIGUI V1.6.0及V1.3.3觸摸屏較正簡(jiǎn)單方案

Crosstool: arm-linux-gcc-3.4.1硬件環(huán)境:

Host:X86PC

Target:友善之臂mini2440開(kāi)發(fā)板

軟件環(huán)境:

Host:fedora 10.0

Target:arm-linux kernel:linux-2.6.17

本實(shí)驗方案采納Singlewolfyu (大漠孤狼)在 MiniGUI 1.3.3 移植詳解中帶屏幕校正功能的 2410 的 IAL , 作者通過(guò)改寫(xiě)MiniGUI 1.3.3 版本中的 2410 的 IAL 程序,采用SMDK2410作為IAL引擎,實(shí)現了觸摸屏原理,我將該方案弄到V1.6.0版本也成功地實(shí)現觸摸屏的較正。改寫(xiě)的程序我命名為2410_touchmodify.c

該程序的說(shuō)明:

在2410_touchmodify.c中定義了兩個(gè)數組,如下

typedef struct mPoint {      int      x,y ;} mPOINT ;static mPOINT ts_position[4]={ {940,926},{940,102},{96,104},{120,940} };static mPOINT display_position[4]={ {0,0},{0,319},{239,319},{239,0} }; 

ts_position 意思為 TouchScreen? 的 位置 display_position 意思為屏幕上顯示的 位置

比如我前面說(shuō)的,我的屏幕是 240x320 的,我交叉編譯tslib并移植tslib到開(kāi)發(fā)板,然后我點(diǎn)四個(gè)角

{0,0},{0,319},{239,319},{239,0} ,從觸屏上讀出來(lái)的數據分別為

{26,283},{26,32},{216,31},{216,285} ,填入這兩個(gè)數就行

所以使用方法就是,你自己取四個(gè)頂角的點(diǎn),點(diǎn)這四個(gè)點(diǎn),得到相應的觸摸屏讀出來(lái)的值,把這些數據填到這兩個(gè)數組中,OK,你的 觸摸屏 就可以正常工作了 :)

得到四個(gè)頂點(diǎn)的原始坐標可以采用大漠孤狼的readpos.c 的程序,也可以采用我的方法交叉編譯、移植tslib,運行tslib的./ts_print_raw來(lái)得到,關(guān)于tslib的交叉編譯及使用,請參考我的另一篇文章,minigui V1.6.10 + tslib 觸摸屏較正完美解決方案,博客地址

http://blog.csdn.net/huangsihua/archive/2009/03/15/3992775.aspx

我這里就不寫(xiě)出來(lái)了。我采用的是tslib的ts_printraw,當然大漠孤狼的readpos.c的方法我實(shí)驗過(guò)也是可行的。

步驟一:readpos編譯執行

將readpos.c程序放入/libminigui1.6.0/rea/ial,然后在終端輸入:

cd …./libminigui1.6.0/res/ial 

進(jìn)入該目錄,對其進(jìn)行交叉編譯命令如下:

arm-linux-gcc –o readpos readpos.c

這樣得到readpos可執行文件,你入到板子上運行一下就可以讀取觸摸屏的坐標了,是不是比較簡(jiǎn)單。

后面附一個(gè) readpos.c 的程序,你可以執行它,然后點(diǎn)擊觸摸屏,它會(huì )顯示出觸摸屏讀出來(lái)的值。

步驟二:修改SMDK2410源程序2410.c

復制修改好后的2410.c程序到…./libminigui1.6.0/res/ial/替換原來(lái)的2410.c

程序在文章后面的附程序二:2410_touchmodify.c

步驟三:重新配置編譯libminigui1.6.0

重新配置編譯libminigui1.6.0

./configure  --prefix=/usr/local/arm/2.95.3/arm-linux  --build=i386-linux --host=arm-linux --target=arm-linux --enable-smdk2410ialmakemake install

應該沒(méi)什么問(wèn)題。

步驟四:重新編譯我的PDA應用程序

arm-linux-gcc -o pda pda.c -lminigui -lm -lz -lpng -ljpeg -lmgext -lpthread –lts

步驟五:改寫(xiě)配置文件Minigui.cfg及ts.conf并測試

Migigui.cfg修改部分:

[system]# GAL enginegal_engine=fbcon# IAL engineial_engine=SMDK2410mdev=/dev/input/ts0mtype=none[fbcon]defaultmode=240x320-16bpp

ts.conf修改部分:

#module mousebutsmodule variance xlimit=50 ylimit=50 pthreshold=3module dejitter xdelta=1 ydelta=1 pthreshold=3module linear

將應用程序放入開(kāi)發(fā)板運行,好了,較正的不錯哦,Perfect. 交流郵箱:huangsihua@hqu.edu.cn 說(shuō)明對于MINIGUI V1.3.3當然也是一樣的,我的文章就是參考大漠孤狼在MINIGUI V1.3.3上的實(shí)現。只是那個(gè)版本的配置可以使用圖形化的方式,make menuconfig

程序一:Readpos.c 程序,幫助你讀取觸摸屏的值

#include <stdio.h>typedef struct {unsigned short pressure;unsigned short x;unsigned short y;unsigned short pad;} TS_EVENT;static TS_EVENT ts_event;static int ts;int main(){ts = open ("/dev/ts", 0);if (ts < 0) {fprintf (stderr, "2410: Can not open touch screen!\n");return 0;}while(1){if(       read (ts, &ts_event, sizeof (TS_EVENT))){printf("X=%d,Y=%d,Pressure=%d \n",ts_event.x,ts_event.y,ts_event.pressure);}}}

程序二: 2410_touchmodify.c,修改后的SMDK2410的引擎2410.c

/*** $Id: HuangSHArticle2.txt,v 1.1 2009/03/17 14:32:09 SihuaHuang Exp $**** 2410.c: Low Level Input Engine for SMDK2410 Dev Board.**** Copyright (C) 2003 Feynman Software.*//*** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include "common.h"#ifdef _SMDK2410_IAL#include <sys/ioctl.h>#include <sys/poll.h>#include <sys/types.h>#include <sys/stat.h>#include <linux/kd.h>#include <sys/time.h>  /* i add it here */#include <math.h>#include <sys/poll.h>#include <sys/types.h>#include "ial.h"#include "2410.h"typedef struct mPoint {int      x,y ;} mPOINT ;static mPOINT ts_position[4]={ {26,283},{26,32},{216,31},{216,285}};static mPOINT display_position[4]={ {0,0},{0,319},{239,319},{239,0}};typedef struct Matrix {/* This arrangement of values facilitates*  calculations within getDisplayPoint()*/int      An,     /* A = An/Divider */Bn,     /* B = Bn/Divider */Cn,     /* C = Cn/Divider */Dn,     /* D = Dn/Divider */En,     /* E = En/Divider */Fn,     /* F = Fn/Divider */Divider ;} mMATRIX ;static mMATRIX m_matrix;int setCalibrationMatrix( mPOINT * display,mPOINT * screen,mMATRIX * matrix) ;int getDisplayPoint( mPOINT * display,mPOINT * screen,mMATRIX * matrix ) ;/* for data reading from /dev/ts */typedef struct {unsigned short pressure;unsigned short x;unsigned short y;unsigned short pad;} TS_EVENT;static unsigned char state [NR_KEYS];static int ts = -1;static int mousex = 0;static int mousey = 0;static TS_EVENT ts_event;#undef _DEBUG/************************  Low Level Input Operations **********************//** Mouse operations -- Event*/static int mouse_update(void){return 1;}static void mouse_getxy(int *x, int* y){#ifdef _DEBUGprintf ("mousex = %d, mousey = %d\n", mousex, mousey);#endifif (mousex < 0) mousex = 0;if (mousey < 0) mousey = 0;if (mousex > 239) mousex = 239;if (mousey > 319) mousey = 319;*x = mousex;*y = mousey;}static int mouse_getbutton(void){return ts_event.pressure;}#ifdef _LITE_VERSIONstatic int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except,struct timeval *timeout)#elsestatic int wait_event (int which, fd_set *in, fd_set *out, fd_set *except,struct timeval *timeout)#endif{fd_set rfds;int    retvalue = 0;int    e;static int last_pressure=0;if (!in) {in = &rfds;FD_ZERO (in);}if ((which & IAL_MOUSEEVENT) && ts >= 0) {FD_SET (ts, in);#ifdef _LITE_VERSIONif (ts > maxfd) maxfd = ts;#endif}#ifdef _LITE_VERSIONe = select (maxfd + 1, in, out, except, timeout) ;#elsee = select (FD_SETSIZE, in, out, except, timeout) ;#endifif (e > 0) {if (ts >= 0  && FD_ISSET (ts, in) ) {FD_CLR (ts, in);ts_event.x=0;ts_event.y=0;read (ts, &ts_event, sizeof (TS_EVENT));if(last_pressure==0){read(ts,&ts_event,sizeof(TS_EVENT));read(ts,&ts_event,sizeof(TS_EVENT));}if (ts_event.pressure > 0 ) {int new_x;int new_y;mPOINT ts_point,display_point;ts_point.x=ts_event.x;ts_point.y=ts_event.y;getDisplayPoint(&display_point,&ts_point,&m_matrix);new_x = display_point.x;new_y = display_point.y;if(last_pressure==0 || (last_pressure>0 && abs(new_x-mousex)<7))mousex=new_x;if(last_pressure==0 || (last_pressure>0 && abs(new_y-mousey)<7))mousey=new_y;/*printf("ts_x=%d,ts_y=%d\n",ts_event.x,ts_event.y);printf("mounsex=%dmousey=%d\n",mousex,mousey);*/}#ifdef _DEBUGif (ts_event.pressure > 0) {printf ("mouse down: ts_event.x = %d, ts_event.y = %d\n", ts_event.x, ts_event.y);}#endifts_event.pressure = ( ts_event.pressure > 0 ? IAL_MOUSE_LEFTBUTTON : 0);last_pressure=ts_event.pressure;/*printf("pressure=%d\n",ts_event.pressure);*/retvalue |= IAL_MOUSEEVENT;}}else if (e < 0) {return -1;}return retvalue;}BOOL Init2410Input (INPUT* input, const char* mdev, const char* mtype){ts = open (mdev, O_RDONLY);if (ts < 0) {fprintf (stderr, "2410: Can not open touch screen!\n");return FALSE;}input->update_mouse = mouse_update;input->get_mouse_xy = mouse_getxy;input->set_mouse_xy = NULL;input->get_mouse_button = mouse_getbutton;input->set_mouse_range = NULL;input->wait_event = wait_event;mousex = 0;mousey = 0;ts_event.x = ts_event.y = ts_event.pressure = 0;setCalibrationMatrix(&display_position,&ts_position,&m_matrix);return TRUE;}void Term2410Input(void){if (ts >= 0)close(ts);}#endif /* _SMDK2410_IAL */int setCalibrationMatrix( mPOINT * displayPtr,mPOINT * screenPtr,mMATRIX * matrixPtr){int  retvalue = 0 ;matrixPtr->Divider = ((screenPtr[0].x - screenPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -((screenPtr[1].x - screenPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;if( matrixPtr->Divider == 0 ){retvalue = -1 ;}else{matrixPtr->An = ((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].y - screenPtr[2].y)) -((displayPtr[1].x - displayPtr[2].x) * (screenPtr[0].y - screenPtr[2].y)) ;matrixPtr->Bn = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].x - displayPtr[2].x)) -((displayPtr[0].x - displayPtr[2].x) * (screenPtr[1].x - screenPtr[2].x)) ;matrixPtr->Cn = (screenPtr[2].x * displayPtr[1].x - screenPtr[1].x * displayPtr[2].x) * screenPtr[0].y +(screenPtr[0].x * displayPtr[2].x - screenPtr[2].x * displayPtr[0].x) * screenPtr[1].y +(screenPtr[1].x * displayPtr[0].x - screenPtr[0].x * displayPtr[1].x) * screenPtr[2].y ;matrixPtr->Dn = ((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].y - screenPtr[2].y)) -((displayPtr[1].y - displayPtr[2].y) * (screenPtr[0].y - screenPtr[2].y)) ;matrixPtr->En = ((screenPtr[0].x - screenPtr[2].x) * (displayPtr[1].y - displayPtr[2].y)) -((displayPtr[0].y - displayPtr[2].y) * (screenPtr[1].x - screenPtr[2].x)) ;matrixPtr->Fn = (screenPtr[2].x * displayPtr[1].y - screenPtr[1].x * displayPtr[2].y) * screenPtr[0].y +(screenPtr[0].x * displayPtr[2].y - screenPtr[2].x * displayPtr[0].y) * screenPtr[1].y +(screenPtr[1].x * displayPtr[0].y - screenPtr[0].x * displayPtr[1].y) * screenPtr[2].y ;}return( retvalue ) ;} /* end of setCalibrationMatrix() */int getDisplayPoint( mPOINT * displayPtr,mPOINT * screenPtr,mMATRIX * matrixPtr ){int  retvalue = 0 ;if( matrixPtr->Divider != 0 ){/* Operation order is important since we are doing integer *//*  math. Make sure you add all terms together before      *//*  dividing, so that the remainder is not rounded off     *//*  prematurely.                                           */displayPtr->x = ( (matrixPtr->An * screenPtr->x) +(matrixPtr->Bn * screenPtr->y) +matrixPtr->Cn) / matrixPtr->Divider ;displayPtr->y = ( (matrixPtr->Dn * screenPtr->x) +(matrixPtr->En * screenPtr->y) +matrixPtr->Fn) / matrixPtr->Divider ;}else{retvalue = -1 ;}return( retvalue ) ;} /* end of getDisplayPoint() 
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
linux 內核筆記之watchdog
FT5X06 如何應用在10寸電容屏(linux
利用觸摸屏獲取事件坐標
鼠標滑過(guò)圖片出現大圖片提示層效果js代碼
IAL菠蘿花披肩
關(guān)于SI的一些FAQ
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久