Calculator Community > Calculator C

Getting touchpad coordinates

(1/2) > >>

aeTIos:
As per topic title. I would like to get the coordinates off the touchpad. I looked at matrefeytontias' code for nKaruga but I couldn't make much of it. What I'd like to know is 1) how to access the touchpad and 2) how to get the coordinates off it. TIA :D

Vogtinator:
It's fairly simple using the touchpad_scan function:
https://github.com/Vogtinator/pyWrite/blob/master/cursortask.cpp#L17

Matrefeytontias:
The touchpad code for nKaruga is in Player.cpp IIRC. Also, the touchpad needs "initialization", which is done at the start of main.
Basically, you "initialize" the touchpad by reading HW constants from it (you'll need them). You only do that once, since they are constants. When that's done, read the touchpad at any time with touchpad_scan.

Vogtinator:

--- Quote ---The touchpad code for nKaruga is in Player.cpp IIRC. Also, the touchpad needs "initialization", which is done at the start of main.
Basically, you "initialize" the touchpad by reading HW constants from it (you'll need them). You only do that once, since they are constants. When that's done, read the touchpad at any time with touchpad_scan.
--- End quote ---
The touchpad doesn't need initialization and the constants are actually fixed and the same everywhere, so you can completely skip that. (Anyway, only the relative coordinates are interesting, as touchpads are generally not used to get absolute coordinates, the way TI uses the touchpad to replace arrow keys is really annoying)

aeTIos:

--- Quote from: Vogtinator on November 21, 2014, 01:09:26 pm ---
--- Quote ---The touchpad code for nKaruga is in Player.cpp IIRC. Also, the touchpad needs "initialization", which is done at the start of main.
Basically, you "initialize" the touchpad by reading HW constants from it (you'll need them). You only do that once, since they are constants. When that's done, read the touchpad at any time with touchpad_scan.
--- End quote ---
The touchpad doesn't need initialization and the constants are actually fixed and the same everywhere, so you can completely skip that. (Anyway, only the relative coordinates are interesting, as touchpads are generally not used to get absolute coordinates, the way TI uses the touchpad to replace arrow keys is really annoying)

--- End quote ---
Er, I actually do want the absolute coordinates, as I'm not planning to use it as a mouse movement device.

Navigation

[0] Message Index

[#] Next page

Go to full version