123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- /*
- *******************************************************************************
- * Copyright (c) 2020-2021, STMicroelectronics
- * All rights reserved.
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- *******************************************************************************
- */
- #if defined(STM32G0B1xx)
- #include "pins_arduino.h"
- // Digital PinName array
- const PinName digitalPin[] = {
- PA_0, // D0/A0
- PA_1, // D1/A1
- PA_2, // D2/A2
- PA_3, // D3/A3
- PA_4, // D4/A4
- PA_5, // D5/A5
- PA_6, // D6/A6
- PA_7, // D7/A7
- PA_8, // D8
- PA_9, // D9
- PA_10, // D10
- PA_11, // D11
- PA_12, // D12
- PA_13, // D13
- PA_14, // D14
- PA_15, // D15
- PB_0, // D16/A8
- PB_1, // D17/A9
- PB_2, // D18/A10
- PB_3, // D19
- PB_4, // D20
- PB_5, // D21
- PB_6, // D22
- PB_7, // D23
- PB_8, // D24
- PB_9, // D25
- PB_10, // D26/A11
- PB_11, // D27/A12
- PB_12, // D28/A13
- PB_13, // D29
- PB_14, // D30
- PB_15, // D31
- PC_0, // D32
- PC_1, // D33
- PC_2, // D34
- PC_3, // D35
- PC_4, // D36/A14
- PC_5, // D37/A15
- PC_6, // D38
- PC_7, // D39
- PC_8, // D40
- PC_9, // D41
- PC_10, // D42
- PC_11, // D43
- PC_12, // D44
- PC_13, // D45
- PC_14, // D46
- PC_15, // D47
- PD_0, // D48
- PD_1, // D49
- PD_2, // D50
- PD_3, // D51
- PD_4, // D52
- PD_5, // D53
- PD_6, // D54
- PD_7, // D55
- PD_8, // D56
- PD_9, // D57
- PD_10, // D58
- PD_11, // D59
- PD_12, // D60
- PD_13, // D61
- PD_14, // D62
- PD_15, // D63
- PE_0, // D64
- PE_1, // D65
- PE_2, // D66
- PE_3, // D67
- PE_4, // D68
- PE_5, // D69
- PE_6, // D70
- PE_7, // D71
- PE_8, // D72
- PE_9, // D73
- PE_10, // D74
- PE_11, // D75
- PE_12, // D76
- PE_13, // D77
- PE_14, // D78
- PE_15, // D79
- PF_0, // D80
- PF_1, // D81
- PF_2, // D82
- PF_3, // D83
- PF_4, // D84
- PF_5, // D85
- PF_6, // D86
- PF_7, // D87
- PF_8, // D88
- PF_9, // D89
- PF_10, // D90
- PF_11, // D91
- PF_12, // D92
- PF_13, // D93
- PA_9_R, // D94
- PA_10_R // D95
- };
- // Analog (Ax) pin number array
- const uint32_t analogInputPin[] = {
- 0, // A0, PA0
- 1, // A1, PA1
- 2, // A2, PA2
- 3, // A3, PA3
- 4, // A4, PA4
- 5, // A5, PA5
- 6, // A6, PA6
- 7, // A7, PA7
- 16, // A8, PB0
- 17, // A9, PB1
- 18, // A10, PB2
- 26, // A11, PB10
- 27, // A12, PB11
- 28, // A13, PB12
- 36, // A14, PC4
- 37 // A15, PC5
- };
- // ----------------------------------------------------------------------------
- #ifdef __cplusplus
- extern "C" {
- #endif
- /**
- * @brief System Clock Configuration
- * The system Clock is configured as follows :
- * System Clock source = PLL (HSE)
- * SYSCLK(Hz) = 64000000
- * HCLK(Hz) = 64000000
- * AHB Prescaler = 1
- * APB1 Prescaler = 1
- * PLL_M = 1
- * PLL_N = 24
- * PLL_R = 3
- * PLL_P = 2
- * PLL_Q = 4
- * USB(Hz) = 48000000 (PLLQ)
- * @param None
- * @retval None
- */
- WEAK void SystemClock_Config(void)
- {
- RCC_OscInitTypeDef RCC_OscInitStruct = {0};
- RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
- RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
- // Reset clock registers (in case bootloader has changed them)
- SystemInit();
- /** Configure the main internal regulator output voltage
- */
- HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
- /** Initializes the RCC Oscillators according to the specified parameters
- * in the RCC_OscInitTypeDef structure.
- */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
- RCC_OscInitStruct.HSEState = RCC_HSE_ON;
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
- RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
- RCC_OscInitStruct.PLL.PLLN = 24;
- RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
- RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV4;
- RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV3;
- 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_2) != HAL_OK)
- {
- Error_Handler();
- }
- /** Initializes the peripherals clocks
- */
- PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
- PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL;
- if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
- {
- Error_Handler();
- }
- }
- #ifdef __cplusplus
- }
- #endif
- #endif /* STM32G0B1xx */
|