variant.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2017, STMicroelectronics
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *******************************************************************************
  29. */
  30. #include "pins_arduino.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. const PinName digitalPin[] = {
  35. PB_12,
  36. PB_13,
  37. PB_14,
  38. PB_15,
  39. PD_8,
  40. PD_9,
  41. PD_10,
  42. PD_11,
  43. PD_12,
  44. PD_13,
  45. PD_14,
  46. PD_15,
  47. PG_2,
  48. PG_3,
  49. PG_4,
  50. PG_5,
  51. PG_6,
  52. PG_7,
  53. PG_8,
  54. PC_6,
  55. PC_7,
  56. PC_8,
  57. PC_9,
  58. PA_8,
  59. PA_9,
  60. PA_10,
  61. PA_11,
  62. PA_12,
  63. PA_13,
  64. PA_14,
  65. PA_15,
  66. PC_10,
  67. PC_11,
  68. PC_12,
  69. PD_0,
  70. PD_1,
  71. PD_2,
  72. PD_3,
  73. PD_4,
  74. PD_5,
  75. PD_6,
  76. PD_7,
  77. PG_9,
  78. PG_10,
  79. PG_11,
  80. PG_12,
  81. PG_13,
  82. PG_14,
  83. PG_15,
  84. PB_3,
  85. PB_4,
  86. PB_5,
  87. PB_6,
  88. PB_7,
  89. PB_8,
  90. PB_9,
  91. PB_10,
  92. PB_11,
  93. PE_14,
  94. PE_15,
  95. PE_12,
  96. PE_13,
  97. PE_10,
  98. PE_11,
  99. PE_8,
  100. PE_9,
  101. PG_1,
  102. PE_7,
  103. PF_15,
  104. PG_0,
  105. PF_13,
  106. PF_14,
  107. PF_11,
  108. PF_12,
  109. PB_2,
  110. PB_1,
  111. PC_5,
  112. PB_0,
  113. PA_7,
  114. PC_4,
  115. PA_5,
  116. PA_6,
  117. PA_3,
  118. PA_4,
  119. PA_1,
  120. PA_2,
  121. PC_3,
  122. PA_0,
  123. PC_1,
  124. PC_2,
  125. PC_0,
  126. PF_8,
  127. PF_6,
  128. PF_7,
  129. PF_9,
  130. PF_10,
  131. PF_4,
  132. PF_5,
  133. PF_2,
  134. PF_3,
  135. PF_0,
  136. PF_1,
  137. PE_6,
  138. PC_13,
  139. PE_4,
  140. PE_5,
  141. PE_2,
  142. PE_3,
  143. PE_0,
  144. PE_1,
  145. PC_14,
  146. PC_15,
  147. };
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. // ----------------------------------------------------------------------------
  152. #ifdef __cplusplus
  153. extern "C" {
  154. #endif
  155. /**
  156. * @brief System Clock Configuration
  157. * @param None
  158. * @retval None
  159. */
  160. WEAK void SystemClock_Config(void)
  161. {
  162. RCC_OscInitTypeDef RCC_OscInitStruct;
  163. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  164. /**Configure the main internal regulator output voltage
  165. */
  166. __HAL_RCC_PWR_CLK_ENABLE();
  167. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  168. /**Initializes the CPU, AHB and APB busses clocks
  169. */
  170. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  171. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  172. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  173. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  174. RCC_OscInitStruct.PLL.PLLM = 8;
  175. RCC_OscInitStruct.PLL.PLLN = 336;
  176. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  177. RCC_OscInitStruct.PLL.PLLQ = 7;
  178. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  179. _Error_Handler(__FILE__, __LINE__);
  180. }
  181. /**Initializes the CPU, AHB and APB busses clocks
  182. */
  183. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
  184. | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
  185. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  186. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  187. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  188. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  189. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
  190. _Error_Handler(__FILE__, __LINE__);
  191. }
  192. }
  193. #ifdef __cplusplus
  194. }
  195. #endif