lpc-field

Template project for programming NXP's LPC1768 MCUs
git clone git://git.mdnr.space/lpc-field
Log | Files | Refs | README | LICENSE

lpc17xx_exti.h (4535B)


      1 /**********************************************************************
      2 * $Id$		lpc17xx_exti.h				2010-05-21
      3 *//**
      4 * @file		lpc17xx_exti.h
      5 * @brief	Contains all macro definitions and function prototypes
      6 * 			support for External interrupt firmware library on LPC17xx
      7 * @version	2.0
      8 * @date		21. May. 2010
      9 * @author	NXP MCU SW Application Team
     10 *
     11 * Copyright(C) 2010, NXP Semiconductor
     12 * All rights reserved.
     13 *
     14 ***********************************************************************
     15 * Software that is described herein is for illustrative purposes only
     16 * which provides customers with programming information regarding the
     17 * products. This software is supplied "AS IS" without any warranties.
     18 * NXP Semiconductors assumes no responsibility or liability for the
     19 * use of the software, conveys no license or title under any patent,
     20 * copyright, or mask work right to the product. NXP Semiconductors
     21 * reserves the right to make changes in the software without
     22 * notification. NXP Semiconductors also make no representation or
     23 * warranty that such application will be suitable for the specified
     24 * use without further testing or modification.
     25 * Permission to use, copy, modify, and distribute this software and its
     26 * documentation is hereby granted, under NXP Semiconductors'
     27 * relevant copyright in the software, without fee, provided that it
     28 * is used in conjunction with NXP Semiconductors microcontrollers.  This
     29 * copyright, permission, and disclaimer notice must appear in all copies of
     30 * this code.
     31 **********************************************************************/
     32 
     33 /* Peripheral group ----------------------------------------------------------- */
     34 /** @defgroup EXTI EXTI (External Interrupt)
     35  * @ingroup LPC1700CMSIS_FwLib_Drivers
     36  * @{
     37  */
     38 
     39 #ifndef LPC17XX_EXTI_H_
     40 #define LPC17XX_EXTI_H_
     41 
     42 /* Includes ------------------------------------------------------------------- */
     43 #include "LPC17xx.h"
     44 #include "lpc_types.h"
     45 
     46 
     47 #ifdef __cplusplus
     48 extern "C"
     49 {
     50 #endif
     51 
     52 
     53 /* Private Macros ------------------------------------------------------------- */
     54 /** @defgroup EXTI_Private_Macros EXTI Private Macros
     55  * @{
     56  */
     57 /*********************************************************************//**
     58  * Macro defines for EXTI  control register
     59  **********************************************************************/
     60 #define EXTI_EINT0_BIT_MARK 	0x01
     61 #define EXTI_EINT1_BIT_MARK 	0x02
     62 #define EXTI_EINT2_BIT_MARK 	0x04
     63 #define EXTI_EINT3_BIT_MARK 	0x08
     64 
     65 /**
     66  * @}
     67  */
     68 
     69 /* Private Macros ------------------------------------------------------------- */
     70 /** @defgroup EXTI_Public_Types EXTI Public Types
     71  * @{
     72  */
     73 
     74 /**
     75  * @brief EXTI external interrupt line option
     76  */
     77 typedef enum
     78 {
     79 	EXTI_EINT0, /*!<  External interrupt 0, P2.10 */
     80 	EXTI_EINT1, /*!<  External interrupt 0, P2.11 */
     81 	EXTI_EINT2, /*!<  External interrupt 0, P2.12 */
     82 	EXTI_EINT3 	/*!<  External interrupt 0, P2.13 */
     83 } EXTI_LINE_ENUM;
     84 
     85 /**
     86  * @brief EXTI mode option
     87  */
     88 typedef enum
     89 {
     90 	EXTI_MODE_LEVEL_SENSITIVE, 	/*!< Level sensitivity is selected */
     91 	EXTI_MODE_EDGE_SENSITIVE  	/*!< Edge sensitivity is selected */
     92 } EXTI_MODE_ENUM;
     93 
     94 /**
     95  * @brief EXTI polarity option
     96  */
     97 typedef enum
     98 {
     99 	EXTI_POLARITY_LOW_ACTIVE_OR_FALLING_EDGE,	/*!< Low active or falling edge sensitive
    100 												depending on pin mode */
    101 	EXTI_POLARITY_HIGH_ACTIVE_OR_RISING_EDGE	/*!< High active or rising edge sensitive
    102 												depending on pin mode */
    103 } EXTI_POLARITY_ENUM;
    104 
    105 /**
    106  * @brief EXTI Initialize structure
    107  */
    108 typedef struct
    109 {
    110 	EXTI_LINE_ENUM EXTI_Line; /*!<Select external interrupt pin (EINT0, EINT1, EINT 2, EINT3) */
    111 
    112 	EXTI_MODE_ENUM EXTI_Mode; /*!< Choose between Level-sensitivity or Edge sensitivity */
    113 
    114 	EXTI_POLARITY_ENUM EXTI_polarity; /*!< 	If EXTI mode is level-sensitive: this element use to select low or high active level
    115 											if EXTI mode is polarity-sensitive: this element use to select falling or rising edge */
    116 
    117 }EXTI_InitTypeDef;
    118 
    119 
    120 /**
    121  * @}
    122  */
    123 
    124 
    125 /* Public Functions ----------------------------------------------------------- */
    126 /** @defgroup EXTI_Public_Functions EXTI Public Functions
    127  * @{
    128  */
    129 
    130 void EXTI_Init(void);
    131 void EXTI_DeInit(void);
    132 
    133 void EXTI_Config(EXTI_InitTypeDef *EXTICfg);
    134 void EXTI_SetMode(EXTI_LINE_ENUM EXTILine, EXTI_MODE_ENUM mode);
    135 void EXTI_SetPolarity(EXTI_LINE_ENUM EXTILine, EXTI_POLARITY_ENUM polarity);
    136 void EXTI_ClearEXTIFlag(EXTI_LINE_ENUM EXTILine);
    137 
    138 
    139 /**
    140  * @}
    141  */
    142 
    143 
    144 #ifdef __cplusplus
    145 }
    146 #endif
    147 
    148 
    149 #endif /* LPC17XX_EXTI_H_ */
    150 
    151 /**
    152  * @}
    153  */
    154 
    155 /* --------------------------------- End Of File ------------------------------ */