Modified version of the DmTftLibrary, optimized for the LPC4088 Experiment Base Board

Dependents:   lpc4088_ebb_dm_calc lpc4088_ebb_dm_bubbles

Fork of DmTftLibrary by Display Module

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DmTouchCalibration.h Source File

DmTouchCalibration.h

00001 /**********************************************************************************************
00002  Copyright (c) 2014 DisplayModule. All rights reserved.
00003 
00004  Redistribution and use of this source code, part of this source code or any compiled binary
00005  based on this source code is permitted as long as the above copyright notice and following
00006  disclaimer is retained.
00007 
00008  DISCLAIMER:
00009  THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT ANY WARRANTIES AND SUPPORT. DISPLAYMODULE ASSUMES
00010  NO RESPONSIBILITY OR LIABILITY FOR THE USE OF THE SOFTWARE.
00011  ********************************************************************************************/
00012 
00013 #ifndef DM_TOUCHCALIBRATION_h
00014 #define DM_TOUCHCALIBRATION_h
00015 
00016 #include "dm_platform.h"
00017 #include "DmTouch.h"
00018 #include "DmTftBase.h"
00019 
00020 typedef struct point {
00021   uint16_t x, y;
00022 } Point;
00023 
00024 class DmTouchCalibration
00025 {
00026 public:
00027   DmTouchCalibration(DmTftBase *tftBase, DmTouch *touch);
00028   bool getTouchReferencePoints(Point displayRefPoint[], Point touchRefPoint[], uint16_t tftWidth, uint16_t tftHeight);
00029   CalibrationMatrix calculateCalibrationMatrix(Point displayRefPoint[], Point touchRefPoint[]);
00030   static CalibrationMatrix getDefaultCalibrationData(DmTouch::Display disp);
00031   void drawCalibPoint(uint16_t x, uint16_t y) const;
00032   void drawCalibration(CalibrationMatrix calibrationMatrix);
00033   void printCalibration(CalibrationMatrix calibrationMatrix) const;
00034 private:
00035   DmTftBase* _tft;
00036   DmTouch* _touch;
00037   uint16_t _textRow;
00038   void printHeadline(char* text);
00039   void printNumber(int32_t number) const ;
00040   void releaseTouch(uint16_t x, uint16_t y) const;
00041   bool getRawTouch(uint16_t& x, uint16_t& y) const;
00042 };
00043 #endif