removed TOUCHPAD_NEED_MULTITASKING
This commit is contained in:
parent
19bb3b15dd
commit
4c3e1847de
3 changed files with 73 additions and 69 deletions
|
@ -62,6 +62,8 @@ __inline uint16_t lld_tpReadY(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline uint16_t lld_tpReadZ(void) {
|
__inline uint16_t lld_tpReadZ(void) {
|
||||||
|
/* ToDo */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,16 @@
|
||||||
/* Type definitions */
|
/* Type definitions */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Struct used for calibration
|
||||||
|
*/
|
||||||
|
struct cal {
|
||||||
|
float xm;
|
||||||
|
float ym;
|
||||||
|
float xn;
|
||||||
|
float yn;
|
||||||
|
};
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -53,29 +63,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TOUCHPAD_NEED_MULTITHREAD
|
void tpInit(TOUCHPADDriver *tp);
|
||||||
|
uint16_t tpReadX(void);
|
||||||
void tpInit(TOUCHPADDriver *tp);
|
uint16_t tpReadY(void);
|
||||||
uint16_t tpReadX(void);
|
|
||||||
uint16_t tpReadY(void);
|
|
||||||
|
|
||||||
#if TOUCHPAD_PRESSURE
|
|
||||||
uint16_t tpReadZ(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define tpInit(tp) tp_lld_init(tp)
|
|
||||||
#define tpReadX() tp_lld_read_x()
|
|
||||||
#define tpReadY() tp_lld_read_y()
|
|
||||||
|
|
||||||
#if TOUCHPAD_PRESSURE
|
|
||||||
#define tpReadZ() tp_lld_read_z()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if TOUCHPAD_PRESSURE
|
||||||
|
uint16_t tpReadZ(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,17 +27,11 @@
|
||||||
*/
|
*/
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
#include "gdisp.h"
|
||||||
#include "touchpad.h"
|
#include "touchpad.h"
|
||||||
|
|
||||||
#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__)
|
#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#if GDISP_NEED_MULTITHREAD
|
|
||||||
#warning "TOUCHPAD: Multithread support not complete"
|
|
||||||
#define MUTEX_INIT /* Not defined yet */
|
|
||||||
#define MUTEX_ENTER /* Not defined yet */
|
|
||||||
#define MUTEX_EXIT /* Not defined yet */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver local definitions. */
|
/* Driver local definitions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -58,6 +52,9 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver local variables. */
|
/* Driver local variables. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
volatile static struct cal cal = {
|
||||||
|
1, 1, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver local functions. */
|
/* Driver local functions. */
|
||||||
|
@ -67,52 +64,62 @@
|
||||||
/* Driver exported functions. */
|
/* Driver exported functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
/**
|
||||||
/**
|
* @brief Touchpad Driver initialization.
|
||||||
* @brief Touchpad Driver initialization.
|
* @note This function is NOT currently implicitly invoked by @p halInit().
|
||||||
* @note This function is NOT currently implicitly invoked by @p halInit().
|
* It must be called manually.
|
||||||
* It must be called manually.
|
*
|
||||||
*
|
* @init
|
||||||
* @init
|
*/
|
||||||
*/
|
void tpInit(TOUCHPADDriver *tp) {
|
||||||
void tpInit(TOUCHPADDriver * UNUSED(tp)) {
|
/* Initialise Mutex */
|
||||||
/* Initialise Mutex */
|
//MUTEX_INIT
|
||||||
//MUTEX_INIT
|
|
||||||
|
|
||||||
/* Initialise driver */
|
/* Initialise driver */
|
||||||
//MUTEX_ENTER
|
//MUTEX_ENTER
|
||||||
tp_lld_init();
|
tp_lld_init(tp);
|
||||||
//MUTEX_EXIT
|
//MUTEX_EXIT
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
/**
|
||||||
/**
|
* @brief Get the X-Coordinate, relative to screen zero point.
|
||||||
* @brief Get the X-Coordinate, relative to screen zero point.
|
*
|
||||||
*
|
* @return The X position in pixels.
|
||||||
* @return The X position in pixels.
|
*
|
||||||
*
|
* @api
|
||||||
* @api
|
*/
|
||||||
*/
|
uint16_t tpReadX(void) {
|
||||||
uint16_t tpReadX(void) {
|
uint16_t x, y;
|
||||||
return (tp_lld_read_x());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
x = cal.xm * _tpReadRealX() + cal.xn;
|
||||||
/**
|
y = cal.ym * _tpReadRealY() + cal.yn;
|
||||||
* @brief Get the X-Coordinate, relative to screen zero point.
|
|
||||||
*
|
|
||||||
* @return The Y position in pixels.
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
uint16_t tpReadY(void) {
|
|
||||||
return (tp_lld_read_y());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
//switch(gdispGetOrientation()) {
|
||||||
|
switch(portrait) { // implement gdispGetOrientation()
|
||||||
|
case portrait:
|
||||||
|
return x;
|
||||||
|
case landscape:
|
||||||
|
return SCREEN_HEIGHT - y;
|
||||||
|
case portraitInv:
|
||||||
|
return SCREEN_WIDTH - x;
|
||||||
|
case landscapeInv:
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the X-Coordinate, relative to screen zero point.
|
||||||
|
*
|
||||||
|
* @return The Y position in pixels.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
uint16_t tpReadY(void) {
|
||||||
|
return (tp_lld_read_y());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TOUCHPAD_PRESSURE || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief Get the pressure.
|
* @brief Get the pressure.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue