Subversion Repositories DashDisplay

Rev

Rev 33 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33 Rev 44
Line 3... Line 3...
3
  * File Name          : stm32l1xx_hal_msp.c
3
  * File Name          : stm32l1xx_hal_msp.c
4
  * Description        : This file provides code for the MSP Initialization
4
  * Description        : This file provides code for the MSP Initialization
5
  *                      and de-Initialization codes.
5
  *                      and de-Initialization codes.
6
  ******************************************************************************
6
  ******************************************************************************
7
  *
7
  *
8
  * COPYRIGHT(c) 2017 STMicroelectronics
8
  * COPYRIGHT(c) 2018 STMicroelectronics
9
  *
9
  *
10
  * Redistribution and use in source and binary forms, with or without modification,
10
  * Redistribution and use in source and binary forms, with or without modification,
11
  * are permitted provided that the following conditions are met:
11
  * are permitted provided that the following conditions are met:
12
  *   1. Redistributions of source code must retain the above copyright notice,
12
  *   1. Redistributions of source code must retain the above copyright notice,
13
  *      this list of conditions and the following disclaimer.
13
  *      this list of conditions and the following disclaimer.
Line 126... Line 126...
126
 
126
 
127
  /* USER CODE END SPI1_MspDeInit 1 */
127
  /* USER CODE END SPI1_MspDeInit 1 */
128
 
128
 
129
}
129
}
130
 
130
 
-
 
131
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* htim_encoder)
-
 
132
{
-
 
133
 
-
 
134
  GPIO_InitTypeDef GPIO_InitStruct;
-
 
135
  if(htim_encoder->Instance==TIM3)
-
 
136
  {
-
 
137
  /* USER CODE BEGIN TIM3_MspInit 0 */
-
 
138
 
-
 
139
  /* USER CODE END TIM3_MspInit 0 */
-
 
140
    /* Peripheral clock enable */
-
 
141
    __HAL_RCC_TIM3_CLK_ENABLE();
-
 
142
 
-
 
143
    /**TIM3 GPIO Configuration    
-
 
144
    PC6     ------> TIM3_CH1
-
 
145
    PC7     ------> TIM3_CH2
-
 
146
    */
-
 
147
    GPIO_InitStruct.Pin = SW2_I_Pin|SW2_Q_Pin;
-
 
148
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-
 
149
    GPIO_InitStruct.Pull = GPIO_PULLUP;
-
 
150
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-
 
151
    GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
-
 
152
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
-
 
153
 
-
 
154
  /* USER CODE BEGIN TIM3_MspInit 1 */
-
 
155
 
-
 
156
  /* USER CODE END TIM3_MspInit 1 */
-
 
157
  }
-
 
158
  else if(htim_encoder->Instance==TIM9)
-
 
159
  {
-
 
160
  /* USER CODE BEGIN TIM9_MspInit 0 */
-
 
161
 
-
 
162
  /* USER CODE END TIM9_MspInit 0 */
-
 
163
    /* Peripheral clock enable */
-
 
164
    __HAL_RCC_TIM9_CLK_ENABLE();
-
 
165
 
-
 
166
    /**TIM9 GPIO Configuration    
-
 
167
    PB13     ------> TIM9_CH1
-
 
168
    PB14     ------> TIM9_CH2
-
 
169
    */
-
 
170
    GPIO_InitStruct.Pin = SW1_I_Pin|SW1_Q_Pin;
-
 
171
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-
 
172
    GPIO_InitStruct.Pull = GPIO_PULLUP;
-
 
173
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
-
 
174
    GPIO_InitStruct.Alternate = GPIO_AF3_TIM9;
-
 
175
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
 
176
 
-
 
177
  /* USER CODE BEGIN TIM9_MspInit 1 */
-
 
178
 
-
 
179
  /* USER CODE END TIM9_MspInit 1 */
-
 
180
  }
-
 
181
 
-
 
182
}
-
 
183
 
-
 
184
void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* htim_encoder)
-
 
185
{
-
 
186
 
-
 
187
  if(htim_encoder->Instance==TIM3)
-
 
188
  {
-
 
189
  /* USER CODE BEGIN TIM3_MspDeInit 0 */
-
 
190
 
-
 
191
  /* USER CODE END TIM3_MspDeInit 0 */
-
 
192
    /* Peripheral clock disable */
-
 
193
    __HAL_RCC_TIM3_CLK_DISABLE();
-
 
194
 
-
 
195
    /**TIM3 GPIO Configuration    
-
 
196
    PC6     ------> TIM3_CH1
-
 
197
    PC7     ------> TIM3_CH2
-
 
198
    */
-
 
199
    HAL_GPIO_DeInit(GPIOC, SW2_I_Pin|SW2_Q_Pin);
-
 
200
 
-
 
201
  /* USER CODE BEGIN TIM3_MspDeInit 1 */
-
 
202
 
-
 
203
  /* USER CODE END TIM3_MspDeInit 1 */
-
 
204
  }
-
 
205
  else if(htim_encoder->Instance==TIM9)
-
 
206
  {
-
 
207
  /* USER CODE BEGIN TIM9_MspDeInit 0 */
-
 
208
 
-
 
209
  /* USER CODE END TIM9_MspDeInit 0 */
-
 
210
    /* Peripheral clock disable */
-
 
211
    __HAL_RCC_TIM9_CLK_DISABLE();
-
 
212
 
-
 
213
    /**TIM9 GPIO Configuration    
-
 
214
    PB13     ------> TIM9_CH1
-
 
215
    PB14     ------> TIM9_CH2
-
 
216
    */
-
 
217
    HAL_GPIO_DeInit(GPIOB, SW1_I_Pin|SW1_Q_Pin);
-
 
218
 
-
 
219
  /* USER CODE BEGIN TIM9_MspDeInit 1 */
-
 
220
 
-
 
221
  /* USER CODE END TIM9_MspDeInit 1 */
-
 
222
  }
-
 
223
 
-
 
224
}
-
 
225
 
131
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
226
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
132
{
227
{
133
 
228
 
134
  GPIO_InitTypeDef GPIO_InitStruct;
229
  GPIO_InitTypeDef GPIO_InitStruct;
135
  if(huart->Instance==USART1)
230
  if(huart->Instance==USART1)