114 lines
2.2 KiB
C++
114 lines
2.2 KiB
C++
|
|
#include "pins_arduino.h"
|
|
|
|
// Pin name
|
|
const PinName digitalPin[] = {
|
|
PA_8,
|
|
PA_9,
|
|
PA_10,
|
|
PA_11,
|
|
PA_12,
|
|
PA_13,
|
|
PA_14,
|
|
PA_15,
|
|
PB_2,
|
|
PB_3,
|
|
PB_4,
|
|
PB_5,
|
|
PB_6,
|
|
PB_7,
|
|
PB_8,
|
|
PB_9,
|
|
PB_10,
|
|
PB_11,
|
|
PB_12,
|
|
PB_13,
|
|
PB_14,
|
|
PB_15,
|
|
PC_13,
|
|
PC_14,
|
|
PC_15,
|
|
PA_0,
|
|
PA_1,
|
|
PA_2,
|
|
PA_3,
|
|
PA_4,
|
|
PA_5,
|
|
PA_6,
|
|
PA_7,
|
|
PB_0,
|
|
PB_1,
|
|
PF_0,
|
|
PF_1
|
|
};
|
|
|
|
// Analog (Ax) pin number array
|
|
const uint32_t analogInputPin[] = {
|
|
25, // A0
|
|
26, // A1
|
|
27, // A2
|
|
28, // A3
|
|
29, // A4
|
|
30, // A5
|
|
31, // A6
|
|
32, // A7
|
|
33, // A8
|
|
34 // A9
|
|
};
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief System Clock Configuration
|
|
* @param None
|
|
* @retval None
|
|
*/
|
|
void SystemClock_Config(void)
|
|
{
|
|
RCC_OscInitTypeDef RCC_OscInitStruct = {};
|
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
|
|
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
|
|
|
|
/** Initializes the RCC Oscillators according to the specified parameters
|
|
* in the RCC_OscInitTypeDef structure.
|
|
*/
|
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE;
|
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
|
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
|
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
|
|
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
|
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
|
|
/** Initializes the CPU, AHB and APB buses clocks
|
|
*/
|
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
|
|RCC_CLOCKTYPE_PCLK1;
|
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
|
|
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
|
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
|
|
|
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |