removed TOUCHPAD_NEED_MULTITASKING

This commit is contained in:
Tectu 2012-08-09 02:22:10 +02:00
parent 19bb3b15dd
commit 4c3e1847de
3 changed files with 73 additions and 69 deletions

View file

@ -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;
} }

View file

@ -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,8 +63,6 @@
extern "C" { extern "C" {
#endif #endif
#if TOUCHPAD_NEED_MULTITHREAD
void tpInit(TOUCHPADDriver *tp); void tpInit(TOUCHPADDriver *tp);
uint16_t tpReadX(void); uint16_t tpReadX(void);
uint16_t tpReadY(void); uint16_t tpReadY(void);
@ -63,19 +71,6 @@ extern "C" {
uint16_t tpReadZ(void); uint16_t tpReadZ(void);
#endif #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
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -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,7 +64,6 @@
/* 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().
@ -75,18 +71,16 @@
* *
* @init * @init
*/ */
void tpInit(TOUCHPADDriver * UNUSED(tp)) { void tpInit(TOUCHPADDriver *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.
* *
@ -95,11 +89,25 @@
* @api * @api
*/ */
uint16_t tpReadX(void) { uint16_t tpReadX(void) {
return (tp_lld_read_x()); uint16_t x, y;
}
#endif x = cal.xm * _tpReadRealX() + cal.xn;
y = cal.ym * _tpReadRealY() + cal.yn;
//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;
}
#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.
* *
@ -110,9 +118,8 @@
uint16_t tpReadY(void) { uint16_t tpReadY(void) {
return (tp_lld_read_y()); return (tp_lld_read_y());
} }
#endif
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__) #if TOUCHPAD_PRESSURE || defined(__DOXYGEN__)
/** /**
* @brief Get the pressure. * @brief Get the pressure.
* *