Now you can use NC as InterruptIn

Dependencies:   X_NUCLEO_COMMON

Fork of X_NUCLEO_6180XA1 by ST

Committer:
licio.mapelli@st.com
Date:
Tue Nov 17 17:15:47 2015 +0100
Revision:
33:1573db91352c
Added Switch class, added self contained Display class, added STMPE1600 component
and modified X_NUCLEO_6180XA1 class accordingly

Who changed what in which revision?

UserRevisionLine numberNew contents of line
licio.mapelli@st.com 33:1573db91352c 1 /**
licio.mapelli@st.com 33:1573db91352c 2 ******************************************************************************
licio.mapelli@st.com 33:1573db91352c 3 * @file Switch_class.h
licio.mapelli@st.com 33:1573db91352c 4 * @author AST / EST
licio.mapelli@st.com 33:1573db91352c 5 * @version V0.0.1
licio.mapelli@st.com 33:1573db91352c 6 * @date 14-April-2015
licio.mapelli@st.com 33:1573db91352c 7 * @brief Header file for red switch
licio.mapelli@st.com 33:1573db91352c 8 ******************************************************************************
licio.mapelli@st.com 33:1573db91352c 9 * @attention
licio.mapelli@st.com 33:1573db91352c 10 *
licio.mapelli@st.com 33:1573db91352c 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
licio.mapelli@st.com 33:1573db91352c 12 *
licio.mapelli@st.com 33:1573db91352c 13 * Redistribution and use in source and binary forms, with or without modification,
licio.mapelli@st.com 33:1573db91352c 14 * are permitted provided that the following conditions are met:
licio.mapelli@st.com 33:1573db91352c 15 * 1. Redistributions of source code must retain the above copyright notice,
licio.mapelli@st.com 33:1573db91352c 16 * this list of conditions and the following disclaimer.
licio.mapelli@st.com 33:1573db91352c 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
licio.mapelli@st.com 33:1573db91352c 18 * this list of conditions and the following disclaimer in the documentation
licio.mapelli@st.com 33:1573db91352c 19 * and/or other materials provided with the distribution.
licio.mapelli@st.com 33:1573db91352c 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
licio.mapelli@st.com 33:1573db91352c 21 * may be used to endorse or promote products derived from this software
licio.mapelli@st.com 33:1573db91352c 22 * without specific prior written permission.
licio.mapelli@st.com 33:1573db91352c 23 *
licio.mapelli@st.com 33:1573db91352c 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
licio.mapelli@st.com 33:1573db91352c 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
licio.mapelli@st.com 33:1573db91352c 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
licio.mapelli@st.com 33:1573db91352c 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
licio.mapelli@st.com 33:1573db91352c 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
licio.mapelli@st.com 33:1573db91352c 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
licio.mapelli@st.com 33:1573db91352c 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
licio.mapelli@st.com 33:1573db91352c 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
licio.mapelli@st.com 33:1573db91352c 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
licio.mapelli@st.com 33:1573db91352c 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
licio.mapelli@st.com 33:1573db91352c 34 *
licio.mapelli@st.com 33:1573db91352c 35 ******************************************************************************
licio.mapelli@st.com 33:1573db91352c 36 */
licio.mapelli@st.com 33:1573db91352c 37
licio.mapelli@st.com 33:1573db91352c 38 #ifndef __SWITCH_H
licio.mapelli@st.com 33:1573db91352c 39 #define __SWITCH_H
licio.mapelli@st.com 33:1573db91352c 40
licio.mapelli@st.com 33:1573db91352c 41 /* Includes ------------------------------------------------------------------*/
licio.mapelli@st.com 33:1573db91352c 42 #include "mbed.h"
licio.mapelli@st.com 33:1573db91352c 43 #include "stmpe1600_class.h"
licio.mapelli@st.com 33:1573db91352c 44
licio.mapelli@st.com 33:1573db91352c 45 #ifdef __cplusplus
licio.mapelli@st.com 33:1573db91352c 46 extern "C" {
licio.mapelli@st.com 33:1573db91352c 47 #endif
licio.mapelli@st.com 33:1573db91352c 48
licio.mapelli@st.com 33:1573db91352c 49 typedef enum {
licio.mapelli@st.com 33:1573db91352c 50 RANGE = 0,
licio.mapelli@st.com 33:1573db91352c 51 ALS
licio.mapelli@st.com 33:1573db91352c 52 }SwitchState;
licio.mapelli@st.com 33:1573db91352c 53
licio.mapelli@st.com 33:1573db91352c 54 /* Classes -------------------------------------------------------------------*/
licio.mapelli@st.com 33:1573db91352c 55 /** Class representing Red Switch
licio.mapelli@st.com 33:1573db91352c 56 */
licio.mapelli@st.com 33:1573db91352c 57
licio.mapelli@st.com 33:1573db91352c 58 class SWITCH
licio.mapelli@st.com 33:1573db91352c 59 {
licio.mapelli@st.com 33:1573db91352c 60 public:
licio.mapelli@st.com 33:1573db91352c 61 SWITCH(STMPE1600 &stmpe_1600, ExpGpioPinName Pin_Name=GPIO_11) : stmpe1600(stmpe_1600), PinName(Pin_Name) {
licio.mapelli@st.com 33:1573db91352c 62 stmpe1600.setGPIOdir(PinName, INPUT);
licio.mapelli@st.com 33:1573db91352c 63 }
licio.mapelli@st.com 33:1573db91352c 64
licio.mapelli@st.com 33:1573db91352c 65 bool RdSwitch () {
licio.mapelli@st.com 33:1573db91352c 66 return stmpe1600.rdGPIO(PinName);
licio.mapelli@st.com 33:1573db91352c 67 }
licio.mapelli@st.com 33:1573db91352c 68
licio.mapelli@st.com 33:1573db91352c 69 operator int()
licio.mapelli@st.com 33:1573db91352c 70 {
licio.mapelli@st.com 33:1573db91352c 71 return RdSwitch();
licio.mapelli@st.com 33:1573db91352c 72 }
licio.mapelli@st.com 33:1573db91352c 73
licio.mapelli@st.com 33:1573db91352c 74 private:
licio.mapelli@st.com 33:1573db91352c 75 STMPE1600 &stmpe1600;
licio.mapelli@st.com 33:1573db91352c 76 ExpGpioPinName PinName;
licio.mapelli@st.com 33:1573db91352c 77 };
licio.mapelli@st.com 33:1573db91352c 78
licio.mapelli@st.com 33:1573db91352c 79 #ifdef __cplusplus
licio.mapelli@st.com 33:1573db91352c 80 }
licio.mapelli@st.com 33:1573db91352c 81 #endif
licio.mapelli@st.com 33:1573db91352c 82 #endif // __SWITCH_H