提交 | 用户 | age
|
483170
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file : BSP.c |
|
4 |
* @brief : Board Speciafic program |
|
5 |
****************************************************************************** |
|
6 |
* |
|
7 |
****************************************************************************** |
|
8 |
*/ |
|
9 |
/* Includes ------------------------------------------------------------------*/ |
|
10 |
|
|
11 |
#include "BSP.h" |
|
12 |
|
|
13 |
#include "Globaldef.h" |
|
14 |
#include "Functions.h" |
|
15 |
#if (BOARD_TYPE == 14) |
5dd1b7
|
16 |
#include "fpx.h" |
483170
|
17 |
#endif |
Q |
18 |
|
|
19 |
/* |
|
20 |
if ((nCurTick &0xff) ==0) |
|
21 |
{ |
|
22 |
if (freqdir) { freq+=1+freq/10;if (freq>=1500) {freq=1500;freqdir=0;}} |
|
23 |
else {freq-=1+freq/10;if (freq<=10) {freq=10;freqdir=1;} } |
|
24 |
} |
|
25 |
*/ |
|
26 |
|
|
27 |
/* |
|
28 |
static int outputsum=0; |
|
29 |
static int freq=10; |
|
30 |
static int freqdir=1; |
|
31 |
static int phase=0; |
|
32 |
static int somb=0; |
|
33 |
static int len=0; |
|
34 |
static int curbb=0; |
|
35 |
|
|
36 |
if ((nCurTick &0x3ff) ==1) |
|
37 |
{ |
|
38 |
curbb++; |
|
39 |
if (curbb+1==len) |
|
40 |
{ |
|
41 |
// freq=0; |
|
42 |
}else if (curbb>=len) |
|
43 |
{ |
|
44 |
somb=musictab1[cur_musicpos*2]; |
|
45 |
len=musictab1[cur_musicpos*2+1]; |
|
46 |
freq=freqtab[somb]; |
|
47 |
curbb=0;cur_musicpos++; if (cur_musicpos >= Totalmusiccount) {cur_musicpos=0;} |
|
48 |
} |
|
49 |
} |
|
50 |
if ((nCurTick &0x3ff) ==0x1ff) |
|
51 |
{ |
|
52 |
if (curbb+1==len) |
|
53 |
{ |
|
54 |
freq=0; |
|
55 |
} |
|
56 |
} |
|
57 |
phase+=freq; |
|
58 |
if (phase>=5000) {phase-=5000;} |
|
59 |
|
|
60 |
|
|
61 |
if (outtype==1) |
|
62 |
{ |
|
63 |
outputsum+=freq; |
|
64 |
if (outputsum>=5000) |
|
65 |
{ |
|
66 |
//LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_3); |
|
67 |
LL_GPIO_TogglePin(GPIOB,LL_GPIO_PIN_3); |
|
68 |
outputsum-=5000; |
|
69 |
} |
|
70 |
else |
|
71 |
{ |
|
72 |
//LL_GPIO_ResetOutputPin(GPIOB,LL_GPIO_PIN_3); |
|
73 |
} |
|
74 |
}else if (outtype==2) |
|
75 |
{ |
|
76 |
const int volume = 2500; |
|
77 |
int amp; |
|
78 |
if (phase<1250) |
|
79 |
{ |
|
80 |
amp=2500+sintab[(phase -0)*256/1250]*volume/256; |
|
81 |
|
|
82 |
}else if (phase <2500) |
|
83 |
{ |
|
84 |
amp=2500+sintab[(2500-1-phase)*256/1250]*volume/256; |
|
85 |
}else if (phase <3750) |
|
86 |
{ |
|
87 |
amp=2500-sintab[(phase-2500)*256/1250]*volume/256; |
|
88 |
}else |
|
89 |
{ |
|
90 |
amp=2500-sintab[(5000-1-phase)*256/1250]*volume/256; |
|
91 |
} |
|
92 |
outputsum+=amp; |
|
93 |
if (outputsum>=5000) |
|
94 |
{ |
|
95 |
LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_3); |
|
96 |
//LL_GPIO_TogglePin(GPIOB,LL_GPIO_PIN_3); |
|
97 |
outputsum-=5000; |
|
98 |
} |
|
99 |
else |
|
100 |
{ |
|
101 |
LL_GPIO_ResetOutputPin(GPIOB,LL_GPIO_PIN_3); |
|
102 |
} |
|
103 |
} |
|
104 |
*/ |
|
105 |
|
|
106 |
|
|
107 |
/** |
|
108 |
* @brief System Clock Configuration |
|
109 |
* @retval None |
|
110 |
*/ |
|
111 |
|
842bb6
|
112 |
void SystemClock_Config_New(void) |
483170
|
113 |
{ |
842bb6
|
114 |
LL_FLASH_SetLatency(LL_FLASH_LATENCY_1); |
Q |
115 |
|
|
116 |
if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_1) |
|
117 |
{ |
|
118 |
Error_Handler(); |
|
119 |
} |
|
120 |
LL_RCC_HSE_Enable(); |
|
121 |
|
|
122 |
/* Wait till HSE is ready */ |
|
123 |
while(LL_RCC_HSE_IsReady() != 1) |
|
124 |
{ |
|
125 |
|
|
126 |
} |
|
127 |
LL_RCC_LSI_Enable(); |
|
128 |
|
|
129 |
/* Wait till LSI is ready */ |
|
130 |
while(LL_RCC_LSI_IsReady() != 1) |
|
131 |
{ |
|
132 |
|
|
133 |
} |
|
134 |
#if (XLAT_FREQ == 12) |
|
135 |
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_3, LL_RCC_PLL_MUL_12); |
|
136 |
#else |
|
137 |
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_2, LL_RCC_PLL_MUL_12); |
|
138 |
#endif |
|
139 |
LL_RCC_PLL_Enable(); |
|
140 |
|
|
141 |
/* Wait till PLL is ready */ |
|
142 |
while(LL_RCC_PLL_IsReady() != 1) |
|
143 |
{ |
|
144 |
|
|
145 |
} |
|
146 |
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); |
|
147 |
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); |
|
148 |
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); |
|
149 |
|
|
150 |
/* Wait till System clock is ready */ |
|
151 |
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) |
|
152 |
{ |
|
153 |
|
|
154 |
} |
|
155 |
|
|
156 |
LL_InitTick(48000000,10000); |
|
157 |
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); |
|
158 |
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); |
|
159 |
|
|
160 |
SysTick->CTRL = SysTick_CTRL_ENABLE_Msk |
|
161 |
| SysTick_CTRL_TICKINT_Msk; |
|
162 |
|
|
163 |
LL_SetSystemCoreClock(48000000); |
|
164 |
LL_RCC_SetUSARTClockSource(LL_RCC_USART1_CLKSOURCE_PCLK1); |
|
165 |
|
|
166 |
} |
|
167 |
|
|
168 |
|
|
169 |
void SystemClock_Config(void) |
|
170 |
{ |
483170
|
171 |
RCC_OscInitTypeDef RCC_OscInitStruct = {0}; |
Q |
172 |
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; |
|
173 |
|
|
174 |
/** Initializes the CPU, AHB and APB busses clocks |
|
175 |
*/ |
|
176 |
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; |
|
177 |
RCC_OscInitStruct.HSEState = RCC_HSE_ON; |
|
178 |
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; |
|
179 |
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; |
|
180 |
// RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; |
|
181 |
|
|
182 |
#if (XLAT_FREQ == 12) |
|
183 |
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV3; |
|
184 |
#else |
|
185 |
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2; |
|
186 |
#endif |
|
187 |
|
|
188 |
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12; |
|
189 |
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) |
|
190 |
{ |
|
191 |
Error_Handler(); |
|
192 |
} |
|
193 |
/** Initializes the CPU, AHB and APB busses clocks |
|
194 |
*/ |
|
195 |
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |
|
196 |
|RCC_CLOCKTYPE_PCLK1; |
|
197 |
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; |
|
198 |
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; |
|
199 |
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; |
|
200 |
|
|
201 |
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) |
|
202 |
{ |
|
203 |
Error_Handler(); |
|
204 |
} |
|
205 |
|
|
206 |
//RCC_OscInitTypeDef RCC_OscInitStruct; |
|
207 |
//RCC_ClkInitTypeDef RCC_ClkInitStruct; |
|
208 |
RCC_PeriphCLKInitTypeDef PeriphClkInit; |
|
209 |
|
|
210 |
/**Initializes the CPU, AHB and APB busses clocks |
|
211 |
*/ |
|
212 |
|
|
213 |
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1; |
|
214 |
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_SYSCLK; |
|
215 |
|
|
216 |
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) |
|
217 |
{ |
|
218 |
_Error_Handler(__FILE__, __LINE__); |
|
219 |
} |
|
220 |
|
|
221 |
/**Configure the Systick interrupt time |
|
222 |
*/ |
|
223 |
// HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/10000); |
|
224 |
HAL_SYSTICK_Config(48000000/10000); |
|
225 |
|
|
226 |
/**Configure the Systick |
|
227 |
*/ |
|
228 |
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); |
|
229 |
|
|
230 |
/* SysTick_IRQn interrupt configuration */ |
|
231 |
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); |
|
232 |
} |
|
233 |
|
|
234 |
void MX_IWDG_Init(void) |
|
235 |
{ |
|
236 |
|
|
237 |
/* USER CODE BEGIN IWDG_Init 0 */ |
|
238 |
|
|
239 |
/* USER CODE END IWDG_Init 0 */ |
|
240 |
|
|
241 |
/* USER CODE BEGIN IWDG_Init 1 */ |
|
242 |
|
|
243 |
/* USER CODE END IWDG_Init 1 */ |
|
244 |
LL_IWDG_Enable(IWDG); |
|
245 |
LL_IWDG_EnableWriteAccess(IWDG); |
|
246 |
LL_IWDG_SetPrescaler(IWDG, LL_IWDG_PRESCALER_64); |
|
247 |
LL_IWDG_SetReloadCounter(IWDG, 4095); |
|
248 |
while (LL_IWDG_IsReady(IWDG) != 1) |
|
249 |
{ |
|
250 |
} |
|
251 |
|
|
252 |
LL_IWDG_SetWindow(IWDG, 4095); |
|
253 |
LL_IWDG_ReloadCounter(IWDG); |
|
254 |
/* USER CODE BEGIN IWDG_Init 2 */ |
|
255 |
|
|
256 |
/* USER CODE END IWDG_Init 2 */ |
|
257 |
|
|
258 |
} |
|
259 |
/** |
|
260 |
* @brief TIM6 Initialization Function |
|
261 |
* @param None |
|
262 |
* @retval None |
|
263 |
*/ |
|
264 |
void MX_TIM6_Init(void) |
|
265 |
{ |
|
266 |
|
|
267 |
/* USER CODE BEGIN TIM6_Init 0 */ |
|
268 |
|
|
269 |
/* USER CODE END TIM6_Init 0 */ |
|
270 |
|
|
271 |
LL_TIM_InitTypeDef TIM_InitStruct = {0}; |
|
272 |
|
|
273 |
/* Peripheral clock enable */ |
|
274 |
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM6); |
|
275 |
|
|
276 |
/* TIM6 interrupt Init */ |
|
277 |
NVIC_SetPriority(TIM6_IRQn, 0); |
|
278 |
NVIC_EnableIRQ(TIM6_IRQn); |
|
279 |
|
|
280 |
/* USER CODE BEGIN TIM6_Init 1 */ |
|
281 |
|
|
282 |
/* USER CODE END TIM6_Init 1 */ |
|
283 |
TIM_InitStruct.Prescaler = 47; |
|
284 |
TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP; |
|
285 |
TIM_InitStruct.Autoreload = 999; |
|
286 |
LL_TIM_Init(TIM6, &TIM_InitStruct); |
|
287 |
LL_TIM_DisableARRPreload(TIM6); |
|
288 |
/* USER CODE BEGIN TIM6_Init 2 */ |
|
289 |
LL_TIM_EnableIT_UPDATE(TIM6); |
|
290 |
/* USER CODE END TIM6_Init 2 */ |
|
291 |
|
|
292 |
} |
|
293 |
/* ADC init function */ |
|
294 |
void MX_ADC_Init(void) |
|
295 |
{ |
|
296 |
|
|
297 |
LL_ADC_InitTypeDef ADC_InitStruct; |
|
298 |
LL_ADC_REG_InitTypeDef ADC_REG_InitStruct; |
|
299 |
|
|
300 |
/* Peripheral clock enable */ |
|
301 |
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_ADC1); |
|
302 |
|
|
303 |
/**Configure Regular Channel |
|
304 |
*/ |
|
305 |
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_0|LL_ADC_CHANNEL_1); |
|
306 |
|
|
307 |
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR|LL_ADC_PATH_INTERNAL_VREFINT); |
|
308 |
|
|
309 |
/**Configure Regular Channel |
|
310 |
*/ |
|
311 |
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_TEMPSENSOR|LL_ADC_CHANNEL_VREFINT); |
|
312 |
|
|
313 |
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR|LL_ADC_PATH_INTERNAL_VREFINT); |
|
314 |
|
|
315 |
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) |
|
316 |
*/ |
|
317 |
ADC_InitStruct.Clock = LL_ADC_CLOCK_ASYNC; |
|
318 |
ADC_InitStruct.Resolution = LL_ADC_RESOLUTION_12B; |
|
319 |
ADC_InitStruct.DataAlignment = LL_ADC_DATA_ALIGN_RIGHT; |
|
320 |
ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE; |
|
321 |
LL_ADC_Init(ADC1, &ADC_InitStruct); |
|
322 |
|
|
323 |
ADC_REG_InitStruct.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE; |
|
324 |
ADC_REG_InitStruct.SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE; |
|
325 |
ADC_REG_InitStruct.ContinuousMode = LL_ADC_REG_CONV_SINGLE; |
|
326 |
ADC_REG_InitStruct.DMATransfer = LL_ADC_REG_DMA_TRANSFER_LIMITED; |
|
327 |
ADC_REG_InitStruct.Overrun = LL_ADC_REG_OVR_DATA_PRESERVED; |
|
328 |
LL_ADC_REG_Init(ADC1, &ADC_REG_InitStruct); |
|
329 |
|
|
330 |
LL_ADC_REG_SetSequencerScanDirection(ADC1, LL_ADC_REG_SEQ_SCAN_DIR_FORWARD); |
|
331 |
|
|
332 |
LL_ADC_SetSamplingTimeCommonChannels(ADC1, LL_ADC_SAMPLINGTIME_28CYCLES_5); |
|
333 |
|
|
334 |
LL_ADC_EnableIT_EOC(ADC1); |
|
335 |
|
|
336 |
LL_ADC_DisableIT_EOS(ADC1); |
|
337 |
|
|
338 |
LL_ADC_StartCalibration(ADC1); |
|
339 |
|
|
340 |
// LL_ADC_EnableInternalRegulator(ADC1); |
|
341 |
|
|
342 |
// ADC_TempSensorCmd(ENABLE);//????????? |
|
343 |
// ADC_VrefintCmd(ENABLE); //???????? |
|
344 |
|
|
345 |
|
|
346 |
//ADC_TempSensorCmd(ENABLE);// |
|
347 |
//ADC_ChannelConfig(); |
|
348 |
//ADC_VrefintCmd(ENABLE); // |
|
349 |
|
|
350 |
while( LL_ADC_IsCalibrationOnGoing(ADC1)); |
|
351 |
LL_ADC_Enable(ADC1); |
|
352 |
/* |
|
353 |
LL_ADC_REG_SetDMATransfer(ADC1,LL_ADC_REG_DMA_TRANSFER_UNLIMITED); |
|
354 |
LL_ADC_REG_StartConversion(ADC1); |
|
355 |
*/ |
|
356 |
} |
|
357 |
|
|
358 |
/* SPI1 init function */ |
|
359 |
void MX_SPI1_Init(void) |
|
360 |
{ |
|
361 |
|
|
362 |
LL_SPI_InitTypeDef SPI_InitStruct = {0}; |
|
363 |
|
|
364 |
LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
365 |
|
|
366 |
/* Peripheral clock enable */ |
|
367 |
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SPI1); |
|
368 |
|
|
369 |
/**SPI1 GPIO Configuration |
|
370 |
PA5 ------> SPI1_SCK |
|
371 |
PA6 ------> SPI1_MISO |
|
372 |
PA7 ------> SPI1_MOSI |
|
373 |
*/ |
|
374 |
// GPIO_InitStruct.Pin = LL_GPIO_PIN_5; |
|
375 |
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
376 |
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
377 |
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
378 |
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
379 |
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
380 |
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
381 |
|
|
382 |
// GPIO_InitStruct.Pin = LL_GPIO_PIN_6; |
|
383 |
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
384 |
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
385 |
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
386 |
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
387 |
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
388 |
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
389 |
|
|
390 |
// GPIO_InitStruct.Pin = LL_GPIO_PIN_7; |
|
391 |
// GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
392 |
// GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
393 |
// GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
394 |
// GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
395 |
// GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
396 |
// LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
397 |
|
005755
|
398 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_15; |
Q |
399 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
400 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
401 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
402 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
403 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
404 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
405 |
|
483170
|
406 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); |
Q |
407 |
/**SPI1 GPIO Configuration |
|
408 |
PB3 ------> SPI1_SCK |
|
409 |
PB4 ------> SPI1_MISO |
|
410 |
PB5 ------> SPI1_MOSI |
|
411 |
*/ |
005755
|
412 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_3 | LL_GPIO_PIN_4 | LL_GPIO_PIN_5; |
483170
|
413 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
Q |
414 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
415 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
005755
|
416 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
483170
|
417 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
Q |
418 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
005755
|
419 |
/* |
483170
|
420 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_4; |
Q |
421 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
422 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
423 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
424 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
425 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
426 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
427 |
|
|
428 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_5; |
|
429 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
430 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
431 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
432 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
433 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
434 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
005755
|
435 |
*/ |
483170
|
436 |
/* SPI1 interrupt Init */ |
Q |
437 |
NVIC_SetPriority(SPI1_IRQn, 0); |
|
438 |
// NVIC_EnableIRQ(SPI1_IRQn); |
|
439 |
/* USER CODE BEGIN SPI1_Init 1 */ |
|
440 |
|
|
441 |
#if (BOARD_TYPE == 13) |
|
442 |
|
|
443 |
NVIC_EnableIRQ(SPI1_IRQn); |
|
444 |
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; |
|
445 |
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; |
|
446 |
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; |
|
447 |
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_HIGH; //LL_SPI_POLARITY_LOW; |
|
448 |
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE; |
|
449 |
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; |
|
450 |
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; |
|
451 |
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; |
|
452 |
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; |
|
453 |
SPI_InitStruct.CRCPoly = 7; |
|
454 |
LL_SPI_Init(SPI1, &SPI_InitStruct); |
|
455 |
|
|
456 |
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA); |
|
457 |
|
|
458 |
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER); |
|
459 |
// LL_SPI_EnableNSSPulseMgt(SPI1); |
|
460 |
|
|
461 |
#elif (BOARD_TYPE == 14) |
|
462 |
|
|
463 |
NVIC_EnableIRQ(SPI1_IRQn); |
|
464 |
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; |
|
465 |
SPI_InitStruct.Mode = LL_SPI_MODE_SLAVE; |
|
466 |
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; |
|
467 |
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_LOW; |
|
468 |
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE; |
|
469 |
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; |
|
470 |
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4; |
|
471 |
SPI_InitStruct.BitOrder = LL_SPI_LSB_FIRST; |
|
472 |
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; |
|
473 |
SPI_InitStruct.CRCPoly = 7; |
|
474 |
LL_SPI_Init(SPI1, &SPI_InitStruct); |
|
475 |
|
|
476 |
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA); |
|
477 |
LL_SPI_DisableNSSPulseMgt(SPI1); |
|
478 |
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER); |
|
479 |
// LL_SPI_EnableNSSPulseMgt(SPI1); |
|
480 |
|
eaf5d5
|
481 |
#elif (BOARD_TYPE == 15 || BOARD_TYPE == 16) |
Q |
482 |
|
|
483 |
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; |
|
484 |
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; |
|
485 |
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; |
|
486 |
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; |
|
487 |
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; |
|
488 |
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; |
1fb934
|
489 |
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4; |
eaf5d5
|
490 |
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; |
Q |
491 |
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; |
|
492 |
SPI_InitStruct.CRCPoly = 7; |
|
493 |
LL_SPI_Init(SPI1, &SPI_InitStruct); |
|
494 |
|
|
495 |
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA); |
|
496 |
|
|
497 |
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER); |
|
498 |
// LL_SPI_EnableNSSPulseMgt(SPI1); |
|
499 |
|
483170
|
500 |
#else |
Q |
501 |
|
|
502 |
/* USER CODE END SPI1_Init 1 */ |
|
503 |
|
|
504 |
/* SPI1 parameter configuration*/ |
|
505 |
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; |
|
506 |
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; |
|
507 |
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; |
|
508 |
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; |
|
509 |
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; |
|
510 |
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; |
|
511 |
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4; |
|
512 |
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; |
|
513 |
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; |
|
514 |
SPI_InitStruct.CRCPoly = 7; |
|
515 |
LL_SPI_Init(SPI1, &SPI_InitStruct); |
|
516 |
|
|
517 |
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA); |
|
518 |
|
|
519 |
LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER); |
|
520 |
// LL_SPI_EnableNSSPulseMgt(SPI1); |
|
521 |
|
|
522 |
/* USER CODE BEGIN SPI1_Init 2 */ |
|
523 |
|
|
524 |
#endif |
|
525 |
|
|
526 |
LL_SPI_Enable(SPI1); |
|
527 |
/* USER CODE END SPI1_Init 2 */ |
|
528 |
} |
|
529 |
|
|
530 |
/* SPI2 init function */ |
|
531 |
void MX_SPI2_Init(void) |
|
532 |
{ |
|
533 |
|
|
534 |
LL_SPI_InitTypeDef SPI_InitStruct = {0}; |
|
535 |
|
|
536 |
LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
537 |
|
|
538 |
/* Peripheral clock enable */ |
|
539 |
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2); |
|
540 |
|
|
541 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); |
|
542 |
/**SPI2 GPIO Configuration |
|
543 |
PB13 ------> SPI2_SCK |
|
544 |
PB14 ------> SPI2_MISO |
|
545 |
PB15 ------> SPI2_MOSI |
|
546 |
*/ |
|
547 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_13; |
|
548 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
549 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
550 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
551 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
552 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
553 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
554 |
|
|
555 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_14; |
|
556 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
557 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
558 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
559 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
560 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
561 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
562 |
|
|
563 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_15; |
|
564 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
565 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
566 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
567 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
568 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_0; |
|
569 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
570 |
|
|
571 |
/* SPI2 interrupt Init */ |
|
572 |
//NVIC_SetPriority(SPI2_IRQn, 0); |
|
573 |
//NVIC_EnableIRQ(SPI2_IRQn); |
|
574 |
/* USER CODE BEGIN SPI2_Init 1 */ |
|
575 |
|
|
576 |
/* USER CODE END SPI2_Init 1 */ |
|
577 |
|
|
578 |
/* SPI2 parameter configuration*/ |
|
579 |
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX; |
|
580 |
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER; |
|
581 |
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT; |
|
582 |
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_HIGH;//LL_SPI_POLARITY_LOW; |
|
583 |
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE; //LL_SPI_PHASE_1EDGE; |
|
584 |
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT; |
|
585 |
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2; |
|
586 |
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST; |
|
587 |
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE; |
|
588 |
SPI_InitStruct.CRCPoly = 7; |
|
589 |
LL_SPI_Init(SPI2, &SPI_InitStruct); |
|
590 |
LL_SPI_SetStandard(SPI2, LL_SPI_PROTOCOL_MOTOROLA); |
|
591 |
LL_SPI_EnableNSSPulseMgt(SPI2); |
|
592 |
/* USER CODE BEGIN SP21_Init 2 */ |
|
593 |
LL_SPI_Enable(SPI2); |
|
594 |
/* USER CODE END SPI2_Init 2 */ |
|
595 |
} |
|
596 |
|
005755
|
597 |
void Soft_I2C1_Init(void) |
Q |
598 |
{ |
|
599 |
LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
600 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); |
|
601 |
/**I2C1 GPIO Configuration |
|
602 |
PB6 ------> I2C1_SCL |
|
603 |
PB7 ------> I2C1_SDA |
|
604 |
*/ |
|
605 |
LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_6|LL_GPIO_PIN_7); |
|
606 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_6 | LL_GPIO_PIN_7; |
|
607 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
608 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
609 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; |
|
610 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
611 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
612 |
LL_GPIO_SetOutputPin(GPIOB,LL_GPIO_PIN_6 | LL_GPIO_PIN_7); |
|
613 |
|
|
614 |
} |
|
615 |
|
|
616 |
/** |
|
617 |
* @brief I2C1 Initialization Function |
|
618 |
* @param None |
|
619 |
* @retval None |
|
620 |
*/ |
|
621 |
void MX_I2C1_Init(void) |
|
622 |
{ |
|
623 |
|
|
624 |
/* USER CODE BEGIN I2C1_Init 0 */ |
|
625 |
|
|
626 |
/* USER CODE END I2C1_Init 0 */ |
|
627 |
|
|
628 |
LL_I2C_InitTypeDef I2C_InitStruct = {0}; |
|
629 |
|
|
630 |
LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
631 |
|
|
632 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); |
|
633 |
/**I2C1 GPIO Configuration |
|
634 |
PB8 ------> I2C1_SCL |
|
635 |
PB9 ------> I2C1_SDA |
|
636 |
*/ |
|
637 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_8; |
|
638 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
639 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
640 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; |
|
641 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
642 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_1; |
|
643 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
644 |
|
|
645 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_9; |
|
646 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
647 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
648 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; |
|
649 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
650 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_1; |
|
651 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
652 |
|
|
653 |
/* Peripheral clock enable */ |
|
654 |
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1); |
|
655 |
|
|
656 |
/* USER CODE BEGIN I2C1_Init 1 */ |
|
657 |
|
|
658 |
/* USER CODE END I2C1_Init 1 */ |
|
659 |
/** I2C Initialization |
|
660 |
*/ |
|
661 |
LL_I2C_DisableOwnAddress2(I2C1); |
|
662 |
LL_I2C_DisableGeneralCall(I2C1); |
|
663 |
LL_I2C_EnableClockStretching(I2C1); |
|
664 |
I2C_InitStruct.PeripheralMode = LL_I2C_MODE_I2C; |
|
665 |
I2C_InitStruct.Timing = 0x20303E5D; |
|
666 |
I2C_InitStruct.AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE; |
|
667 |
I2C_InitStruct.DigitalFilter = 0; |
|
668 |
I2C_InitStruct.OwnAddress1 = 0; |
|
669 |
I2C_InitStruct.TypeAcknowledge = LL_I2C_ACK; |
|
670 |
I2C_InitStruct.OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT; |
|
671 |
LL_I2C_Init(I2C1, &I2C_InitStruct); |
|
672 |
LL_I2C_EnableAutoEndMode(I2C1); |
|
673 |
LL_I2C_SetOwnAddress2(I2C1, 0, LL_I2C_OWNADDRESS2_NOMASK); |
|
674 |
/* USER CODE BEGIN I2C1_Init 2 */ |
|
675 |
|
|
676 |
/* USER CODE END I2C1_Init 2 */ |
|
677 |
|
|
678 |
} |
483170
|
679 |
|
Q |
680 |
/* USART1 init function */ |
|
681 |
void MX_USART1_UART_Init(void) |
|
682 |
{ |
|
683 |
|
|
684 |
LL_USART_InitTypeDef USART_InitStruct; |
|
685 |
|
|
686 |
LL_GPIO_InitTypeDef GPIO_InitStruct; |
|
687 |
|
|
688 |
/* Peripheral clock enable */ |
|
689 |
LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_USART1); |
|
690 |
|
|
691 |
/**USART1 GPIO Configuration |
|
692 |
// PA1 ------> USART1_DE |
|
693 |
PA9 ------> USART1_TX |
|
694 |
PA10 ------> USART1_RX |
|
695 |
*/ |
|
696 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10; |
|
697 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
698 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
699 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
700 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
701 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_1; |
|
702 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
703 |
|
|
704 |
/* USART1 DMA Init */ |
|
705 |
|
|
706 |
/* USART1_TX Init */ |
|
707 |
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_2, LL_DMA_DIRECTION_MEMORY_TO_PERIPH); |
|
708 |
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PRIORITY_LOW); |
|
709 |
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MODE_NORMAL); |
|
710 |
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PERIPH_NOINCREMENT); |
|
711 |
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MEMORY_INCREMENT); |
|
712 |
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_PDATAALIGN_BYTE); |
|
713 |
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_2, LL_DMA_MDATAALIGN_BYTE); |
|
714 |
|
|
715 |
/* USART1_RX Init */ |
|
716 |
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_3, LL_DMA_DIRECTION_PERIPH_TO_MEMORY); |
|
717 |
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PRIORITY_LOW); |
|
718 |
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MODE_NORMAL); |
|
719 |
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PERIPH_NOINCREMENT); |
|
720 |
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MEMORY_INCREMENT); |
|
721 |
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_3, LL_DMA_PDATAALIGN_BYTE); |
|
722 |
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_3, LL_DMA_MDATAALIGN_BYTE); |
|
723 |
|
|
724 |
/* USART1 interrupt Init */ |
|
725 |
NVIC_SetPriority(USART1_IRQn, 0); |
|
726 |
NVIC_EnableIRQ(USART1_IRQn); |
|
727 |
|
|
728 |
USART_InitStruct.BaudRate = Uart1Baud; |
|
729 |
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; |
|
730 |
USART_InitStruct.StopBits = LL_USART_STOPBITS_1; |
|
731 |
USART_InitStruct.Parity = LL_USART_PARITY_NONE; |
|
732 |
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; |
|
733 |
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; |
|
734 |
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16; |
|
735 |
LL_USART_Init(USART1, &USART_InitStruct); |
|
736 |
// LL_USART_EnableDEMode(USART1); |
|
737 |
// LL_USART_SetDESignalPolarity(USART1, LL_USART_DE_POLARITY_LOW); |
|
738 |
// LL_USART_SetDEAssertionTime(USART1, 1); |
|
739 |
// LL_USART_SetDEDeassertionTime(USART1, 1); |
|
740 |
// LL_USART_EnableOneBitSamp(USART1); |
7d8ba5
|
741 |
|
Q |
742 |
#if (USART1_AUTO_BAUDRATE == 1) |
483170
|
743 |
LL_USART_EnableAutoBaudRate(USART1); |
Q |
744 |
LL_USART_SetAutoBaudRateMode(USART1, LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE); |
7d8ba5
|
745 |
#endif |
Q |
746 |
|
|
747 |
LL_USART_DisableOverrunDetect(USART1); |
483170
|
748 |
LL_USART_ConfigAsyncMode(USART1); |
Q |
749 |
LL_USART_Enable(USART1); |
|
750 |
} |
|
751 |
|
|
752 |
|
|
753 |
/* USART2 init function */ |
|
754 |
void MX_USART2_UART_Init(void) |
|
755 |
{ |
|
756 |
|
|
757 |
LL_USART_InitTypeDef USART_InitStruct = {0}; |
|
758 |
LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; |
|
759 |
|
|
760 |
/* Peripheral clock enable */ |
|
761 |
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2); |
|
762 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); |
|
763 |
|
|
764 |
/**USART2 GPIO Configuration |
|
765 |
PA1 ------> USART2_DE |
|
766 |
PA2 ------> USART2_TX |
|
767 |
PA3 ------> USART2_RX |
|
768 |
*/ |
|
769 |
|
|
770 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_3; |
|
771 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; |
|
772 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
773 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; |
|
774 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
775 |
GPIO_InitStruct.Alternate = LL_GPIO_AF_1; |
|
776 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
777 |
|
|
778 |
#if (USART2_USE_HARDWARE_DE == 1) |
|
779 |
|
|
780 |
#else |
|
781 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_1; |
|
782 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
783 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
784 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; |
|
785 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
786 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
787 |
|
|
788 |
#endif |
|
789 |
|
|
790 |
/* USART2 DMA Init */ |
|
791 |
|
|
792 |
/* USART2_TX Init */ |
|
793 |
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_4, LL_DMA_DIRECTION_MEMORY_TO_PERIPH); |
|
794 |
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PRIORITY_LOW); |
|
795 |
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MODE_NORMAL); |
|
796 |
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PERIPH_NOINCREMENT); |
|
797 |
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MEMORY_INCREMENT); |
|
798 |
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_4, LL_DMA_PDATAALIGN_BYTE); |
|
799 |
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_4, LL_DMA_MDATAALIGN_BYTE); |
|
800 |
|
|
801 |
/* USART2_RX Init */ |
|
802 |
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5, LL_DMA_DIRECTION_PERIPH_TO_MEMORY); |
|
803 |
LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PRIORITY_LOW); |
|
804 |
LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MODE_NORMAL); |
|
805 |
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PERIPH_NOINCREMENT); |
|
806 |
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MEMORY_INCREMENT); |
|
807 |
LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PDATAALIGN_BYTE); |
|
808 |
LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MDATAALIGN_BYTE); |
|
809 |
|
|
810 |
/* USART2 interrupt Init */ |
|
811 |
NVIC_SetPriority(USART2_IRQn, 0); |
|
812 |
NVIC_EnableIRQ(USART2_IRQn); |
|
813 |
|
|
814 |
NVIC_SetPriority(PendSV_IRQn, 255); |
|
815 |
NVIC_EnableIRQ(PendSV_IRQn); |
|
816 |
// NVIC_SetPendingIRQ(PendSV_IRQn); |
|
817 |
|
|
818 |
USART_InitStruct.BaudRate = Uart2Baud; |
|
819 |
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B; |
|
820 |
USART_InitStruct.StopBits = LL_USART_STOPBITS_1; |
|
821 |
USART_InitStruct.Parity = LL_USART_PARITY_NONE; |
|
822 |
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX; |
|
823 |
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE; |
|
824 |
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_8; |
|
825 |
LL_USART_Init(USART2, &USART_InitStruct); |
|
826 |
|
|
827 |
#if (USART2_USE_HARDWARE_DE == 1) |
|
828 |
|
|
829 |
LL_USART_EnableDEMode(USART2); |
|
830 |
LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_LOW); |
|
831 |
// LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_HIGH); |
842bb6
|
832 |
LL_USART_SetDEAssertionTime(USART2, 15); |
Q |
833 |
LL_USART_SetDEDeassertionTime(USART2, 15); |
483170
|
834 |
#else |
Q |
835 |
|
|
836 |
#endif |
|
837 |
|
|
838 |
// LL_USART_EnableOneBitSamp(USART2); |
|
839 |
// LL_USART_EnableAutoBaudRate(USART2); |
|
840 |
// LL_USART_SetAutoBaudRateMode(USART2, LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE); |
|
841 |
LL_USART_DisableOverrunDetect(USART2); |
|
842 |
LL_USART_ConfigAsyncMode(USART2); |
|
843 |
LL_USART_Enable(USART2); |
|
844 |
} |
|
845 |
|
|
846 |
/** |
|
847 |
* Enable DMA controller clock |
|
848 |
*/ |
|
849 |
void MX_DMA_Init(void) |
|
850 |
{ |
|
851 |
/* Init with LL driver */ |
|
852 |
/* DMA controller clock enable */ |
|
853 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1); |
|
854 |
|
|
855 |
/* DMA interrupt init */ |
|
856 |
/* DMA1_Channel2_3_IRQn interrupt configuration */ |
|
857 |
NVIC_SetPriority(DMA1_Channel2_3_IRQn, 0); |
|
858 |
NVIC_EnableIRQ(DMA1_Channel2_3_IRQn); |
|
859 |
NVIC_SetPriority(DMA1_Channel4_5_IRQn, 0); |
|
860 |
NVIC_EnableIRQ(DMA1_Channel4_5_IRQn); |
|
861 |
} |
|
862 |
|
|
863 |
/** Configure pins as |
|
864 |
* Analog |
|
865 |
* Input |
|
866 |
* Output |
|
867 |
* EVENT_OUT |
|
868 |
* EXTI |
|
869 |
*/ |
|
870 |
void MX_GPIO_Init(void) |
|
871 |
{ |
|
872 |
|
|
873 |
LL_GPIO_InitTypeDef GPIO_InitStruct; |
|
874 |
|
|
875 |
/* GPIO Ports Clock Enable */ |
|
876 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA); |
|
877 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB); |
|
878 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC); |
|
879 |
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOF); |
|
880 |
/**/ |
|
881 |
|
|
882 |
|
|
883 |
/**/ |
|
884 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_6 |LL_GPIO_PIN_7; |
|
885 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
886 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
887 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
888 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
889 |
|
|
890 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_7 ; |
|
891 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
892 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
893 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
894 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
895 |
|
|
896 |
|
|
897 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_8|LL_GPIO_PIN_11; |
|
898 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
899 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
900 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
901 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
902 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
903 |
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_8); |
|
904 |
|
|
905 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_9|LL_GPIO_PIN_10; |
|
906 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
907 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
908 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
909 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
910 |
|
|
911 |
|
|
912 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_0|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10; |
|
913 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
914 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
915 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
916 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
917 |
|
1fb934
|
918 |
#if (BOARD_TYPE==2) |
Q |
919 |
|
483170
|
920 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7| |
Q |
921 |
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15; |
|
922 |
|
1fb934
|
923 |
|
005755
|
924 |
#elif (BOARD_TYPE==9 || BOARD_TYPE==10) |
Q |
925 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_11|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10| |
|
926 |
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15; |
|
927 |
|
|
928 |
#elif (BOARD_TYPE==15 || BOARD_TYPE == 16 ) |
1fb934
|
929 |
|
483170
|
930 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7| |
Q |
931 |
LL_GPIO_PIN_11|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10| |
|
932 |
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15; |
1fb934
|
933 |
#elif ( BOARD_TYPE == 11 ) |
Q |
934 |
|
483170
|
935 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7| |
Q |
936 |
LL_GPIO_PIN_2|LL_GPIO_PIN_10|LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15; |
1fb934
|
937 |
#elif (BOARD_TYPE == 14) |
Q |
938 |
|
483170
|
939 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_6|LL_GPIO_PIN_7| |
Q |
940 |
LL_GPIO_PIN_10|LL_GPIO_PIN_11|LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15; |
1fb934
|
941 |
#else |
Q |
942 |
|
483170
|
943 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7| |
Q |
944 |
LL_GPIO_PIN_0|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10| |
|
945 |
LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15; |
1fb934
|
946 |
|
Q |
947 |
#endif |
|
948 |
|
|
949 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
483170
|
950 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
Q |
951 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
952 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
953 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
954 |
|
|
955 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15; |
|
956 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
957 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_LOW; |
|
958 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
959 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
960 |
LL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
|
961 |
|
|
962 |
// RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO,ENABLE ); |
|
963 |
// PWR_BackupAccessCmd( ENABLE );/* ????RTC??????*/ |
|
964 |
// RCC_LSEConfig( RCC_LSE_OFF ); /* ????????,PC14+PC15??????IO*/ |
|
965 |
// BKP_TamperPinCmd(DISABLE); /* ????????,PC13??????IO*/ |
|
966 |
|
|
967 |
#if (BORAD_TYPE == 13) |
|
968 |
|
|
969 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_15 ; |
|
970 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
971 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
972 |
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL; |
|
973 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
974 |
|
|
975 |
#elif (BOARD_TYPE == 14) |
|
976 |
|
|
977 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7; |
|
978 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
979 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
980 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
981 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
982 |
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_8); |
|
983 |
|
|
984 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_9 ; //RST_PIN in |
|
985 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
986 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
987 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
988 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
989 |
|
|
990 |
GPIO_InitStruct.Pin = SYN_PIN ; //SYN_PIN Pin in |
|
991 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
992 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
993 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
994 |
LL_GPIO_Init(SYN_PORT, &GPIO_InitStruct); |
|
995 |
|
|
996 |
GPIO_InitStruct.Pin = ACK_PIN ; //ACK_PIN Pin out |
|
997 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
998 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
999 |
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL; |
|
1000 |
LL_GPIO_Init(ACK_PORT, &GPIO_InitStruct); |
|
1001 |
|
|
1002 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_7 ; //485DE Pin out |
|
1003 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
1004 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1005 |
GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL; |
|
1006 |
LL_GPIO_Init(GPIOF, &GPIO_InitStruct); |
|
1007 |
|
|
1008 |
GPIO_InitStruct.Pin = OE_PIN ; // OE Pin in |
|
1009 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
1010 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1011 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
1012 |
LL_GPIO_Init(OE_PORT, &GPIO_InitStruct); |
|
1013 |
|
|
1014 |
#elif (BOARD_TYPE == 15 || BOARD_TYPE == 16) |
|
1015 |
|
|
1016 |
// Radio Pins |
|
1017 |
// busy pin |
|
1018 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_7; |
|
1019 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
1020 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1021 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
1022 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
1023 |
|
|
1024 |
// Dio 1 pin |
|
1025 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_12; |
|
1026 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; |
|
1027 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1028 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; |
|
1029 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
1030 |
|
|
1031 |
|
|
1032 |
//Sel pin |
|
1033 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_15; |
|
1034 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
1035 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1036 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
1037 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
1038 |
LL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
|
1039 |
|
|
1040 |
|
|
1041 |
//RST pin |
|
1042 |
GPIO_InitStruct.Pin = LL_GPIO_PIN_6; |
|
1043 |
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; |
|
1044 |
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; |
|
1045 |
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
|
1046 |
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; |
|
1047 |
LL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
|
1048 |
|
|
1049 |
#endif |
|
1050 |
|
|
1051 |
} |