[add] libstm32l_discovery from ST packages. build directory contains the necessary...
[fw/stlink] / example / libstm32l_discovery / src / stm32l1xx_syscfg.c
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32l1xx_syscfg.c\r
4   * @author  MCD Application Team\r
5   * @version V1.0.0\r
6   * @date    31-December-2010\r
7   * @brief   This file provides firmware functions to manage the following \r
8   *          functionalities of the SYSCFG and RI peripherals:           \r
9   *           - SYSCFG Initialization and Configuration\r
10   *           - RI Initialization and Configuration\r
11   *\r
12   *  @verbatim\r
13   *  \r
14   *          ===================================================================\r
15   *                                 How to use this driver\r
16   *          ===================================================================\r
17   *                  \r
18   *          This driver provides functions for:\r
19   *          \r
20   *          1. Remapping the memory accessible in the code area using\r
21   *             SYSCFG_MemoryRemapConfig()  \r
22   *          2. Manage the EXTI lines connection to the GPIOs using\r
23   *             SYSCFG_EXTILineConfig().\r
24   *          3. Routing of I/Os toward the input captures of timers (TIM2, TIM3 and TIM4).\r
25   *          4. Input routing of COMP1 and COMP2\r
26   *          5. Routing of internal reference voltage VREFINT to PB0 and PB1.\r
27   *\r
28   *          6. The RI registers can be accessed only when the comparator \r
29   *             APB interface clock is enabled.\r
30   *             To enable comparator clock use:\r
31   *             RCC_APB1PeriphClockCmd(RCC_APB1Periph_COMP, ENABLE);\r
32   *\r
33   *             Following functions uses RI registers:\r
34   *                   - SYSCFG_RIDeInit()\r
35   *                   - SYSCFG_RITIMSelect()\r
36   *                   - SYSCFG_RITIMInputCaptureConfig()\r
37   *                   - SYSCFG_RIResistorConfig()\r
38   *                   - SYSCFG_RIIOSwitchConfig()\r
39   *                   - SYSCFG_RISwitchControlModeCmd()\r
40   *                   - SYSCFG_RIHysteresisConfig()\r
41   *\r
42   *          7- The SYSCFG registers can be accessed only when the SYSCFG \r
43   *             interface APB clock is enabled.\r
44   *             To enable SYSCFG APB clock use:\r
45   *             RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);\r
46   *\r
47   *             Following functions uses SYSCFG registers:\r
48   *                   - SYSCFG_MemoryRemapConfig()\r
49   *                   - SYSCFG_USBPuCmd()\r
50   *                   - SYSCFG_EXTILineConfig()\r
51   *                 \r
52   *  @endverbatim\r
53   *      \r
54   ******************************************************************************\r
55   * @attention\r
56   *\r
57   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
58   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
59   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
60   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
61   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
62   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
63   *\r
64   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
65   ******************************************************************************  \r
66   */ \r
67 \r
68 /* Includes ------------------------------------------------------------------*/\r
69 #include "stm32l1xx_syscfg.h"\r
70 #include "stm32l1xx_rcc.h"\r
71 \r
72 /** @addtogroup STM32L1xx_StdPeriph_Driver\r
73   * @{\r
74   */\r
75 \r
76 /** @defgroup SYSCFG \r
77   * @brief SYSCFG driver modules\r
78   * @{\r
79   */ \r
80 \r
81 /* Private typedef -----------------------------------------------------------*/\r
82 /* Private define ------------------------------------------------------------*/\r
83 #define TIM_SELECT_MASK             ((uint32_t)0xFFFCFFFF) /*!< TIM select mask */\r
84 #define IC_ROUTING_MASK             ((uint32_t)0x0000000F) /*!< Input Capture routing mask */\r
85 \r
86 /* Private macro -------------------------------------------------------------*/\r
87 /* Private variables ---------------------------------------------------------*/\r
88 /* Private function prototypes -----------------------------------------------*/\r
89 /* Private functions ---------------------------------------------------------*/\r
90 \r
91 /** @defgroup SYSCFG_Private_Functions\r
92   * @{\r
93   */ \r
94 \r
95 /** @defgroup SYSCFG_Group1 SYSCFG Initialization and Configuration functions\r
96  *  @brief   SYSCFG Initialization and Configuration functions \r
97  *\r
98 @verbatim   \r
99  ===============================================================================\r
100              SYSCFG Initialization and Configuration functions\r
101  ===============================================================================  \r
102 \r
103 @endverbatim\r
104   * @{\r
105   */\r
106 \r
107 /**\r
108   * @brief  Deinitializes the SYSCFG registers to their default reset values.\r
109   * @param  None\r
110   * @retval None\r
111   * @ Note: MEMRMP bits are not reset by APB2 reset.\r
112   */\r
113 void SYSCFG_DeInit(void)\r
114 {\r
115    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE);\r
116    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, DISABLE);\r
117 }\r
118 \r
119 /**\r
120   * @brief Deinitializes the RI registers to their default reset values.\r
121   * @param  None\r
122   * @retval None\r
123   */\r
124 void SYSCFG_RIDeInit(void)\r
125 {\r
126   RI->ICR     = ((uint32_t)0x00000000);    /*!< Set RI->ICR to reset value */\r
127   RI->ASCR1   = ((uint32_t)0x00000000);    /*!< Set RI->ASCR1 to reset value */  \r
128   RI->ASCR2   = ((uint32_t)0x00000000);    /*!< Set RI->ASCR2 to reset value */  \r
129   RI->HYSCR1  = ((uint32_t)0x00000000);    /*!< Set RI->HYSCR1 to reset value */\r
130   RI->HYSCR2  = ((uint32_t)0x00000000);    /*!< Set RI->HYSCR2 to reset value */\r
131   RI->HYSCR3  = ((uint32_t)0x00000000);    /*!< Set RI->HYSCR3 to reset value */\r
132 }\r
133 \r
134 /**\r
135   * @brief  Changes the mapping of the specified memory.\r
136   * @param  SYSCFG_Memory: selects the memory remapping.\r
137   *   This parameter can be one of the following values:\r
138   *     @arg SYSCFG_MemoryRemap_Flash:       Main Flash memory mapped at 0x00000000  \r
139   *     @arg SYSCFG_MemoryRemap_SystemFlash: System Flash memory mapped at 0x00000000\r
140   *     @arg SYSCFG_MemoryRemap_SRAM:        Embedded SRAM mapped at 0x00000000     \r
141   * @retval None\r
142   */\r
143 void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap)\r
144 {\r
145   /* Check the parameters */\r
146   assert_param(IS_SYSCFG_MEMORY_REMAP_CONFING(SYSCFG_MemoryRemap));\r
147   SYSCFG->MEMRMP = SYSCFG_MemoryRemap;\r
148 }\r
149 \r
150 /**\r
151   * @brief  Control the internal pull-up on USB DP line.\r
152   * @param  NewState: New state of the internal pull-up on USB DP line. \r
153   *   This parameter can be ENABLE: Connect internal pull-up on USB DP line.\r
154   *                      or DISABLE: Disconnect internal pull-up on USB DP line.\r
155   * @retval None\r
156   */\r
157 void SYSCFG_USBPuCmd(FunctionalState NewState)\r
158 {\r
159   /* Check the parameters */\r
160   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
161 \r
162   if (NewState != DISABLE)\r
163   { \r
164     /* Connect internal pull-up on USB DP line */\r
165     SYSCFG->PMC |= (uint32_t) SYSCFG_PMC_USB_PU;\r
166   }\r
167   else\r
168   {\r
169     /* Disconnect internal pull-up on USB DP line */\r
170     SYSCFG->PMC &= (uint32_t)(~SYSCFG_PMC_USB_PU);\r
171   }\r
172 }\r
173 \r
174 /**\r
175   * @brief  Selects the GPIO pin used as EXTI Line.\r
176   * @param  EXTI_PortSourceGPIOx : selects the GPIO port to be used as source \r
177   *                                for EXTI lines where x can be (A, B, C, D, E or H).\r
178   * @param  EXTI_PinSourcex: specifies the EXTI line to be configured.\r
179   *         This parameter can be EXTI_PinSourcex where x can be (0..15)\r
180   * @retval None\r
181   */\r
182 void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex)\r
183 {\r
184   uint32_t tmp = 0x00;\r
185 \r
186   /* Check the parameters */\r
187   assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx));\r
188   assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex));\r
189   \r
190   tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03));\r
191   SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp;\r
192   SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)));\r
193 }\r
194 \r
195 /**\r
196   * @}\r
197   */\r
198 \r
199 /** @defgroup SYSCFG_Group2 RI Initialization and Configuration functions\r
200  *  @brief   RI Initialization and Configuration functions\r
201  *\r
202 @verbatim   \r
203  ===============================================================================\r
204                RI Initialization and Configuration functions\r
205  ===============================================================================  \r
206 \r
207 @endverbatim\r
208   * @{\r
209   */\r
210 \r
211 /**\r
212   * @brief  Configures the routing interface to select which Timer to be routed.\r
213   * @note   Routing capability can be applied only on one of the three timers\r
214   *         (TIM2, TIM3 or TIM4) at a time.\r
215   * @param  TIM_Select: Timer select.\r
216   *   This parameter can be one of the following values:\r
217   *     @arg TIM_Select_None: No timer selected and default Timer mapping is enabled.\r
218   *     @arg TIM_Select_TIM2: Timer 2 Input Captures to be routed.\r
219   *     @arg TIM_Select_TIM3: Timer 3 Input Captures to be routed.\r
220   *     @arg TIM_Select_TIM4: Timer 4 Input Captures to be routed.\r
221   * @retval None.\r
222   */\r
223 void SYSCFG_RITIMSelect(uint32_t TIM_Select)\r
224 {\r
225   uint32_t tmpreg = 0;\r
226 \r
227   /* Check the parameters */\r
228   assert_param(IS_RI_TIM(TIM_Select));\r
229 \r
230   /* Get the old register value */\r
231   tmpreg = RI->ICR;\r
232 \r
233   /* Clear the TIMx select bits */\r
234   tmpreg &= TIM_SELECT_MASK;\r
235 \r
236   /* Select the Timer */\r
237   tmpreg |= (TIM_Select);\r
238 \r
239   /* Write to RI->ICR register */\r
240   RI->ICR = tmpreg;\r
241 }\r
242 \r
243 /**\r
244   * @brief  Configures the routing interface to map Input Capture 1, 2, 3 or 4\r
245   *         to a selected I/O pin.\r
246   * @param  RI_InputCapture selects which input capture to be routed.\r
247   *   This parameter can be one (or combination) of the following parameters:\r
248   *     @arg  RI_InputCapture_IC1: Input capture 1 is selected.\r
249   *     @arg  RI_InputCapture_IC2: Input capture 2 is selected.\r
250   *     @arg  RI_InputCapture_IC3: Input capture 3 is selected.\r
251   *     @arg  RI_InputCapture_IC4: Input capture 4 is selected.\r
252   * @param  RI_InputCaptureRouting: selects which pin to be routed to Input Capture.\r
253   *   This parameter can be one of the following values:\r
254   *     @arg  RI_InputCaptureRouting_0 to RI_InputCaptureRouting_15\r
255   *     e.g.\r
256   *       SYSCFG_RITIMSelect(TIM_Select_TIM2)\r
257   *       SYSCFG_RITIMInputCaptureConfig(RI_InputCapture_IC1, RI_InputCaptureRouting_1)\r
258   *       allows routing of Input capture IC1 of TIM2 to PA4.\r
259   *       For details about correspondence between RI_InputCaptureRouting_x \r
260   *       and I/O pins refer to the parameters' description in the header file\r
261   *       or refer to the product reference manual.\r
262   * @note Input capture selection bits are not reset by this function.\r
263   *       To reset input capture selection bits, use SYSCFG_RIDeInit() function.\r
264   * @note The I/O should be configured in alternate function mode (AF14) using\r
265   *       GPIO_PinAFConfig() function.\r
266   * @retval None.\r
267   */\r
268 void SYSCFG_RITIMInputCaptureConfig(uint32_t RI_InputCapture, uint32_t RI_InputCaptureRouting)\r
269 {\r
270   uint32_t tmpreg = 0;\r
271 \r
272   /* Check the parameters */\r
273   assert_param(IS_RI_INPUTCAPTURE(RI_InputCapture));\r
274   assert_param(IS_RI_INPUTCAPTURE_ROUTING(RI_InputCaptureRouting));\r
275 \r
276   /* Get the old register value */\r
277   tmpreg = RI->ICR;\r
278 \r
279   /* Select input captures to be routed */\r
280   tmpreg |= (RI_InputCapture);\r
281 \r
282   if((RI_InputCapture & RI_InputCapture_IC1) == RI_InputCapture_IC1)\r
283   {\r
284     /* Clear the input capture select bits */\r
285     tmpreg &= (uint32_t)(~IC_ROUTING_MASK);\r
286 \r
287     /* Set RI_InputCaptureRouting bits  */\r
288     tmpreg |= (uint32_t)( RI_InputCaptureRouting);\r
289   }\r
290 \r
291   if((RI_InputCapture & RI_InputCapture_IC2) == RI_InputCapture_IC2)\r
292   {\r
293     /* Clear the input capture select bits */\r
294     tmpreg &= (uint32_t)(~(IC_ROUTING_MASK << 4));\r
295 \r
296     /* Set RI_InputCaptureRouting bits  */\r
297     tmpreg |= (uint32_t)( (RI_InputCaptureRouting << 4)); \r
298   }\r
299 \r
300   if((RI_InputCapture & RI_InputCapture_IC3) == RI_InputCapture_IC3)\r
301   {\r
302     /* Clear the input capture select bits */\r
303     tmpreg &= (uint32_t)(~(IC_ROUTING_MASK << 8));\r
304 \r
305     /* Set RI_InputCaptureRouting bits  */\r
306     tmpreg |= (uint32_t)( (RI_InputCaptureRouting << 8));  \r
307   }\r
308 \r
309   if((RI_InputCapture & RI_InputCapture_IC4) == RI_InputCapture_IC4)\r
310   {\r
311     /* Clear the input capture select bits */\r
312     tmpreg &= (uint32_t)(~(IC_ROUTING_MASK << 12));\r
313 \r
314     /* Set RI_InputCaptureRouting bits  */\r
315     tmpreg |= (uint32_t)( (RI_InputCaptureRouting << 12));  \r
316   }\r
317 \r
318   /* Write to RI->ICR register */\r
319   RI->ICR = tmpreg;\r
320 }\r
321 /**\r
322   * @brief  Configures the Pull-up and Pull-down Resistors \r
323   * @param  RI_Resistor selects the resistor to connect. \r
324   *   This parameter can be  one of the following values:\r
325   *     @arg RI_Resistor_10KPU: 10K pull-up resistor\r
326   *     @arg RI_Resistor_400KPU: 400K pull-up resistor \r
327   *     @arg RI_Resistor_10KPD: 10K pull-down resistor \r
328   *     @arg RI_Resistor_400KPD: 400K pull-down resistor\r
329   * @param  NewState: New state of the analog switch associated to the selected \r
330   *         resistor.\r
331   *   This parameter can be:\r
332   *      ENABLE so the selected resistor is connected\r
333   *      or DISABLE so the selected resistor is disconnected\r
334   * @note To avoid extra power consumption, only one resistor should be enabled\r
335   *       at a time.  \r
336   * @retval None\r
337   */\r
338 void SYSCFG_RIResistorConfig(uint32_t RI_Resistor, FunctionalState NewState)\r
339 {\r
340   /* Check the parameters */\r
341   assert_param(IS_RI_RESISTOR(RI_Resistor));\r
342   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
343   \r
344   if (NewState != DISABLE)\r
345   {\r
346     /* Enable the resistor */\r
347     COMP->CSR |= (uint32_t) RI_Resistor;\r
348   }\r
349   else\r
350   {\r
351     /* Disable the Resistor */\r
352     COMP->CSR &= (uint32_t) (~RI_Resistor);\r
353   }\r
354 }\r
355 \r
356 /**\r
357   * @brief  Close or Open the routing interface Input Output switches.\r
358   * @param  RI_IOSwitch: selects the I/O analog switch number.\r
359   *   This parameter can be one of the following values:\r
360   *     @arg RI_IOSwitch_CH0 --> RI_IOSwitch_CH15\r
361   *     @arg RI_IOSwitch_CH18 --> RI_IOSwitch_CH25\r
362   *     @arg RI_IOSwitch_GR10_1 --> RI_IOSwitch_GR10_4\r
363   *     @arg RI_IOSwitch_GR6_1 --> RI_IOSwitch_GR6_2\r
364   *     @arg RI_IOSwitch_GR5_1 --> RI_IOSwitch_GR5_3\r
365   *     @arg RI_IOSwitch_GR4_1 --> RI_IOSwitch_GR4_3\r
366   *     @arg RI_IOSwitch_VCOMP\r
367   * @param  NewState: New state of the analog switch. \r
368   *   This parameter can be \r
369   *     ENABLE so the Input Output switch is closed\r
370   *     or DISABLE so the Input Output switch is open\r
371   * @retval None\r
372   */\r
373 void SYSCFG_RIIOSwitchConfig(uint32_t RI_IOSwitch, FunctionalState NewState)\r
374 {\r
375   uint32_t ioswitchmask = 0;\r
376   \r
377   /* Check the parameters */\r
378   assert_param(IS_RI_IOSWITCH(RI_IOSwitch));\r
379   \r
380   /* Read Analog switch register index */\r
381   ioswitchmask = RI_IOSwitch >> 31;\r
382   \r
383   /* Get Bits[30:0] of the IO switch */\r
384   RI_IOSwitch  &= 0x7FFFFFFF;\r
385   \r
386   \r
387   if (NewState != DISABLE)\r
388   { \r
389     if (ioswitchmask != 0)\r
390     {\r
391       /* Close the analog switches */\r
392       RI->ASCR1 |= RI_IOSwitch;\r
393     }\r
394     else\r
395     {\r
396       /* Open the analog switches */\r
397       RI->ASCR2 |= RI_IOSwitch;\r
398     }\r
399   }\r
400   else\r
401   {\r
402     if (ioswitchmask != 0)\r
403     {\r
404       /* Close the analog switches */\r
405       RI->ASCR1 &= (~ (uint32_t)RI_IOSwitch);\r
406     }\r
407     else\r
408     {\r
409       /* Open the analog switches */\r
410       RI->ASCR2 &= (~ (uint32_t)RI_IOSwitch);\r
411     }\r
412   }\r
413 }\r
414 \r
415 /**\r
416   * @brief  Enable or disable the switch control mode.\r
417   * @param  NewState: New state of the switch control mode. This parameter can\r
418   *         be ENABLE: ADC analog switches closed if the corresponding \r
419   *                    I/O switch is also closed.\r
420   *                    When using COMP1 switch control mode must be enabled.\r
421   *         or DISABLE: ADC analog switches open or controlled by the ADC interface.\r
422   *                    When using the ADC for acquisition switch control mode \r
423   *                    must be disabled.\r
424   * @note COMP1 comparator and ADC cannot be used at the same time since \r
425   *       they share the ADC switch matrix.\r
426   * @retval None\r
427   */\r
428 void SYSCFG_RISwitchControlModeCmd(FunctionalState NewState)\r
429 {\r
430   /* Check the parameters */\r
431   assert_param(IS_FUNCTIONAL_STATE(NewState));  \r
432   \r
433   if (NewState != DISABLE)\r
434   { \r
435     /* Enable the Switch control mode */  \r
436     RI->ASCR1 |= (uint32_t) RI_ASCR1_SCM;\r
437   }\r
438   else\r
439   {\r
440     /* Disable the Switch control mode */  \r
441     RI->ASCR1 &= (uint32_t)(~RI_ASCR1_SCM);\r
442   }\r
443 }\r
444 \r
445 /**\r
446   * @brief  Enable or disable Hysteresis of the input schmitt triger of Ports A..E\r
447   *         When the I/Os are programmed in input mode by standard I/O port \r
448   *         registers, the Schmitt trigger and the hysteresis are enabled by default. \r
449   *         When hysteresis is disabled, it is possible to read the \r
450   *         corresponding port with a trigger level of VDDIO/2.   \r
451   * @param  RI_Port: selects the GPIO Port.\r
452   *   This parameter can be one of the following values:\r
453   *     @arg RI_PortA : Port A is selected\r
454   *     @arg RI_PortB : Port B is selected\r
455   *     @arg RI_PortC : Port C is selected\r
456   *     @arg RI_PortD : Port D is selected\r
457   *     @arg RI_PortE : Port E is selected\r
458   *  @param RI_Pin : Selects the pin(s) on which to enable or disable hysteresis.\r
459   *    This parameter can any value from RI_Pin_x where x can be (0..15) or RI_Pin_All.\r
460   *  @param  NewState new state of the Hysteresis.\r
461   *   This parameter can be:\r
462   *      ENABLE so the Hysteresis is on\r
463   *      or DISABLE so the Hysteresis is off\r
464   * @retval None\r
465   */\r
466 void SYSCFG_RIHysteresisConfig(uint8_t RI_Port, uint16_t RI_Pin,\r
467                              FunctionalState NewState)\r
468 {\r
469   /* Check the parameters */\r
470   assert_param(IS_RI_PORT(RI_Port));\r
471   assert_param(IS_RI_PIN(RI_Pin));\r
472   assert_param(IS_FUNCTIONAL_STATE(NewState));\r
473   \r
474   if(RI_Port == RI_PortA)\r
475   {  \r
476     if (NewState != DISABLE)\r
477     {\r
478       /* Hysteresis on */\r
479       RI->HYSCR1 &= (uint32_t)~((uint32_t)RI_Pin);\r
480     }\r
481     else\r
482     {\r
483       /* Hysteresis off */\r
484       RI->HYSCR1 |= (uint32_t) RI_Pin;\r
485     }\r
486   }\r
487   \r
488   else if(RI_Port == RI_PortB)\r
489   {\r
490   \r
491     if (NewState != DISABLE)\r
492     {\r
493       /* Hysteresis on */\r
494       RI->HYSCR1 &= (uint32_t) (~((uint32_t)RI_Pin) << 16);\r
495     }\r
496     else\r
497     {\r
498       /* Hysteresis off */\r
499       RI->HYSCR1 |= (uint32_t) ((uint32_t)(RI_Pin) << 16);\r
500     }\r
501   }  \r
502  \r
503   else if(RI_Port == RI_PortC)\r
504   {\r
505   \r
506     if (NewState != DISABLE)\r
507     {\r
508       /* Hysteresis on */\r
509       RI->HYSCR2 &= (uint32_t) (~((uint32_t)RI_Pin));\r
510     }\r
511     else\r
512     {\r
513       /* Hysteresis off */\r
514       RI->HYSCR2 |= (uint32_t) (RI_Pin );\r
515     }\r
516   } \r
517   else if(RI_Port == RI_PortD)\r
518   {\r
519     if (NewState != DISABLE)\r
520     {\r
521       /* Hysteresis on */\r
522       RI->HYSCR2 &= (uint32_t) (~((uint32_t)RI_Pin) << 16);\r
523     }\r
524     else\r
525     {\r
526       /* Hysteresis off */\r
527       RI->HYSCR2 |= (uint32_t) ((uint32_t)(RI_Pin) << 16);\r
528 \r
529     }\r
530   }   \r
531   else /* RI_Port == RI_PortE */\r
532   {\r
533     if (NewState != DISABLE)\r
534     {\r
535       /* Hysteresis on */\r
536       RI->HYSCR3 &= (uint32_t) (~((uint32_t)RI_Pin));\r
537     }\r
538     else\r
539     {\r
540       /* Hysteresis off */\r
541       RI->HYSCR3 |= (uint32_t) (RI_Pin );\r
542     }\r
543   }   \r
544 }\r
545 \r
546 /**\r
547   * @}\r
548   */\r
549 \r
550 /**\r
551   * @}\r
552   */ \r
553 \r
554 /**\r
555   * @}\r
556   */ \r
557 \r
558 /**\r
559   * @}\r
560   */ \r
561 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/   \r