P. 1
Getting Started With uClinux A

Getting Started With uClinux A

|Views: 749|Likes:
Published by Vinit Dalvi

More info:

Published by: Vinit Dalvi on Aug 12, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





The TSC2046 touch screen controller is compatible with the ADS7846 touch screen

controller. A driver for the ADS7846 is integrated in the kernel source tree and that driver

has been able to be used without modification for the TSC2046 controller. The source code

is available in the uClinux-dist/linux-

2.6.x/drivers/input/touchscreen/ads7846.c file.

5.5.3 Usage

The touch screen is exposed to applications as two device files called /dev/tsraw0 and

/dev/ts0. The tsraw0 device delivers unmodified raw values from the touch screen while

the ts0 device delivers values that have been converted by a calibration algorithm.

The calibrate application found in the uClinux-


.c file illustrates how to use the touch screen device files and one way of how to calibrate

the touch screen.

Below is a simple example of how to open the calibrated touch screen device, read values

from it and output the values as points on a display.

//** TToouucchh ssccrreeeenn ddaattaa **//

ssttrruucctt ttss__eevveenntt {{

sshhoorrtt pprreessssuurree;;

sshhoorrtt xx;;

sshhoorrtt yy;;

sshhoorrtt mmiilllliisseeccss;;




ttss__ffdd == ooppeenn((""//ddeevv//ttss00"",, OO__RRDDOONNLLYY));;

//** ffaaiilleedd ttoo ooppeenn ddeevviiccee **//

iiff ((ttss__ffdd << 00)) {{

ggoottoo eerrrr__cclloossee__ffbb;;


wwhhiillee((11)) {{

lleenn == rreeaadd((ttss__ffdd,, &&eevveenntt,, ssiizzeeooff((ssttrruucctt ttss__eevveenntt))));;

//** ffaaiilleedd ttoo rreeaadd ffrroomm tthhee ddeevviiccee **//

iiff ((lleenn <<== 00)) {{

ggoottoo eerrrr__cclloossee__ttss;;


llccdd__ppooiinntt((ffrraammee__mmaapp,, eevveenntt..xx,, eevveenntt..yy,, CCOOLLOORR__BBLLAACCKK));;



Getting Started With Clinux Development

Page 50

Copyright 2009 © Embedded Artists AB

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->