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) {
|
||||
/* ToDo */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,16 @@
|
|||
/* Type definitions */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Struct used for calibration
|
||||
*/
|
||||
struct cal {
|
||||
float xm;
|
||||
float ym;
|
||||
float xn;
|
||||
float yn;
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
@ -53,29 +63,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if TOUCHPAD_NEED_MULTITHREAD
|
||||
|
||||
void tpInit(TOUCHPADDriver *tp);
|
||||
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
|
||||
void tpInit(TOUCHPADDriver *tp);
|
||||
uint16_t tpReadX(void);
|
||||
uint16_t tpReadY(void);
|
||||
|
||||
#if TOUCHPAD_PRESSURE
|
||||
uint16_t tpReadZ(void);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -27,17 +27,11 @@
|
|||
*/
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "gdisp.h"
|
||||
#include "touchpad.h"
|
||||
|
||||
#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. */
|
||||
/*===========================================================================*/
|
||||
|
@ -58,6 +52,9 @@
|
|||
/*===========================================================================*/
|
||||
/* Driver local variables. */
|
||||
/*===========================================================================*/
|
||||
volatile static struct cal cal = {
|
||||
1, 1, 0, 0
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
|
@ -67,52 +64,62 @@
|
|||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Touchpad Driver initialization.
|
||||
* @note This function is NOT currently implicitly invoked by @p halInit().
|
||||
* It must be called manually.
|
||||
*
|
||||
* @init
|
||||
*/
|
||||
void tpInit(TOUCHPADDriver * UNUSED(tp)) {
|
||||
/* Initialise Mutex */
|
||||
//MUTEX_INIT
|
||||
/**
|
||||
* @brief Touchpad Driver initialization.
|
||||
* @note This function is NOT currently implicitly invoked by @p halInit().
|
||||
* It must be called manually.
|
||||
*
|
||||
* @init
|
||||
*/
|
||||
void tpInit(TOUCHPADDriver *tp) {
|
||||
/* Initialise Mutex */
|
||||
//MUTEX_INIT
|
||||
|
||||
/* Initialise driver */
|
||||
//MUTEX_ENTER
|
||||
tp_lld_init();
|
||||
//MUTEX_EXIT
|
||||
}
|
||||
#endif
|
||||
/* Initialise driver */
|
||||
//MUTEX_ENTER
|
||||
tp_lld_init(tp);
|
||||
//MUTEX_EXIT
|
||||
}
|
||||
|
||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Get the X-Coordinate, relative to screen zero point.
|
||||
*
|
||||
* @return The X position in pixels.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
uint16_t tpReadX(void) {
|
||||
return (tp_lld_read_x());
|
||||
/**
|
||||
* @brief Get the X-Coordinate, relative to screen zero point.
|
||||
*
|
||||
* @return The X position in pixels.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
uint16_t tpReadX(void) {
|
||||
uint16_t x, y;
|
||||
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
#if TOUCHPAD_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @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
|
||||
/**
|
||||
* @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_NEED_MULTITHREAD || defined(__DOXYGEN__)
|
||||
#if TOUCHPAD_PRESSURE || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Get the pressure.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue