diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-31 14:53:57 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-31 14:53:57 +0000 |
commit | 695f514e3e873873984ab83e1193bc9d0b4e4985 (patch) | |
tree | b63362e6012f40378e18a9505e7f9290e2107485 /nuttx/drivers/input | |
parent | b11b18fe1dcd3531625035d07322a263f4891e1f (diff) | |
download | px4-nuttx-695f514e3e873873984ab83e1193bc9d0b4e4985.tar.gz px4-nuttx-695f514e3e873873984ab83e1193bc9d0b4e4985.tar.bz2 px4-nuttx-695f514e3e873873984ab83e1193bc9d0b4e4985.zip |
Forgot to add file in last checkin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3832 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/input')
-rw-r--r-- | nuttx/drivers/input/tsc2007.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/nuttx/drivers/input/tsc2007.c b/nuttx/drivers/input/tsc2007.c index e79bb3568..4a5082f08 100644 --- a/nuttx/drivers/input/tsc2007.c +++ b/nuttx/drivers/input/tsc2007.c @@ -84,7 +84,7 @@ #undef CONFIG_TSC2007_REFCNT /* Driver support ***********************************************************/ -/* This format is used to construct the /dev/skel[n] device driver path. It +/* This format is used to construct the /dev/input[n] device driver path. It * defined here so that it will be used consistently in all places. */ @@ -99,16 +99,17 @@ enum tsc2007_contact_3 { - CONTACT_NONE = 0, /* No contact */ - CONTACT_DOWN, /* First contact */ - CONTACT_MOVE, /* Same contact, possibly different position */ - CONTACT_UP, /* Contact lost */ + CONTACT_NONE = 0, /* No contact */ + CONTACT_DOWN, /* First contact */ + CONTACT_MOVE, /* Same contact, possibly different position */ + CONTACT_UP, /* Contact lost */ }; /* This structure describes the results of one TSC2007 sample */ struct tsc2007_sample_s { + uint8_t id; /* Sampled touch point ID */ uint8_t contact; /* Contact state (see enum tsc2007_contact_e) */ uint16_t x; /* Measured X position */ uint16_t y; /* Measured Y position */ @@ -279,7 +280,7 @@ static int tsc2007_sample(FAR struct tsc2007_dev_s *priv, if (sample->contact == CONTACT_UP) { - /* Next.. no contract. Increment the ID so that next contact will be unique */ + /* Next.. no contract. Increment the ID so that next contact ID will be unique */ priv->sample.contact = CONTACT_NONE; priv->id++; @@ -621,7 +622,10 @@ static void tsc2007_worker(FAR void *arg) priv->sample.contact = CONTACT_UP; } - + + /* Indicate the availability of new sample data for this ID */ + + priv->sample.id = priv->id; priv->penchange = true; /* Notify any waiters that nes TSC2007 data is available */ @@ -871,19 +875,19 @@ static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len { /* Pen is now up */ - report->point[0].flags = TOUCH_UP | TOUCH_ID_VALID | TOUCH_POS_VALID |TOUCH_PRESSURE_VALID; + report->point[0].flags = TOUCH_UP | TOUCH_ID_VALID; } else if (sample.contact == CONTACT_DOWN) { /* First contact */ - report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID |TOUCH_PRESSURE_VALID; + report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID | TOUCH_PRESSURE_VALID; } else /* if (sample->contact == CONTACT_MOVE) */ { /* Movement of the same contact */ - report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID |TOUCH_PRESSURE_VALID; + report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID | TOUCH_PRESSURE_VALID; } ret = SIZEOF_TOUCH_SAMPLE_S(1); |