1 /******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
\r
2 * File Name : 75x_extit.c
\r
3 * Author : MCD Application Team
\r
4 * Date First Issued : 03/10/2006
\r
5 * Description : This file provides all the EXTIT software functions.
\r
6 ********************************************************************************
\r
10 ********************************************************************************
\r
11 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
\r
13 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
\r
14 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
\r
15 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
\r
16 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
17 *******************************************************************************/
\r
19 /* Includes ------------------------------------------------------------------*/
\r
20 #include "75x_extit.h"
\r
21 #include "75x_mrcc.h"
\r
23 /* Private typedef -----------------------------------------------------------*/
\r
24 /* Private define ------------------------------------------------------------*/
\r
25 /* Private macro -------------------------------------------------------------*/
\r
26 /* Private variables ---------------------------------------------------------*/
\r
27 /* Private function prototypes -----------------------------------------------*/
\r
28 /* Private functions ---------------------------------------------------------*/
\r
30 /*******************************************************************************
\r
31 * Function Name : EXTIT_DeInit
\r
32 * Description : Deinitializes the EXTIT peripheral registers to their default
\r
37 *******************************************************************************/
\r
38 void EXTIT_DeInit(void)
\r
40 MRCC_PeripheralSWResetConfig(MRCC_Peripheral_EXTIT,ENABLE);
\r
41 MRCC_PeripheralSWResetConfig(MRCC_Peripheral_EXTIT,DISABLE);
\r
44 /*******************************************************************************
\r
45 * Function Name : EXTIT_Init
\r
46 * Description : Initializes the EXTIT peripheral according to the specified
\r
47 * parameters in the EXTIT_InitStruct .
\r
48 * Input : - EXTIT_InitStruct: pointer to a EXTIT_InitTypeDef structure
\r
49 * that contains the configuration information for the EXTIT
\r
53 *******************************************************************************/
\r
54 void EXTIT_Init(EXTIT_InitTypeDef* EXTIT_InitStruct)
\r
56 if(EXTIT_InitStruct->EXTIT_ITLineCmd == ENABLE)
\r
58 /* Enable the selected external interrupts */
\r
59 EXTIT->MR |= EXTIT_InitStruct->EXTIT_ITLine;
\r
61 /* Select the trigger for the selected external interrupts */
\r
62 if(EXTIT_InitStruct->EXTIT_ITTrigger == EXTIT_ITTrigger_Falling)
\r
65 EXTIT->TSR &= ~EXTIT_InitStruct->EXTIT_ITLine;
\r
67 else if (EXTIT_InitStruct->EXTIT_ITTrigger == EXTIT_ITTrigger_Rising)
\r
70 EXTIT->TSR |= EXTIT_InitStruct->EXTIT_ITLine;
\r
73 else if(EXTIT_InitStruct->EXTIT_ITLineCmd == DISABLE)
\r
75 /* Disable the selected external interrupts */
\r
76 EXTIT->MR &= ~EXTIT_InitStruct->EXTIT_ITLine;
\r
80 /*******************************************************************************
\r
81 * Function Name : EXTIT_StructInit
\r
82 * Description : Fills each EXTIT_InitStruct member with its reset value.
\r
83 * Input : - EXTIT_InitStruct: pointer to a EXTIT_InitTypeDef structure
\r
84 * which will be initialized.
\r
87 *******************************************************************************/
\r
88 void EXTIT_StructInit(EXTIT_InitTypeDef* EXTIT_InitStruct)
\r
90 EXTIT_InitStruct->EXTIT_ITLine = EXTIT_ITLineNone;
\r
91 EXTIT_InitStruct->EXTIT_ITTrigger = EXTIT_ITTrigger_Falling;
\r
92 EXTIT_InitStruct->EXTIT_ITLineCmd = DISABLE;
\r
95 /*******************************************************************************
\r
96 * Function Name : EXTIT_GenerateSWInterrupt
\r
97 * Description : Generates a Software interrupt.
\r
98 * Input : - EXTIT_ITLine: specifies the EXTIT lines to be enabled or
\r
99 * disabled. This parameter can be:
\r
100 * - EXTIT_ITLinex: External interrupt line x where x(0..15)
\r
103 *******************************************************************************/
\r
104 void EXTIT_GenerateSWInterrupt(u16 EXTIT_ITLine)
\r
106 EXTIT->SWIR |= EXTIT_ITLine;
\r
109 /*******************************************************************************
\r
110 * Function Name : EXTIT_GetFlagStatus
\r
111 * Description : Checks whether the specified EXTIT line flag is set or not.
\r
112 * Input : - EXTIT_ITLine: specifies the EXTIT lines flag to check.
\r
113 * This parameter can be:
\r
114 * - EXTIT_ITLinex: External interrupt line x where x(0..15)
\r
116 * Return : The new state of EXTIT_ITLine (SET or RESET).
\r
117 *******************************************************************************/
\r
118 FlagStatus EXTIT_GetFlagStatus(u16 EXTIT_ITLine)
\r
120 if((EXTIT->PR & EXTIT_ITLine) != RESET)
\r
130 /*******************************************************************************
\r
131 * Function Name : EXTIT_ClearFlag
\r
132 * Description : Clears the EXTIT
\92s line pending flags.
\r
133 * Input : - EXTIT_ITLine: specifies the EXTIT lines flags to clear.
\r
134 * This parameter can be:
\r
135 * - EXTIT_ITLinex: External interrupt line x where x(0..15)
\r
138 *******************************************************************************/
\r
139 void EXTIT_ClearFlag(u16 EXTIT_ITLine)
\r
141 EXTIT->PR = EXTIT_ITLine;
\r
144 /*******************************************************************************
\r
145 * Function Name : EXTIT_GetITStatus
\r
146 * Description : Checks whether the specified EXTIT line is asserted or not.
\r
147 * Input : - EXTIT_ITLine: specifies the EXTIT lines to check.
\r
148 * This parameter can be:
\r
149 * - EXTIT_ITLinex: External interrupt line x where x(0..15)
\r
151 * Return : The new state of EXTIT_ITLine (SET or RESET).
\r
152 *******************************************************************************/
\r
153 ITStatus EXTIT_GetITStatus(u16 EXTIT_ITLine)
\r
155 if(((EXTIT->PR & EXTIT_ITLine) != RESET)&& ((EXTIT->MR & EXTIT_ITLine) != RESET))
\r
165 /*******************************************************************************
\r
166 * Function Name : EXTIT_ClearITPendingBit
\r
167 * Description : Clears the EXTIT
\92s line pending bits.
\r
168 * Input : - EXTIT_ITLine: specifies the EXTIT lines to clear.
\r
169 * This parameter can be:
\r
170 * - EXTIT_ITLinex: External interrupt line x where x(0..15)
\r
173 *******************************************************************************/
\r
174 void EXTIT_ClearITPendingBit(u16 EXTIT_ITLine)
\r
176 EXTIT->PR = EXTIT_ITLine;
\r
179 /******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
\r