Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GUITDRV_ADS7846.h
00001 /********************************************************************* 00002 * SEGGER Microcontroller GmbH & Co. KG * 00003 * Solutions for real time microcontroller applications * 00004 ********************************************************************** 00005 * * 00006 * (c) 1996 - 2016 SEGGER Microcontroller GmbH & Co. KG * 00007 * * 00008 * Internet: www.segger.com Support: support@segger.com * 00009 * * 00010 ********************************************************************** 00011 00012 ** emWin V5.38 - Graphical user interface for embedded applications ** 00013 All Intellectual Property rights in the Software belongs to SEGGER. 00014 emWin is protected by international copyright laws. Knowledge of the 00015 source code may not be used to write a similar product. This file may 00016 only be used in accordance with the following terms: 00017 00018 The software has been licensed to NXP Semiconductors USA, Inc. whose 00019 registered office is situated at 411 E. Plumeria Drive, San Jose, 00020 CA 95134, USA solely for the purposes of creating libraries for 00021 NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and 00022 distributed under the terms and conditions of the NXP End User License 00023 Agreement. 00024 Full source code is available at: www.segger.com 00025 00026 We appreciate your understanding and fairness. 00027 ---------------------------------------------------------------------- 00028 Licensing information 00029 00030 Licensor: SEGGER Microcontroller Systems LLC 00031 Licensed to: NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA 00032 Licensed SEGGER software: emWin 00033 License number: GUI-00186 00034 License model: emWin License Agreement, dated August 20th 2011 00035 Licensed product: - 00036 Licensed platform: NXP's ARM 7/9, Cortex-M0,M3,M4 00037 Licensed number of seats: - 00038 ---------------------------------------------------------------------- 00039 File : GUITDRV_ADS7846.h 00040 Purpose : Touch screen driver include 00041 ---------------------------------------------------------------------- 00042 00043 Notes 00044 ===== 00045 (1) The driver needs some function pointer to be filled correctly to be able 00046 to communicate with the external peripheral correctly. The correct assignment 00047 of these function pointers is checked during driver configuration. 00048 00049 (2) The driver needs some configuration variables filled in to be able to calculate 00050 the logical screen coordinates from the physical AD values. 00051 A description of the typical paramaters that have to be known by the driver is 00052 listed below: 00053 - Orientation: Orientation of the touch screen if not the same as the physical orientation. 00054 A or-combination of the defines GUI_SWAP_XY, GUI_MIRROR_X and GUI_MIRROR_Y 00055 can be used. 00056 - xLog0 : Logical pixel value of horizontal reference point 0. Typically 0. 00057 - xLog1 : Logical pixel value of horizontal reference point 1. Typically horizontal screen resolution -1. 00058 - xPhys0 : Physical AD value of horizontal reference point 0. 00059 - xPhys1 : Physical AD value of horizontal reference point 1. 00060 - yLog0 : Logical pixel value of vertical reference point 0. Typically 0. 00061 - yLog1 : Logical pixel value of vertical reference point 1. Typically vertical screen resolution -1. 00062 - yPhys0 : Physical AD value of vertical reference point 0. 00063 - yPhys1 : Physical AD value of vertical reference point 1. 00064 00065 (3) If the PENIRQ line of the touch controller is connected to a port of the target hardware 00066 a touch event can be detected by the driver. Upon polling the driver's exec routine the 00067 driver can check if a touch event is ready to be sampled by checking the PENIRQ line. 00068 Without PENIRQ line the driver will always try to sample a touch event even if no touch 00069 happened which will consume time even if not necessary. 00070 Without PENIRQ it is the responsibility of the user's pfGetResult() routine to return 00071 0xFFFF if the measured AD value is out of bounds. 00072 If both, the PENIRQ and the touch pressure recognition are enabled first the PENIRQ will 00073 signal that there is a touch event. Afterwards the touch pressure measurement is used to 00074 confirm that this was a valid touch and the touch had enough pressure to deliver good 00075 measurements. 00076 00077 (4) The touch pressure measurement is activated by setting a value for PressureMin and 00078 PressureMax . 00079 To calculate the correct touch pressure the resistance of the X-plate has to be known. 00080 This can be set via PlateResistanceX [Ohm]. 00081 A touch event that we have measured with a pressure within these thresholds is confirmed 00082 as valid touch event with good measurment samples. 00083 If both, the PENIRQ and the touch pressure recognition are enabled first the PENIRQ will 00084 signal that there is a touch event. Afterwards the touch pressure measurement is used to 00085 confirm that this was a valid touch and the touch had enough pressure to deliver good 00086 measurements. 00087 If no PENIRQ line is connected this measurement takes place everytime the touch event is 00088 polled regardless if there is a touch event or not as the driver will only know for sure 00089 after calculating the touch pressure. 00090 Setting the value for PlateResistanceX to 0 is invalid. The driver will internally use a 00091 value of 1 instead. 00092 */ 00093 00094 #ifndef GUITDRV_ADS7846_H /* Make sure we only include it once */ 00095 #define GUITDRV_ADS7846_H 00096 00097 #include "GUI_Type.h" 00098 00099 #if defined(__cplusplus) 00100 extern "C" { /* Make sure we have C-declarations in C++ programs */ 00101 #endif 00102 00103 /********************************************************************* 00104 * 00105 * Types 00106 * 00107 ********************************************************************** 00108 */ 00109 00110 typedef struct { 00111 // 00112 // Function pointer (1) 00113 // 00114 void (* pfSendCmd) (U8 Data); // Sends a 8-bit command to the peripheral 00115 U16 (* pfGetResult) (void); // Retrieves the result of the AD conversion. 4 dummy bytes have to be shifted out to the left. 00116 char (* pfGetBusy) (void); // Retrieves the status of the busy line. 0: Not busy; 1: Busy 00117 void (* pfSetCS) (char OnOff); // Set chip select line. OnOff == 1 means peripheral selected 00118 // 00119 // Configuration (2) 00120 // 00121 unsigned Orientation; 00122 int xLog0; 00123 int xLog1; 00124 int xPhys0; 00125 int xPhys1; 00126 int yLog0; 00127 int yLog1; 00128 int yPhys0; 00129 int yPhys1; 00130 // 00131 // Optional, touch recognition via PENIRQ line (3) 00132 // 00133 char (* pfGetPENIRQ) (void); // Retrieves the status of the PENIRQ line to detect a touch event. 00134 // 00135 // Optional, touch recognition via touch pressure measurement (4) 00136 // 00137 int PressureMin; // Minimum pressure threshold. A measured pressure below this value means we do not have a valid touch event. 00138 int PressureMax; // Maximum pressure threshold. A measured pressure above this value means we do not have a valid touch event. 00139 int PlateResistanceX; // Resistance of the X-plate of the touch screen. This value is needed for calculation of the touch pressure. 00140 } GUITDRV_ADS7846_CONFIG; 00141 00142 typedef struct { 00143 int xPhys; // Last measured x value 00144 int yPhys; // Last measured y value 00145 int z1Phys; // Last measured z1 value 00146 int z2Phys; // Last measured z2 value 00147 int PENIRQ; // Last sampled PENIRQ state if PENIRQ callback has been set 00148 int Pressure; // Last measured touch pressure if touch pressure measurement is enabled 00149 } GUITDRV_ADS7846_LAST_VAL; 00150 00151 /********************************************************************* 00152 * 00153 * Prototypes 00154 * 00155 ********************************************************************** 00156 */ 00157 00158 void GUITDRV_ADS7846_Config (GUITDRV_ADS7846_CONFIG * pConfig); 00159 char GUITDRV_ADS7846_Exec (void); 00160 void GUITDRV_ADS7846_GetLastVal(GUITDRV_ADS7846_LAST_VAL * p); 00161 00162 #if defined(__cplusplus) 00163 } /* Make sure we have C-declarations in C++ programs */ 00164 #endif 00165 00166 00167 #endif /* GUITDRV_ADS7846_H */ 00168 00169 /*************************** End of file ****************************/
Generated on Wed Jul 20 2022 15:03:44 by
