Contiki 3.x
stm32l-spirit1-config.h
1 /*
2  * Copyright (c) 2012, STMicroelectronics.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *
30  */
31 /*----------------------------------------------------------------------------*/
32 /* Define to prevent recursive inclusion -------------------------------------*/
33 #ifndef __STM32L_SPIRIT1_CONFIG_H
34 #define __STM32L_SPIRIT1_CONFIG_H
35 
36 /* Includes ------------------------------------------------------------------*/
37 
38 /* Exported types ------------------------------------------------------------*/
39 /* Exported constants --------------------------------------------------------*/
40 
41 /* Define the STM32F10x hardware depending on the used evaluation board */
42 #ifdef USE_STM3210B_EVAL
43 #define USB_DISCONNECT GPIOD
44 #define USB_DISCONNECT_PIN GPIO_PIN_9
45 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD
46 #define EVAL_COM1_IRQHandler USART1_IRQHandler
47 
48 #elif defined(USE_STM3210E_EVAL)
49 #define USB_DISCONNECT GPIOB
50 #define USB_DISCONNECT_PIN GPIO_PIN_14
51 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB
52 #define EVAL_COM1_IRQHandler USART1_IRQHandler
53 
54 #elif defined(USE_STM3210C_EVAL)
55 #define USB_DISCONNECT 0
56 #define USB_DISCONNECT_PIN 0
57 #define RCC_APB2Periph_GPIO_DISCONNECT 0
58 #define EVAL_COM1_IRQHandler USART2_IRQHandler
59 
60 #elif defined(USE_STM32L152_EVAL) || defined(USE_STM32L152D_EVAL)
61 /*
62  For STM32L15xx devices it is possible to use the internal USB pullup
63  controlled by register SYSCFG_PMC (refer to RM0038 reference manual for
64  more details).
65  It is also possible to use external pullup (and disable the internal pullup)
66  by setting the define USB_USE_EXTERNAL_PULLUP in file platform_config.h
67  and configuring the right pin to be used for the external pull up configuration.
68  To have more details on how to use an external pull up, please refer to
69  STM3210E-EVAL evaluation board manuals.
70  */
71 /* Uncomment the following define to use an external pull up instead of the
72  integrated STM32L15xx internal pull up. In this case make sure to set up
73  correctly the external required hardware and the GPIO defines below.*/
74 /* #define USB_USE_EXTERNAL_PULLUP */
75 
76 #if !defined(USB_USE_EXTERNAL_PULLUP)
77 #define STM32L15_USB_CONNECT SYSCFG_USBPuCmd(ENABLE)
78 #define STM32L15_USB_DISCONNECT SYSCFG_USBPuCmd(DISABLE)
79 
80 #elif defined(USB_USE_EXTERNAL_PULLUP)
81 /* PA0 is chosen just as illustrating example, you should modify the defines
82  below according to your hardware configuration. */
83 #define USB_DISCONNECT GPIOA
84 #define USB_DISCONNECT_PIN GPIO_PIN_0
85 #define RCC_AHBPeriph_GPIO_DISCONNECT RCC_AHBPeriph_GPIOA
86 #define STM32L15_USB_CONNECT GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN)
87 #define STM32L15_USB_DISCONNECT GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN)
88 #endif /* USB_USE_EXTERNAL_PULLUP */
89 
90 #ifdef USE_STM32L152_EVAL
91 #define EVAL_COM1_IRQHandler USART2_IRQHandler
92 #elif defined(USE_STM32L152D_EVAL)
93 #define EVAL_COM1_IRQHandler USART1_IRQHandler
94 #endif /*USE_STM32L152_EVAL*/
95 
96 #endif /* USE_STM3210B_EVAL */
97 
98 /* Exported macro ------------------------------------------------------------*/
99 /* Exported functions ------------------------------------------------------- */
100 
101 #endif /* __STM32L_SPIRIT1_CONFIG_H */
102 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/