Convert FT5x06 mouse driver to newmouse (untested)
This commit is contained in:
parent
cf3b8e4ed2
commit
b7baee596b
8 changed files with 259 additions and 279 deletions
|
@ -1,111 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file drivers/ginput/touch/FT5x06/ginput_lld_mouse_board_marlin.h
|
|
||||||
* @brief GINPUT Touch low level driver source for the FT5x06.
|
|
||||||
*
|
|
||||||
* @defgroup Mouse Mouse
|
|
||||||
* @ingroup GINPUT
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
#define _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
|
|
||||||
/* I2C interface #2 - Touchscreen controller */
|
|
||||||
static const I2CConfig i2ccfg2 = {
|
|
||||||
OPMODE_I2C,
|
|
||||||
400000,
|
|
||||||
FAST_DUTY_CYCLE_2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialise the board for the touch.
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static void init_board(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Write a value into a certain register
|
|
||||||
*
|
|
||||||
* @param[in] reg The register address
|
|
||||||
* @param[in] n The amount of bytes (one or two)
|
|
||||||
* @param[in] val The value
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static void write_reg(uint8_t reg, uint8_t n, uint16_t val) {
|
|
||||||
uint8_t txbuf[3];
|
|
||||||
|
|
||||||
i2cAcquireBus(&I2CD2);
|
|
||||||
|
|
||||||
txbuf[0] = reg;
|
|
||||||
|
|
||||||
if (n == 1) {
|
|
||||||
txbuf[1] = val;
|
|
||||||
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 2, 0, 0, MS2ST(FT5x06_TIMEOUT));
|
|
||||||
} else if (n == 2) {
|
|
||||||
txbuf[1] = ((val & 0xFF00) >> 8);
|
|
||||||
txbuf[2] = (val & 0x00FF);
|
|
||||||
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 3, 0, 0, MS2ST(FT5x06_TIMEOUT));
|
|
||||||
}
|
|
||||||
|
|
||||||
i2cReleaseBus(&I2CD2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read the value of a certain register
|
|
||||||
*
|
|
||||||
* @param[in] reg The register address
|
|
||||||
* @param[in] n The amount of bytes (one or two)
|
|
||||||
*
|
|
||||||
* @return Data read from device (one byte or two depending on n param)
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
static uint16_t read_reg(uint8_t reg, uint8_t n) {
|
|
||||||
uint8_t txbuf[1], rxbuf[2];
|
|
||||||
uint16_t ret;
|
|
||||||
|
|
||||||
rxbuf[0] = 0;
|
|
||||||
rxbuf[1] = 0;
|
|
||||||
|
|
||||||
i2cAcquireBus(&I2CD2);
|
|
||||||
|
|
||||||
txbuf[0] = reg;
|
|
||||||
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 1, rxbuf, n, MS2ST(FT5x06_TIMEOUT));
|
|
||||||
|
|
||||||
if (n == 1) {
|
|
||||||
ret = rxbuf[0];
|
|
||||||
} else if (n == 2) {
|
|
||||||
ret = ((rxbuf[0] << 8) | (rxbuf[1] & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
i2cReleaseBus(&I2CD2);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void read_reg_n(uint8_t reg, uint8_t n, uint8_t *rxbuf) {
|
|
||||||
uint8_t txbuf[1];
|
|
||||||
|
|
||||||
i2cAcquireBus(&I2CD2);
|
|
||||||
|
|
||||||
txbuf[0] = reg;
|
|
||||||
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 1, rxbuf, n, MS2ST(FT5x06_TIMEOUT));
|
|
||||||
|
|
||||||
i2cReleaseBus(&I2CD2);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
|
||||||
/** @} */
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h
|
|
||||||
* @brief GINPUT LLD header file for mouse/touch driver.
|
|
||||||
*
|
|
||||||
* @defgroup Mouse Mouse
|
|
||||||
* @ingroup GINPUT
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
|
||||||
|
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 15
|
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 1
|
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 5
|
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 450
|
|
||||||
|
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
|
||||||
/** @} */
|
|
93
boards/base/Marlin/gmouse_lld_FT5x06_board.h
Normal file
93
boards/base/Marlin/gmouse_lld_FT5x06_board.h
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
|
||||||
|
// Resolution and Accuracy Settings
|
||||||
|
#define GMOUSE_FT5x06_PEN_CALIBRATE_ERROR 8
|
||||||
|
#define GMOUSE_FT5x06_PEN_CLICK_ERROR 6
|
||||||
|
#define GMOUSE_FT5x06_PEN_MOVE_ERROR 4
|
||||||
|
#define GMOUSE_FT5x06_FINGER_CALIBRATE_ERROR 14
|
||||||
|
#define GMOUSE_FT5x06_FINGER_CLICK_ERROR 18
|
||||||
|
#define GMOUSE_FT5x06_FINGER_MOVE_ERROR 14
|
||||||
|
|
||||||
|
// How much extra data to allocate at the end of the GMouse structure for the board's use
|
||||||
|
#define GMOUSE_FT5x06_BOARD_DATA_SIZE 0
|
||||||
|
|
||||||
|
// Set this to TRUE if you want self-calibration.
|
||||||
|
// NOTE: This is not as accurate as real calibration.
|
||||||
|
// It requires the orientation of the touch panel to match the display.
|
||||||
|
// It requires the active area of the touch panel to exactly match the display size.
|
||||||
|
#define GMOUSE_FT5x06_SELF_CALIBRATE FALSE
|
||||||
|
|
||||||
|
/* I2C interface #2 - Touchscreen controller */
|
||||||
|
static const I2CConfig i2ccfg2 = {
|
||||||
|
OPMODE_I2C,
|
||||||
|
400000,
|
||||||
|
FAST_DUTY_CYCLE_2,
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
// We only support one of these on this board
|
||||||
|
if (driverinstance)
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void aquire_bus(GMouse* m) {
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void release_bus(GMouse* m) {
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_reg(GMouse* m, uint8_t reg, uint8_t val) {
|
||||||
|
uint8_t txbuf[2];
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
txbuf[0] = reg;
|
||||||
|
txbuf[1] = val;
|
||||||
|
|
||||||
|
i2cAcquireBus(&I2CD2);
|
||||||
|
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 2, 0, 0, MS2ST(FT5x06_TIMEOUT));
|
||||||
|
i2cReleaseBus(&I2CD2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t read_byte(GMouse* m, uint8_t reg) {
|
||||||
|
uint8_t rxbuf[1];
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
rxbuf[0] = 0;
|
||||||
|
|
||||||
|
i2cAcquireBus(&I2CD2);
|
||||||
|
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, ®, 1, rxbuf, 1, MS2ST(FT5x06_TIMEOUT));
|
||||||
|
i2cReleaseBus(&I2CD2);
|
||||||
|
|
||||||
|
return rxbuf[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint16_t read_word(GMouse* m, uint8_t reg) {
|
||||||
|
uint8_t rxbuf[2];
|
||||||
|
(void) m;
|
||||||
|
|
||||||
|
rxbuf[0] = 0;
|
||||||
|
rxbuf[1] = 0;
|
||||||
|
|
||||||
|
i2cAcquireBus(&I2CD2);
|
||||||
|
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, ®, 1, rxbuf, 2, MS2ST(FT5x06_TIMEOUT));
|
||||||
|
i2cReleaseBus(&I2CD2);
|
||||||
|
|
||||||
|
return (((uint16_t)rxbuf[0]) << 8) | rxbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
|
@ -1,88 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "gfx.h"
|
|
||||||
|
|
||||||
#if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
|
|
||||||
|
|
||||||
#include "src/ginput/driver_mouse.h"
|
|
||||||
|
|
||||||
#include "drivers/ginput/touch/FT5x06/ft5x06.h"
|
|
||||||
|
|
||||||
// include board abstraction
|
|
||||||
#include "ginput_lld_mouse_board.h"
|
|
||||||
|
|
||||||
static coord_t x, y, z;
|
|
||||||
static uint8_t touched;
|
|
||||||
|
|
||||||
void ginput_lld_mouse_init(void) {
|
|
||||||
init_board();
|
|
||||||
|
|
||||||
// Init default values. (From NHD-3.5-320240MF-ATXL-CTP-1 datasheet)
|
|
||||||
// Valid touching detect threshold
|
|
||||||
write_reg(FT5x06_ID_G_THGROUP, 1, 0x16);
|
|
||||||
|
|
||||||
// valid touching peak detect threshold
|
|
||||||
write_reg(FT5x06_ID_G_THPEAK, 1, 0x3C);
|
|
||||||
|
|
||||||
// Touch focus threshold
|
|
||||||
write_reg(FT5x06_ID_G_THCAL, 1, 0xE9);
|
|
||||||
|
|
||||||
// threshold when there is surface water
|
|
||||||
write_reg(FT5x06_ID_G_THWATER, 1, 0x01);
|
|
||||||
|
|
||||||
// threshold of temperature compensation
|
|
||||||
write_reg(FT5x06_ID_G_THTEMP, 1, 0x01);
|
|
||||||
|
|
||||||
// Touch difference threshold
|
|
||||||
write_reg(FT5x06_ID_G_THDIFF, 1, 0xA0);
|
|
||||||
|
|
||||||
// Delay to enter 'Monitor' status (s)
|
|
||||||
write_reg(FT5x06_ID_G_TIME_ENTER_MONITOR, 1, 0x0A);
|
|
||||||
|
|
||||||
// Period of 'Active' status (ms)
|
|
||||||
write_reg(FT5x06_ID_G_PERIODACTIVE, 1, 0x06);
|
|
||||||
|
|
||||||
// Timer to enter ÔidleÕ when in 'Monitor' (ms)
|
|
||||||
write_reg(FT5x06_ID_G_PERIODMONITOR, 1, 0x28);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
|
||||||
// Poll to get the touched status
|
|
||||||
uint8_t last_touched;
|
|
||||||
|
|
||||||
last_touched = touched;
|
|
||||||
touched = (uint8_t)read_reg(FT5x06_TOUCH_POINTS, 1) & 0x07;
|
|
||||||
|
|
||||||
// If not touched, return the previous results
|
|
||||||
if (touched == 0) {
|
|
||||||
pt->x = x;
|
|
||||||
pt->y = y;
|
|
||||||
pt->z = 0;
|
|
||||||
pt->buttons = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the X, Y, Z values */
|
|
||||||
x = (coord_t)(read_reg(FT5x06_TOUCH1_XH, 2) & 0x0fff);
|
|
||||||
y = (coord_t)read_reg(FT5x06_TOUCH1_YH, 2);
|
|
||||||
z = 100;
|
|
||||||
|
|
||||||
// Rescale X,Y,Z - X & Y don't need scaling when you are using calibration!
|
|
||||||
#if !GINPUT_MOUSE_NEED_CALIBRATION
|
|
||||||
x = gdispGetWidth() - x / (4096/gdispGetWidth());
|
|
||||||
y = y / (4096/gdispGetHeight());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Return the results. ADC gives values from 0 to 2^12 (4096)
|
|
||||||
pt->x = x;
|
|
||||||
pt->y = y;
|
|
||||||
pt->z = z;
|
|
||||||
pt->buttons = GINPUT_TOUCH_PRESSED;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
#define _GINPUT_LLD_MOUSE_BOARD_H
|
|
||||||
|
|
||||||
static void init_board(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool_t getpin_irq(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void write_reg(uint8_t reg, uint8_t n, uint16_t val) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint16_t read_reg(uint8_t reg, uint8_t n) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is subject to the terms of the GFX License. If a copy of
|
|
||||||
* the license was not distributed with this file, you can obtain one at:
|
|
||||||
*
|
|
||||||
* http://ugfx.org/license.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
|
||||||
|
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 15
|
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 1
|
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 5
|
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 450
|
|
||||||
|
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
|
120
drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c
Normal file
120
drivers/ginput/touch/FT5x06/gmouse_lld_FT5x06.c
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
|
||||||
|
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
|
||||||
|
|
||||||
|
#define GMOUSE_DRIVER_VMT GMOUSEVMT_FT5x06
|
||||||
|
#include "src/ginput/driver_mouse.h"
|
||||||
|
|
||||||
|
// Get the hardware interface
|
||||||
|
#include "gmouse_lld_FT5x06_board.h"
|
||||||
|
|
||||||
|
// Hardware definitions
|
||||||
|
#include "drivers/ginput/touch/FT5x06/ft5x06.h"
|
||||||
|
|
||||||
|
static bool_t MouseInit(GMouse* m, unsigned driverinstance) {
|
||||||
|
if (!init_board(m, driverinstance))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
aquire_bus(m);
|
||||||
|
|
||||||
|
// Init default values. (From NHD-3.5-320240MF-ATXL-CTP-1 datasheet)
|
||||||
|
// Valid touching detect threshold
|
||||||
|
write_reg(m, FT5x06_ID_G_THGROUP, 0x16);
|
||||||
|
|
||||||
|
// valid touching peak detect threshold
|
||||||
|
write_reg(m, FT5x06_ID_G_THPEAK, 0x3C);
|
||||||
|
|
||||||
|
// Touch focus threshold
|
||||||
|
write_reg(m, FT5x06_ID_G_THCAL, 0xE9);
|
||||||
|
|
||||||
|
// threshold when there is surface water
|
||||||
|
write_reg(m, FT5x06_ID_G_THWATER, 0x01);
|
||||||
|
|
||||||
|
// threshold of temperature compensation
|
||||||
|
write_reg(m, FT5x06_ID_G_THTEMP, 0x01);
|
||||||
|
|
||||||
|
// Touch difference threshold
|
||||||
|
write_reg(m, FT5x06_ID_G_THDIFF, 0xA0);
|
||||||
|
|
||||||
|
// Delay to enter 'Monitor' status (s)
|
||||||
|
write_reg(m, FT5x06_ID_G_TIME_ENTER_MONITOR, 0x0A);
|
||||||
|
|
||||||
|
// Period of 'Active' status (ms)
|
||||||
|
write_reg(m, FT5x06_ID_G_PERIODACTIVE, 0x06);
|
||||||
|
|
||||||
|
// Timer to enter 'idle' when in 'Monitor' (ms)
|
||||||
|
write_reg(m, FT5x06_ID_G_PERIODMONITOR, 0x28);
|
||||||
|
|
||||||
|
release_bus(m);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MouseXYZ(GMouse* m, GMouseReading* pdr)
|
||||||
|
{
|
||||||
|
// Assume not touched.
|
||||||
|
pdr->buttons = 0;
|
||||||
|
pdr->z = 0;
|
||||||
|
|
||||||
|
aquire_bus(m);
|
||||||
|
|
||||||
|
// Only take a reading if we are touched.
|
||||||
|
if ((read_byte(m, FT5x06_TOUCH_POINTS) & 0x07)) {
|
||||||
|
|
||||||
|
/* Get the X, Y, Z values */
|
||||||
|
pdr->x = (coord_t)(read_word(m, FT5x06_TOUCH1_XH) & 0x0fff);
|
||||||
|
pdr->y = (coord_t)read_word(m, FT5x06_TOUCH1_YH);
|
||||||
|
pdr->z = 1;
|
||||||
|
|
||||||
|
#if GMOUSE_FT5x06_SELF_CALIBRATE
|
||||||
|
// Rescale X,Y,Z - If we are using self-calibration
|
||||||
|
pdr->x = gdispGGetWidth(m->display) - pdr->x / (4096/gdispGGetWidth(m->display));
|
||||||
|
pdr->y = pdr->y / (4096/gdispGGetHeight(m->display));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
release_bus(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||||
|
{
|
||||||
|
GDRIVER_TYPE_TOUCH,
|
||||||
|
#if GMOUSE_FT5x06_SELF_CALIBRATE
|
||||||
|
GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN,
|
||||||
|
#else
|
||||||
|
GMOUSE_VFLG_TOUCH | GMOUSE_VFLG_ONLY_DOWN | GMOUSE_VFLG_POORUPDOWN | GMOUSE_VFLG_CALIBRATE | GMOUSE_VFLG_CAL_TEST,
|
||||||
|
#endif
|
||||||
|
sizeof(GMouse) + GMOUSE_FT5x06_BOARD_DATA_SIZE,
|
||||||
|
_gmouseInitDriver,
|
||||||
|
_gmousePostInitDriver,
|
||||||
|
_gmouseDeInitDriver
|
||||||
|
},
|
||||||
|
1, // z_max - (currently?) not supported
|
||||||
|
0, // z_min - (currently?) not supported
|
||||||
|
1, // z_touchon
|
||||||
|
0, // z_touchoff
|
||||||
|
{ // pen_jitter
|
||||||
|
GMOUSE_FT5x06_PEN_CALIBRATE_ERROR, // calibrate
|
||||||
|
GMOUSE_FT5x06_PEN_CLICK_ERROR, // click
|
||||||
|
GMOUSE_FT5x06_PEN_MOVE_ERROR // move
|
||||||
|
},
|
||||||
|
{ // finger_jitter
|
||||||
|
GMOUSE_FT5x06_FINGER_CALIBRATE_ERROR, // calibrate
|
||||||
|
GMOUSE_FT5x06_FINGER_CLICK_ERROR, // click
|
||||||
|
GMOUSE_FT5x06_FINGER_MOVE_ERROR // move
|
||||||
|
},
|
||||||
|
MouseInit, // init
|
||||||
|
0, // deinit
|
||||||
|
read_xyz, // get
|
||||||
|
0, // calsave
|
||||||
|
0 // calload
|
||||||
|
}};
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms of the GFX License. If a copy of
|
||||||
|
* the license was not distributed with this file, you can obtain one at:
|
||||||
|
*
|
||||||
|
* http://ugfx.org/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||||
|
|
||||||
|
// Resolution and Accuracy Settings
|
||||||
|
#define GMOUSE_FT5x06_PEN_CALIBRATE_ERROR 8
|
||||||
|
#define GMOUSE_FT5x06_PEN_CLICK_ERROR 6
|
||||||
|
#define GMOUSE_FT5x06_PEN_MOVE_ERROR 4
|
||||||
|
#define GMOUSE_FT5x06_FINGER_CALIBRATE_ERROR 14
|
||||||
|
#define GMOUSE_FT5x06_FINGER_CLICK_ERROR 18
|
||||||
|
#define GMOUSE_FT5x06_FINGER_MOVE_ERROR 14
|
||||||
|
|
||||||
|
// How much extra data to allocate at the end of the GMouse structure for the board's use
|
||||||
|
#define GMOUSE_FT5x06_BOARD_DATA_SIZE 0
|
||||||
|
|
||||||
|
// Set this to TRUE if you want self-calibration.
|
||||||
|
// NOTE: This is not as accurate as real calibration.
|
||||||
|
// It requires the orientation of the touch panel to match the display.
|
||||||
|
// It requires the active area of the touch panel to exactly match the display size.
|
||||||
|
#define GMOUSE_FT5x06_SELF_CALIBRATE FALSE
|
||||||
|
|
||||||
|
static bool_t init_board(GMouse* m, unsigned driverinstance) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void aquire_bus(GMouse* m) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void release_bus(GMouse* m) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_reg(GMouse* m, uint8_t reg, uint8_t val) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t read_byte(GMouse* m, uint8_t reg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint16_t read_word(GMouse* m, uint8_t reg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */
|
Loading…
Add table
Reference in a new issue