Subversion Repositories dashGPS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/* USER CODE BEGIN Header */
2
/**
3
 ******************************************************************************
4
 * @file           : main.c
5
 * @brief          : Main program body
6
 ******************************************************************************
7
 * @attention
8
 *
9
 * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
10
 * All rights reserved.</center></h2>
11
 *
12
 * This software component is licensed by ST under BSD 3-Clause license,
13
 * the "License"; You may not use this file except in compliance with the
14
 * License. You may obtain a copy of the License at:
15
 *                        opensource.org/licenses/BSD-3-Clause
16
 *
17
 ******************************************************************************
18
 */
19
/* USER CODE END Header */
20
/* Includes ------------------------------------------------------------------*/
21
#include "main.h"
13 mjames 22
#include "usb_device.h"
2 mjames 23
 
24
/* Private includes ----------------------------------------------------------*/
25
/* USER CODE BEGIN Includes */
26
#include "libSerial/serial.h"
11 mjames 27
#include "libBMP280/bmp280.h"
6 mjames 28
#include "display.h"
2 mjames 29
/* USER CODE END Includes */
30
 
31
/* Private typedef -----------------------------------------------------------*/
32
/* USER CODE BEGIN PTD */
33
 
34
/* USER CODE END PTD */
35
 
36
/* Private define ------------------------------------------------------------*/
37
/* USER CODE BEGIN PD */
38
/* USER CODE END PD */
39
 
40
/* Private macro -------------------------------------------------------------*/
41
/* USER CODE BEGIN PM */
42
 
43
/* USER CODE END PM */
44
 
45
/* Private variables ---------------------------------------------------------*/
11 mjames 46
I2C_HandleTypeDef hi2c2;
47
 
13 mjames 48
RTC_HandleTypeDef hrtc;
49
 
2 mjames 50
SPI_HandleTypeDef hspi1;
51
 
9 mjames 52
TIM_HandleTypeDef htim3;
2 mjames 53
TIM_HandleTypeDef htim4;
54
 
55
UART_HandleTypeDef huart1;
56
 
57
/* USER CODE BEGIN PV */
11 mjames 58
typedef struct
59
{
60
  uint8_t dev_addr;
61
} interface_t;
2 mjames 62
 
11 mjames 63
static int8_t
64
user_i2c_write (uint8_t i2c_addr, uint8_t reg_addr, uint8_t *reg_data, uint32_t len)
65
{
66
    HAL_StatusTypeDef st = HAL_I2C_Mem_Write(&hi2c2, i2c_addr<<1, reg_addr, 1, reg_data, len, 10000);
67
 
68
  return st != HAL_OK ?  BMP280_E_COMM_FAIL: BMP280_OK;
69
 
70
}
71
static int8_t
72
user_i2c_read (uint8_t i2c_addr, uint8_t reg_addr, uint8_t *reg_data, uint32_t len)
73
{
74
  HAL_StatusTypeDef st = HAL_I2C_Mem_Read(&hi2c2, i2c_addr<<1, reg_addr, 1, reg_data, len, 10000);
75
 
76
  return st != HAL_OK ?  BMP280_E_COMM_FAIL: BMP280_OK;
77
 
78
}
79
 
80
static void
81
user_delay_ms (uint32_t ms, void *handle)
82
{
83
  HAL_Delay (ms);
84
 
85
}
86
 
87
 
88
 
89
 
90
struct bmp280_dev bmp =
91
  {
92
 
93
  .intf = BMP280_I2C_INTF, .read = user_i2c_read, .write = user_i2c_write,
94
      .delay_ms = user_delay_ms,
95
 
96
      /* Update interface pointer with the structure that contains both device address and file descriptor */
97
     .dev_id =  BMP280_I2C_ADDR_PRIM };
98
 
99
int8_t rslt;
100
struct bmp280_config conf;
101
 
102
 
2 mjames 103
/* USER CODE END PV */
104
 
105
/* Private function prototypes -----------------------------------------------*/
9 mjames 106
void SystemClock_Config(void);
107
static void MX_GPIO_Init(void);
108
static void MX_SPI1_Init(void);
109
static void MX_TIM4_Init(void);
110
static void MX_USART1_UART_Init(void);
111
static void MX_TIM3_Init(void);
11 mjames 112
static void MX_I2C2_Init(void);
13 mjames 113
static void MX_RTC_Init(void);
2 mjames 114
/* USER CODE BEGIN PFP */
115
 
116
/* USER CODE END PFP */
117
 
118
/* Private user code ---------------------------------------------------------*/
119
/* USER CODE BEGIN 0 */
120
 
121
/* USER CODE END 0 */
122
 
123
/**
9 mjames 124
  * @brief  The application entry point.
125
  * @retval int
126
  */
127
int main(void)
2 mjames 128
{
129
  /* USER CODE BEGIN 1 */
130
 
131
  /* USER CODE END 1 */
132
 
133
  /* MCU Configuration--------------------------------------------------------*/
134
 
135
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
9 mjames 136
  HAL_Init();
2 mjames 137
 
138
  /* USER CODE BEGIN Init */
139
 
140
  /* USER CODE END Init */
141
 
142
  /* Configure the system clock */
9 mjames 143
  SystemClock_Config();
2 mjames 144
 
145
  /* USER CODE BEGIN SysInit */
146
 
147
  /* USER CODE END SysInit */
148
 
149
  /* Initialize all configured peripherals */
9 mjames 150
  MX_GPIO_Init();
151
  MX_SPI1_Init();
152
  MX_TIM4_Init();
153
  MX_USART1_UART_Init();
154
  MX_TIM3_Init();
11 mjames 155
  MX_I2C2_Init();
13 mjames 156
  MX_RTC_Init();
157
  MX_USB_DEVICE_Init();
2 mjames 158
  /* USER CODE BEGIN 2 */
159
  __HAL_RCC_USART1_CLK_ENABLE();
160
  /* setup the USART control blocks */
11 mjames 161
  init_usart_ctl (&uc1, &huart1);
2 mjames 162
 
163
  EnableSerialRxInterrupt (&uc1);
164
 
11 mjames 165
 
166
  /* Initialize the bmp280 */
167
  rslt = bmp280_init(&bmp);
168
//  print_rslt(" bmp280_init status", rslt);
169
 
170
  /* Always read the current settings before writing, especially when
171
   * all the configuration is not modified
172
   */
173
  rslt = bmp280_get_config(&conf, &bmp);
174
 // print_rslt(" bmp280_get_config status", rslt);
175
 
176
  /* configuring the temperature oversampling, filter coefficient and output data rate */
177
  /* Overwrite the desired settings */
178
  conf.filter = BMP280_FILTER_COEFF_2;
179
 
180
  /* Temperature oversampling set at 4x */
181
  conf.os_temp = BMP280_OS_4X;
182
 
183
  /* Pressure over sampling none (disabling pressure measurement) */
184
  conf.os_pres = BMP280_OS_4X;
185
 
12 mjames 186
  /* Setting the output data rate as 2HZ(500ms) */
187
  conf.odr = BMP280_ODR_500_MS;
11 mjames 188
  rslt = bmp280_set_config(&conf, &bmp);
189
  //print_rslt(" bmp280_set_config status", rslt);
190
 
191
  /* Always set the power mode after setting the configuration */
192
  rslt = bmp280_set_power_mode(BMP280_NORMAL_MODE, &bmp);
193
  //print_rslt(" bmp280_set_power_mode status", rslt);
194
 
195
 
196
 
6 mjames 197
  cc_init ();
2 mjames 198
  /* USER CODE END 2 */
199
 
200
  /* Infinite loop */
201
  /* USER CODE BEGIN WHILE */
202
  while (1)
203
    {
11 mjames 204
      cc_run (&bmp);
2 mjames 205
 
9 mjames 206
      HAL_Delay (50);
5 mjames 207
 
9 mjames 208
    /* USER CODE END WHILE */
5 mjames 209
 
9 mjames 210
    /* USER CODE BEGIN 3 */
2 mjames 211
    }
212
  /* USER CODE END 3 */
213
}
214
 
215
/**
9 mjames 216
  * @brief System Clock Configuration
217
  * @retval None
218
  */
219
void SystemClock_Config(void)
2 mjames 220
{
9 mjames 221
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
222
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
13 mjames 223
  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
2 mjames 224
 
225
  /** Initializes the RCC Oscillators according to the specified parameters
9 mjames 226
  * in the RCC_OscInitTypeDef structure.
227
  */
13 mjames 228
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
2 mjames 229
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
230
  RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
13 mjames 231
  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
2 mjames 232
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
233
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
234
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
13 mjames 235
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
9 mjames 236
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
237
  {
238
    Error_Handler();
239
  }
2 mjames 240
  /** Initializes the CPU, AHB and APB buses clocks
9 mjames 241
  */
242
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
243
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
2 mjames 244
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
245
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
246
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
247
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
248
 
9 mjames 249
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
250
  {
251
    Error_Handler();
252
  }
13 mjames 253
  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USB;
254
  PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
255
  PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
256
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
9 mjames 257
  {
258
    Error_Handler();
259
  }
2 mjames 260
}
261
 
262
/**
11 mjames 263
  * @brief I2C2 Initialization Function
264
  * @param None
265
  * @retval None
266
  */
267
static void MX_I2C2_Init(void)
268
{
269
 
270
  /* USER CODE BEGIN I2C2_Init 0 */
271
 
272
  /* USER CODE END I2C2_Init 0 */
273
 
274
  /* USER CODE BEGIN I2C2_Init 1 */
275
 
276
  /* USER CODE END I2C2_Init 1 */
277
  hi2c2.Instance = I2C2;
278
  hi2c2.Init.ClockSpeed = 100000;
279
  hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;
280
  hi2c2.Init.OwnAddress1 = 0;
281
  hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
282
  hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
283
  hi2c2.Init.OwnAddress2 = 0;
284
  hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
285
  hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
286
  if (HAL_I2C_Init(&hi2c2) != HAL_OK)
287
  {
288
    Error_Handler();
289
  }
290
  /* USER CODE BEGIN I2C2_Init 2 */
291
 
292
  /* USER CODE END I2C2_Init 2 */
293
 
294
}
295
 
296
/**
13 mjames 297
  * @brief RTC Initialization Function
298
  * @param None
299
  * @retval None
300
  */
301
static void MX_RTC_Init(void)
302
{
303
 
304
  /* USER CODE BEGIN RTC_Init 0 */
305
 
306
  /* USER CODE END RTC_Init 0 */
307
 
308
  RTC_TimeTypeDef sTime = {0};
309
  RTC_DateTypeDef DateToUpdate = {0};
310
 
311
  /* USER CODE BEGIN RTC_Init 1 */
312
 
313
  /* USER CODE END RTC_Init 1 */
314
  /** Initialize RTC Only
315
  */
316
  hrtc.Instance = RTC;
317
  hrtc.Init.AsynchPrediv = RTC_AUTO_1_SECOND;
318
  hrtc.Init.OutPut = RTC_OUTPUTSOURCE_ALARM;
319
  if (HAL_RTC_Init(&hrtc) != HAL_OK)
320
  {
321
    Error_Handler();
322
  }
323
 
324
  /* USER CODE BEGIN Check_RTC_BKUP */
325
 
326
  /* USER CODE END Check_RTC_BKUP */
327
 
328
  /** Initialize RTC and set the Time and Date
329
  */
330
  sTime.Hours = 0x0;
331
  sTime.Minutes = 0x0;
332
  sTime.Seconds = 0x0;
333
 
334
  if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
335
  {
336
    Error_Handler();
337
  }
338
  DateToUpdate.WeekDay = RTC_WEEKDAY_MONDAY;
339
  DateToUpdate.Month = RTC_MONTH_JANUARY;
340
  DateToUpdate.Date = 0x1;
341
  DateToUpdate.Year = 0x0;
342
 
343
  if (HAL_RTC_SetDate(&hrtc, &DateToUpdate, RTC_FORMAT_BCD) != HAL_OK)
344
  {
345
    Error_Handler();
346
  }
347
  /* USER CODE BEGIN RTC_Init 2 */
348
 
349
  /* USER CODE END RTC_Init 2 */
350
 
351
}
352
 
353
/**
9 mjames 354
  * @brief SPI1 Initialization Function
355
  * @param None
356
  * @retval None
357
  */
358
static void MX_SPI1_Init(void)
2 mjames 359
{
360
 
361
  /* USER CODE BEGIN SPI1_Init 0 */
362
 
363
  /* USER CODE END SPI1_Init 0 */
364
 
365
  /* USER CODE BEGIN SPI1_Init 1 */
366
 
367
  /* USER CODE END SPI1_Init 1 */
368
  /* SPI1 parameter configuration*/
369
  hspi1.Instance = SPI1;
370
  hspi1.Init.Mode = SPI_MODE_MASTER;
371
  hspi1.Init.Direction = SPI_DIRECTION_1LINE;
372
  hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
5 mjames 373
  hspi1.Init.CLKPolarity = SPI_POLARITY_HIGH;
374
  hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;
2 mjames 375
  hspi1.Init.NSS = SPI_NSS_SOFT;
376
  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
377
  hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
378
  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
379
  hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
380
  hspi1.Init.CRCPolynomial = 10;
9 mjames 381
  if (HAL_SPI_Init(&hspi1) != HAL_OK)
382
  {
383
    Error_Handler();
384
  }
2 mjames 385
  /* USER CODE BEGIN SPI1_Init 2 */
386
 
387
  /* USER CODE END SPI1_Init 2 */
388
 
389
}
390
 
391
/**
9 mjames 392
  * @brief TIM3 Initialization Function
393
  * @param None
394
  * @retval None
395
  */
396
static void MX_TIM3_Init(void)
2 mjames 397
{
398
 
9 mjames 399
  /* USER CODE BEGIN TIM3_Init 0 */
400
 
401
  /* USER CODE END TIM3_Init 0 */
402
 
403
  TIM_MasterConfigTypeDef sMasterConfig = {0};
404
  TIM_OC_InitTypeDef sConfigOC = {0};
405
 
406
  /* USER CODE BEGIN TIM3_Init 1 */
407
 
408
  /* USER CODE END TIM3_Init 1 */
409
  htim3.Instance = TIM3;
410
  htim3.Init.Prescaler = 640;
411
  htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
412
  htim3.Init.Period = 10000;
413
  htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
414
  htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
415
  if (HAL_TIM_OC_Init(&htim3) != HAL_OK)
416
  {
417
    Error_Handler();
418
  }
419
  if (HAL_TIM_OnePulse_Init(&htim3, TIM_OPMODE_SINGLE) != HAL_OK)
420
  {
421
    Error_Handler();
422
  }
423
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_ENABLE;
424
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
425
  if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
426
  {
427
    Error_Handler();
428
  }
429
  sConfigOC.OCMode = TIM_OCMODE_TIMING;
430
  sConfigOC.Pulse = 9999;
431
  sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
432
  sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
433
  if (HAL_TIM_OC_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
434
  {
435
    Error_Handler();
436
  }
437
  /* USER CODE BEGIN TIM3_Init 2 */
438
 
439
  /* USER CODE END TIM3_Init 2 */
440
 
441
}
442
 
443
/**
444
  * @brief TIM4 Initialization Function
445
  * @param None
446
  * @retval None
447
  */
448
static void MX_TIM4_Init(void)
449
{
450
 
2 mjames 451
  /* USER CODE BEGIN TIM4_Init 0 */
452
 
453
  /* USER CODE END TIM4_Init 0 */
454
 
9 mjames 455
  TIM_Encoder_InitTypeDef sConfig = {0};
456
  TIM_MasterConfigTypeDef sMasterConfig = {0};
2 mjames 457
 
458
  /* USER CODE BEGIN TIM4_Init 1 */
459
 
460
  /* USER CODE END TIM4_Init 1 */
461
  htim4.Instance = TIM4;
462
  htim4.Init.Prescaler = 0;
463
  htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
464
  htim4.Init.Period = 65535;
465
  htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
466
  htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
467
  sConfig.EncoderMode = TIM_ENCODERMODE_TI12;
468
  sConfig.IC1Polarity = TIM_ICPOLARITY_RISING;
469
  sConfig.IC1Selection = TIM_ICSELECTION_DIRECTTI;
470
  sConfig.IC1Prescaler = TIM_ICPSC_DIV1;
471
  sConfig.IC1Filter = 8;
472
  sConfig.IC2Polarity = TIM_ICPOLARITY_RISING;
473
  sConfig.IC2Selection = TIM_ICSELECTION_DIRECTTI;
474
  sConfig.IC2Prescaler = TIM_ICPSC_DIV1;
475
  sConfig.IC2Filter = 8;
9 mjames 476
  if (HAL_TIM_Encoder_Init(&htim4, &sConfig) != HAL_OK)
477
  {
478
    Error_Handler();
479
  }
2 mjames 480
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
481
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
9 mjames 482
  if (HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig) != HAL_OK)
483
  {
484
    Error_Handler();
485
  }
2 mjames 486
  /* USER CODE BEGIN TIM4_Init 2 */
487
 
488
  /* USER CODE END TIM4_Init 2 */
489
 
490
}
491
 
492
/**
9 mjames 493
  * @brief USART1 Initialization Function
494
  * @param None
495
  * @retval None
496
  */
497
static void MX_USART1_UART_Init(void)
2 mjames 498
{
499
 
500
  /* USER CODE BEGIN USART1_Init 0 */
501
 
502
  /* USER CODE END USART1_Init 0 */
503
 
504
  /* USER CODE BEGIN USART1_Init 1 */
505
 
506
  /* USER CODE END USART1_Init 1 */
507
  huart1.Instance = USART1;
508
  huart1.Init.BaudRate = 115200;
509
  huart1.Init.WordLength = UART_WORDLENGTH_8B;
510
  huart1.Init.StopBits = UART_STOPBITS_1;
511
  huart1.Init.Parity = UART_PARITY_NONE;
512
  huart1.Init.Mode = UART_MODE_TX_RX;
513
  huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
514
  huart1.Init.OverSampling = UART_OVERSAMPLING_16;
9 mjames 515
  if (HAL_UART_Init(&huart1) != HAL_OK)
516
  {
517
    Error_Handler();
518
  }
2 mjames 519
  /* USER CODE BEGIN USART1_Init 2 */
520
 
521
  /* USER CODE END USART1_Init 2 */
522
 
523
}
524
 
525
/**
9 mjames 526
  * @brief GPIO Initialization Function
527
  * @param None
528
  * @retval None
529
  */
530
static void MX_GPIO_Init(void)
2 mjames 531
{
9 mjames 532
  GPIO_InitTypeDef GPIO_InitStruct = {0};
2 mjames 533
 
534
  /* GPIO Ports Clock Enable */
5 mjames 535
  __HAL_RCC_GPIOC_CLK_ENABLE();
2 mjames 536
  __HAL_RCC_GPIOD_CLK_ENABLE();
537
  __HAL_RCC_GPIOA_CLK_ENABLE();
538
  __HAL_RCC_GPIOB_CLK_ENABLE();
539
 
540
  /*Configure GPIO pin Output Level */
13 mjames 541
  HAL_GPIO_WritePin(GPIOA, SPI_CD_Pin|SPI_RESET_Pin|SPI_NSS1_Pin, GPIO_PIN_RESET);
2 mjames 542
 
13 mjames 543
  /*Configure GPIO pins : SPI_CD_Pin SPI_RESET_Pin SPI_NSS1_Pin */
544
  GPIO_InitStruct.Pin = SPI_CD_Pin|SPI_RESET_Pin|SPI_NSS1_Pin;
2 mjames 545
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
546
  GPIO_InitStruct.Pull = GPIO_NOPULL;
547
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
13 mjames 548
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
2 mjames 549
 
550
}
551
 
552
/* USER CODE BEGIN 4 */
553
 
554
/* USER CODE END 4 */
555
 
556
/**
9 mjames 557
  * @brief  This function is executed in case of error occurrence.
558
  * @retval None
559
  */
560
void Error_Handler(void)
2 mjames 561
{
562
  /* USER CODE BEGIN Error_Handler_Debug */
563
  /* User can add his own implementation to report the HAL error return state */
564
 
565
  /* USER CODE END Error_Handler_Debug */
566
}
567
 
568
#ifdef  USE_FULL_ASSERT
569
/**
570
  * @brief  Reports the name of the source file and the source line number
571
  *         where the assert_param error has occurred.
572
  * @param  file: pointer to the source file name
573
  * @param  line: assert_param error line source number
574
  * @retval None
575
  */
576
void assert_failed(uint8_t *file, uint32_t line)
577
{
578
  /* USER CODE BEGIN 6 */
579
  /* User can add his own implementation to report the file name and line number,
580
     tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
581
  /* USER CODE END 6 */
582
}
583
#endif /* USE_FULL_ASSERT */
584
 
585
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/