only for STM32F769NI-DISCOVERY

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TS_DISCO_F769NI.h Source File

TS_DISCO_F769NI.h

00001 /* Copyright (c) 2010-2011 mbed.org, MIT License
00002 *
00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00004 * and associated documentation files (the "Software"), to deal in the Software without
00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
00007 * Software is furnished to do so, subject to the following conditions:
00008 *
00009 * The above copyright notice and this permission notice shall be included in all copies or
00010 * substantial portions of the Software.
00011 *
00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017 */
00018 
00019 #ifndef __TS_DISCO_F769NI_H
00020 #define __TS_DISCO_F769NI_H
00021 
00022 #ifdef TARGET_DISCO_F769NI
00023 
00024 #include "mbed.h"
00025 #include "stm32f769i_discovery_ts.h"
00026 
00027 /*
00028   This class drives the touch screen module ( device) of the LCD display
00029   present on DISCO_F769NI board.
00030 
00031   Usage:
00032 
00033   #include "mbed.h"
00034   #include "TS_DISCO_F769NI.h"
00035 
00036   TS_DISCO_F769NI ts;
00037 
00038   DigitalOut led1(LED1);
00039 
00040   int main()
00041   {
00042       TS_StateTypeDef TS_State;
00043     
00044       ts.Init(420, 272);
00045     
00046       while(1)
00047       {
00048         ts.GetState(&TS_State);
00049         if ((TS_State.touchDetected) && (TS_State.touchX[0] > 240))
00050         {
00051           led1 = 1;
00052         }
00053         else
00054         {
00055           led1 = 0;
00056         }
00057       }
00058   }
00059 */
00060 class TS_DISCO_F769NI
00061 {
00062   
00063 public:
00064   //! Constructor
00065   TS_DISCO_F769NI();
00066 
00067   //! Destructor
00068   ~TS_DISCO_F769NI();
00069 
00070   /**
00071     * @brief  Initializes and configures the touch screen functionalities and
00072     *         configures all necessary hardware resources (GPIOs, I2C, clocks..);.
00073     * @param  ts_SizeX : Maximum X size of the TS area on LCD
00074     * @param  ts_SizeY : Maximum Y size of the TS area on LCD
00075     * @retval TS_OK if all initializations are OK. Other value if error.
00076     */
00077   uint8_t Init(uint16_t ts_SizeX, uint16_t ts_SizeY);
00078 
00079   /**
00080     * @brief  Configures and enables the touch screen interrupts both at GPIO level and
00081     * in TouchScreen IC driver configuration.
00082     * @retval TS_OK if all initializations are OK.
00083     */
00084   uint8_t ITConfig(void);
00085 
00086   /**
00087     * @brief  Returns status and positions of the touch screen.
00088     * @param  TS_State: Pointer to touch screen current state structure
00089     * @retval TS_OK if all initializations are OK. Other value if error.
00090     */
00091   uint8_t GetState(TS_StateTypeDef *TS_State);
00092 
00093 #if (TS_MULTI_TOUCH_SUPPORTED == 1)
00094 
00095   /**
00096     * @brief  Update gesture Id following a touch detected.
00097     * @param  TS_State: Pointer to touch screen current state structure
00098     * @retval TS_OK if all initializations are OK. Other value if error.
00099     */
00100   uint8_t Get_GestureId(TS_StateTypeDef *TS_State);
00101 
00102   /**
00103     * @brief  Function used to reset all touch data before a new acquisition
00104     *         of touch information.
00105     * @param  TS_State: Pointer to touch screen current state structure
00106     * @retval TS_OK if OK, TE_ERROR if problem found.
00107     */
00108   uint8_t ResetTouchData(TS_StateTypeDef *TS_State);
00109 
00110 #endif // (TS_MULTI_TOUCH_SUPPORTED == 1)
00111 
00112 private:
00113 
00114 };
00115 
00116 #else
00117 #error "This class must be used with DISCO_F769NI board only."
00118 #endif // TARGET_DISCO_F769NI
00119 
00120 #endif