kopia lustrzana https://github.com/mobilinkd/tnc3-firmware
Clean up error_message handling and clock initialization.
rodzic
99ef558766
commit
a438470692
15
Src/main.c
15
Src/main.c
|
@ -421,6 +421,10 @@ int main(void)
|
||||||
/* USER CODE BEGIN SysInit */
|
/* USER CODE BEGIN SysInit */
|
||||||
#ifdef KISS_LOGGING
|
#ifdef KISS_LOGGING
|
||||||
printf("start\r\n");
|
printf("start\r\n");
|
||||||
|
if (error_message[0] != 0) {
|
||||||
|
printf(error_message);
|
||||||
|
error_message[0] = 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Note that it is important that all GPIO interrupts are disabled until
|
// Note that it is important that all GPIO interrupts are disabled until
|
||||||
|
@ -1454,7 +1458,7 @@ void SysClock48()
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
|
||||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
|
||||||
{
|
{
|
||||||
_Error_Handler(__FILE__, __LINE__);
|
_Error_Handler(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -1499,15 +1503,11 @@ void SysClock80()
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
|
||||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
|
||||||
{
|
{
|
||||||
_Error_Handler(__FILE__, __LINE__);
|
_Error_Handler(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Configure the Systick interrupt time
|
|
||||||
*/
|
|
||||||
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
|
|
||||||
|
|
||||||
RCC_OscInitStruct.OscillatorType = 0;
|
RCC_OscInitStruct.OscillatorType = 0;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI;
|
||||||
|
@ -1630,7 +1630,8 @@ void _Error_Handler(char *file, int line)
|
||||||
#ifdef KISS_LOGGING
|
#ifdef KISS_LOGGING
|
||||||
printf("Error handler called from file %s on line %d\r\n", file, line);
|
printf("Error handler called from file %s on line %d\r\n", file, line);
|
||||||
#endif
|
#endif
|
||||||
snprintf(error_message, sizeof(error_message), "Error: %s:%d", file, line);
|
snprintf(error_message, sizeof(error_message), "Error: %s:%d\r\n", file, line);
|
||||||
|
error_message[sizeof(error_message) - 1] = 0;
|
||||||
|
|
||||||
stop_now = 0;
|
stop_now = 0;
|
||||||
go_back_to_sleep = 0;
|
go_back_to_sleep = 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue