diff options
author | Joel Bodenmann <joel@unormal.org> | 2012-09-26 00:05:24 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2012-09-26 00:05:24 +0200 |
commit | 5de2e9ac86f4cbc4750cdf314891412ccc554985 (patch) | |
tree | d6d590965b9c2b77a6870a4acfef23ed2fed208b | |
parent | 0ba16c35afe1a09c74c125a12869b6aaf208cd3f (diff) | |
download | uGFX-5de2e9ac86f4cbc4750cdf314891412ccc554985.tar.gz uGFX-5de2e9ac86f4cbc4750cdf314891412ccc554985.tar.bz2 uGFX-5de2e9ac86f4cbc4750cdf314891412ccc554985.zip |
implemented touchpad calibration storage interface
-rw-r--r-- | include/touchpad.h | 9 | ||||
-rw-r--r-- | src/touchpad.c | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/touchpad.h b/include/touchpad.h index d96ea51c..4d4931fe 100644 --- a/include/touchpad.h +++ b/include/touchpad.h @@ -52,6 +52,10 @@ /* Type definitions */ /*===========================================================================*/ +#ifndef TOUCHPAD_STORE_CALIBRATION + #define TOUCHPAD_STORE_CALIBRATION FALSE +#endif + /** * @brief Struct used for calibration */ @@ -83,6 +87,11 @@ void tpCalibrate(void); uint16_t tpReadZ(void); #endif +#if TOUCHPAD_STORE_CALIBRATION + extern void lld_tpWriteCalibration(struct cal cal); + extern struct cal lld_tpReadCalibration(void); +#endif + #ifdef __cplusplus } #endif diff --git a/src/touchpad.c b/src/touchpad.c index fe0f047f..676e8e33 100644 --- a/src/touchpad.c +++ b/src/touchpad.c @@ -143,6 +143,10 @@ void tpInit(const TOUCHPADDriver *tp) { //MUTEX_ENTER tp_lld_init(tp); //MUTEX_EXIT + + #if TOUCHPAD_STORE_CALIBRATION + cal = lld_tpReadCalibration(); + #endif } /** @@ -222,6 +226,10 @@ void tpCalibrate(void) { cal.xn = (float)cross[0][0] - cal.xm * (float)points[0][0]; cal.yn = (float)cross[0][1] - cal.ym * (float)points[0][1]; + + #if TOUCHPAD_STORE_CALIBRATION + lld_tpWriteCalibration(cal); + #endif } #if TOUCHPAD_HAS_IRQ || defined(__DOXYGEN__) |