Merge pull request #61 from mobyfab/master
ADS7843 - Macro for Inverted touchpad
This commit is contained in:
commit
22e7150f2d
1 changed files with 15 additions and 6 deletions
|
@ -45,6 +45,15 @@
|
||||||
#include "ginput_lld_mouse_board_example.h"
|
#include "ginput_lld_mouse_board_example.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GINPUT_MOUSE_YX_INVERTED) && GINPUT_MOUSE_YX_INVERTED
|
||||||
|
#define CMD_X 0x91
|
||||||
|
#define CMD_Y 0xD1
|
||||||
|
#else
|
||||||
|
#define CMD_X 0xD1
|
||||||
|
#define CMD_Y 0x91
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static uint16_t sampleBuf[7];
|
static uint16_t sampleBuf[7];
|
||||||
static coord_t lastx, lasty;
|
static coord_t lastx, lasty;
|
||||||
|
|
||||||
|
@ -115,18 +124,18 @@ void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
||||||
* Finally switch on PENIRQ once again - perform a dummy read.
|
* Finally switch on PENIRQ once again - perform a dummy read.
|
||||||
* Once we have the readings, find the medium using our filter function
|
* Once we have the readings, find the medium using our filter function
|
||||||
*/
|
*/
|
||||||
read_value(0xD1);
|
read_value(CMD_X);
|
||||||
for(i = 0; i < 7; i++)
|
for(i = 0; i < 7; i++)
|
||||||
sampleBuf[i] = read_value(0xD1);
|
sampleBuf[i] = read_value(CMD_X);
|
||||||
read_value(0xD0);
|
read_value(CMD_X-1);
|
||||||
filter();
|
filter();
|
||||||
lastx = (coord_t)sampleBuf[3];
|
lastx = (coord_t)sampleBuf[3];
|
||||||
|
|
||||||
/* Get the Y value using the same process as above */
|
/* Get the Y value using the same process as above */
|
||||||
read_value(0x91);
|
read_value(CMD_Y);
|
||||||
for(i = 0; i < 7; i++)
|
for(i = 0; i < 7; i++)
|
||||||
sampleBuf[i] = read_value(0x91);
|
sampleBuf[i] = read_value(CMD_Y);
|
||||||
read_value(0x90);
|
read_value(CMD_Y-1);
|
||||||
filter();
|
filter();
|
||||||
lasty = (coord_t)sampleBuf[3];
|
lasty = (coord_t)sampleBuf[3];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue