2c

Fork of TS_DISCO_F429ZI by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TS_DISCO_F429ZI.h Source File

TS_DISCO_F429ZI.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_F429ZI_H
00020 #define __TS_DISCO_F429ZI_H
00021 
00022 #ifdef TARGET_DISCO_F429ZI
00023 
00024 #include "mbed.h"
00025 #include "stm32f429i_discovery_ts.h"
00026 
00027 /*
00028   This class drives the touch screen module of the LCD display
00029   present on DISCO_F429ZI board.
00030 
00031   Usage:
00032 
00033   #include "mbed.h"
00034   #include "TS_DISCO_F429ZI.h"
00035 
00036   TS_DISCO_F429ZI 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_F429ZI
00061 {
00062   
00063 public:
00064   //! Constructor
00065   TS_DISCO_F429ZI();
00066 
00067   //! Destructor
00068   ~TS_DISCO_F429ZI();
00069 
00070   /**
00071     * @brief  Initializes and configures the touch screen functionalities and 
00072     *         configures all necessary hardware resources (GPIOs, clocks..);.
00073     * @param  XSize: The maximum X size of the TS area on LCD
00074     * @param  YSize: The 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 XSize, uint16_t YSize);
00078 
00079   /**
00080     * @brief  Configures and enables the touch screen interrupts.
00081     * @param  None
00082     * @retval TS_OK: if ITconfig is OK. Other value if error.
00083     */
00084   uint8_t ITConfig(void);
00085 
00086   /**
00087     * @brief  Gets the TS IT status.
00088     * @param  None
00089     * @retval Interrupt status.
00090     */  
00091   uint8_t ITGetStatus(void);
00092 
00093   /**
00094     * @brief  Returns status and positions of the touch screen.
00095     * @param  TsState: Pointer to touch screen current state structure
00096     * @retval None.
00097     */
00098   void GetState(TS_StateTypeDef* TsState);
00099 
00100   /**
00101     * @brief  Clears all touch screen interrupts.
00102     * @param  None
00103     * @retval None
00104     */  
00105   void ITClear(void);
00106   
00107 private:
00108 
00109 };
00110 
00111 #else
00112 #error "This class must be used with DISCO_F429ZI board only."
00113 #endif // TARGET_DISCO_F429ZI
00114 
00115 #endif