1 |
582 |
jeremybenn |
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
|
2 |
|
|
* File Name : stm32f10x_lib.c
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 09/29/2006
|
5 |
|
|
* Description : This file provides all peripherals pointers initialization.
|
6 |
|
|
********************************************************************************
|
7 |
|
|
* History:
|
8 |
|
|
* 04/02/2007: V0.2
|
9 |
|
|
* 02/05/2007: V0.1
|
10 |
|
|
* 09/29/2006: V0.01
|
11 |
|
|
********************************************************************************
|
12 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
13 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
14 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
15 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
16 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
17 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
18 |
|
|
*******************************************************************************/
|
19 |
|
|
|
20 |
|
|
#define EXT
|
21 |
|
|
|
22 |
|
|
/* Includes ------------------------------------------------------------------*/
|
23 |
|
|
#include "stm32f10x_lib.h"
|
24 |
|
|
|
25 |
|
|
/* Private typedef -----------------------------------------------------------*/
|
26 |
|
|
/* Private define ------------------------------------------------------------*/
|
27 |
|
|
/* Private macro -------------------------------------------------------------*/
|
28 |
|
|
/* Private variables ---------------------------------------------------------*/
|
29 |
|
|
/* Private function prototypes -----------------------------------------------*/
|
30 |
|
|
/* Private functions ---------------------------------------------------------*/
|
31 |
|
|
|
32 |
|
|
#ifdef DEBUG
|
33 |
|
|
/*******************************************************************************
|
34 |
|
|
* Function Name : debug
|
35 |
|
|
* Description : This function initialize peripherals pointers.
|
36 |
|
|
* Input : None
|
37 |
|
|
* Output : None
|
38 |
|
|
* Return : None
|
39 |
|
|
*******************************************************************************/
|
40 |
|
|
void debug(void)
|
41 |
|
|
{
|
42 |
|
|
|
43 |
|
|
/************************************* ADC ************************************/
|
44 |
|
|
#ifdef _ADC1
|
45 |
|
|
ADC1 = (ADC_TypeDef *) ADC1_BASE;
|
46 |
|
|
#endif /*_ADC1 */
|
47 |
|
|
|
48 |
|
|
#ifdef _ADC2
|
49 |
|
|
ADC2 = (ADC_TypeDef *) ADC2_BASE;
|
50 |
|
|
#endif /*_ADC2 */
|
51 |
|
|
|
52 |
|
|
/************************************* BKP ************************************/
|
53 |
|
|
#ifdef _BKP
|
54 |
|
|
BKP = (BKP_TypeDef *) BKP_BASE;
|
55 |
|
|
#endif /*_BKP */
|
56 |
|
|
|
57 |
|
|
/************************************* CAN ************************************/
|
58 |
|
|
#ifdef _CAN
|
59 |
|
|
CAN = (CAN_TypeDef *) CAN_BASE;
|
60 |
|
|
#endif /*_CAN */
|
61 |
|
|
|
62 |
|
|
/************************************* DMA ************************************/
|
63 |
|
|
#ifdef _DMA
|
64 |
|
|
DMA = (DMA_TypeDef *) DMA_BASE;
|
65 |
|
|
#endif /*_DMA */
|
66 |
|
|
|
67 |
|
|
#ifdef _DMA_Channel1
|
68 |
|
|
DMA_Channel1 = (DMA_Channel_TypeDef *) DMA_Channel1_BASE;
|
69 |
|
|
#endif /*_DMA_Channel1 */
|
70 |
|
|
|
71 |
|
|
#ifdef _DMA_Channel2
|
72 |
|
|
DMA_Channel2 = (DMA_Channel_TypeDef *) DMA_Channel2_BASE;
|
73 |
|
|
#endif /*_DMA_Channel2 */
|
74 |
|
|
|
75 |
|
|
#ifdef _DMA_Channel3
|
76 |
|
|
DMA_Channel3 = (DMA_Channel_TypeDef *) DMA_Channel3_BASE;
|
77 |
|
|
#endif /*_DMA_Channel3 */
|
78 |
|
|
|
79 |
|
|
#ifdef _DMA_Channel4
|
80 |
|
|
DMA_Channel4 = (DMA_Channel_TypeDef *) DMA_Channel4_BASE;
|
81 |
|
|
#endif /*_DMA_Channel4 */
|
82 |
|
|
|
83 |
|
|
#ifdef _DMA_Channel5
|
84 |
|
|
DMA_Channel5 = (DMA_Channel_TypeDef *) DMA_Channel5_BASE;
|
85 |
|
|
#endif /*_DMA_Channel5 */
|
86 |
|
|
|
87 |
|
|
#ifdef _DMA_Channel6
|
88 |
|
|
DMA_Channel6 = (DMA_Channel_TypeDef *) DMA_Channel6_BASE;
|
89 |
|
|
#endif /*_DMA_Channel6 */
|
90 |
|
|
|
91 |
|
|
#ifdef _DMA_Channel7
|
92 |
|
|
DMA_Channel7 = (DMA_Channel_TypeDef *) DMA_Channel7_BASE;
|
93 |
|
|
#endif /*_DMA_Channel7 */
|
94 |
|
|
|
95 |
|
|
/************************************* EXTI ***********************************/
|
96 |
|
|
#ifdef _EXTI
|
97 |
|
|
EXTI = (EXTI_TypeDef *) EXTI_BASE;
|
98 |
|
|
#endif /*_EXTI */
|
99 |
|
|
|
100 |
|
|
/************************************* FLASH and Option Bytes *****************/
|
101 |
|
|
#ifdef _FLASH
|
102 |
|
|
FLASH = (FLASH_TypeDef *) FLASH_BASE;
|
103 |
|
|
OB = (OB_TypeDef *) OB_BASE;
|
104 |
|
|
#endif /*_FLASH */
|
105 |
|
|
|
106 |
|
|
/************************************* GPIO ***********************************/
|
107 |
|
|
#ifdef _GPIOA
|
108 |
|
|
GPIOA = (GPIO_TypeDef *) GPIOA_BASE;
|
109 |
|
|
#endif /*_GPIOA */
|
110 |
|
|
|
111 |
|
|
#ifdef _GPIOB
|
112 |
|
|
GPIOB = (GPIO_TypeDef *) GPIOB_BASE;
|
113 |
|
|
#endif /*_GPIOB */
|
114 |
|
|
|
115 |
|
|
#ifdef _GPIOC
|
116 |
|
|
GPIOC = (GPIO_TypeDef *) GPIOC_BASE;
|
117 |
|
|
#endif /*_GPIOC */
|
118 |
|
|
|
119 |
|
|
#ifdef _GPIOD
|
120 |
|
|
GPIOD = (GPIO_TypeDef *) GPIOD_BASE;
|
121 |
|
|
#endif /*_GPIOD */
|
122 |
|
|
|
123 |
|
|
#ifdef _GPIOE
|
124 |
|
|
GPIOE = (GPIO_TypeDef *) GPIOE_BASE;
|
125 |
|
|
#endif /*_GPIOE */
|
126 |
|
|
|
127 |
|
|
#ifdef _AFIO
|
128 |
|
|
AFIO = (AFIO_TypeDef *) AFIO_BASE;
|
129 |
|
|
#endif /*_AFIO */
|
130 |
|
|
|
131 |
|
|
/************************************* I2C ************************************/
|
132 |
|
|
#ifdef _I2C1
|
133 |
|
|
I2C1 = (I2C_TypeDef *) I2C1_BASE;
|
134 |
|
|
#endif /*_I2C1 */
|
135 |
|
|
|
136 |
|
|
#ifdef _I2C2
|
137 |
|
|
I2C2 = (I2C_TypeDef *) I2C2_BASE;
|
138 |
|
|
#endif /*_I2C2 */
|
139 |
|
|
|
140 |
|
|
/************************************* IWDG ***********************************/
|
141 |
|
|
#ifdef _IWDG
|
142 |
|
|
IWDG = (IWDG_TypeDef *) IWDG_BASE;
|
143 |
|
|
#endif /*_IWDG */
|
144 |
|
|
|
145 |
|
|
/************************************* NVIC ***********************************/
|
146 |
|
|
#ifdef _NVIC
|
147 |
|
|
NVIC = (NVIC_TypeDef *) NVIC_BASE;
|
148 |
|
|
#endif /*_NVIC */
|
149 |
|
|
|
150 |
|
|
#ifdef _SCB
|
151 |
|
|
SCB = (SCB_TypeDef *) SCB_BASE;
|
152 |
|
|
#endif /*_SCB */
|
153 |
|
|
|
154 |
|
|
/************************************* PWR ************************************/
|
155 |
|
|
#ifdef _PWR
|
156 |
|
|
PWR = (PWR_TypeDef *) PWR_BASE;
|
157 |
|
|
#endif /*_PWR */
|
158 |
|
|
|
159 |
|
|
/************************************* RCC ************************************/
|
160 |
|
|
#ifdef _RCC
|
161 |
|
|
RCC = (RCC_TypeDef *) RCC_BASE;
|
162 |
|
|
#endif /*_RCC */
|
163 |
|
|
|
164 |
|
|
/************************************* RTC ************************************/
|
165 |
|
|
#ifdef _RTC
|
166 |
|
|
RTC = (RTC_TypeDef *) RTC_BASE;
|
167 |
|
|
#endif /*_RTC */
|
168 |
|
|
|
169 |
|
|
/************************************* SPI ************************************/
|
170 |
|
|
#ifdef _SPI1
|
171 |
|
|
SPI1 = (SPI_TypeDef *) SPI1_BASE;
|
172 |
|
|
#endif /*_SPI1 */
|
173 |
|
|
|
174 |
|
|
#ifdef _SPI2
|
175 |
|
|
SPI2 = (SPI_TypeDef *) SPI2_BASE;
|
176 |
|
|
#endif /*_SPI2 */
|
177 |
|
|
|
178 |
|
|
/************************************* SysTick ********************************/
|
179 |
|
|
#ifdef _SysTick
|
180 |
|
|
SysTick = (SysTick_TypeDef *) SysTick_BASE;
|
181 |
|
|
#endif /*_SysTick */
|
182 |
|
|
|
183 |
|
|
/************************************* TIM1 ***********************************/
|
184 |
|
|
#ifdef _TIM1
|
185 |
|
|
TIM1 = (TIM1_TypeDef *) TIM1_BASE;
|
186 |
|
|
#endif /*_TIM1 */
|
187 |
|
|
|
188 |
|
|
/************************************* TIM ************************************/
|
189 |
|
|
#ifdef _TIM2
|
190 |
|
|
TIM2 = (TIM_TypeDef *) TIM2_BASE;
|
191 |
|
|
#endif /*_TIM2 */
|
192 |
|
|
|
193 |
|
|
#ifdef _TIM3
|
194 |
|
|
TIM3 = (TIM_TypeDef *) TIM3_BASE;
|
195 |
|
|
#endif /*_TIM3 */
|
196 |
|
|
|
197 |
|
|
#ifdef _TIM4
|
198 |
|
|
TIM4 = (TIM_TypeDef *) TIM4_BASE;
|
199 |
|
|
#endif /*_TIM4 */
|
200 |
|
|
|
201 |
|
|
/************************************* USART **********************************/
|
202 |
|
|
#ifdef _USART1
|
203 |
|
|
USART1 = (USART_TypeDef *) USART1_BASE;
|
204 |
|
|
#endif /*_USART1 */
|
205 |
|
|
|
206 |
|
|
#ifdef _USART2
|
207 |
|
|
USART2 = (USART_TypeDef *) USART2_BASE;
|
208 |
|
|
#endif /*_USART2 */
|
209 |
|
|
|
210 |
|
|
#ifdef _USART3
|
211 |
|
|
USART3 = (USART_TypeDef *) USART3_BASE;
|
212 |
|
|
#endif /*_USART3 */
|
213 |
|
|
|
214 |
|
|
/************************************* WWDG ***********************************/
|
215 |
|
|
#ifdef _WWDG
|
216 |
|
|
WWDG = (WWDG_TypeDef *) WWDG_BASE;
|
217 |
|
|
#endif /*_WWDG */
|
218 |
|
|
}
|
219 |
|
|
#endif
|
220 |
|
|
|
221 |
|
|
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
|