variant.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. PA_1,
  36. PA_2,
  37. PA_3,
  38. PA_4,
  39. PA_5,
  40. PA_6,
  41. PA_7,
  42. PA_8,
  43. PA_9,
  44. PA_10,
  45. PA_11,
  46. PA_12,
  47. PA_13,
  48. PA_14,
  49. PA_15,
  50. PB_0,
  51. PB_1,
  52. PB_2,
  53. PB_3,
  54. PB_4,
  55. PB_5,
  56. PB_6,
  57. PB_7,
  58. PB_8,
  59. PB_9,
  60. PB_10,
  61. PB_11,
  62. PB_12,
  63. PB_13,
  64. PB_14,
  65. PB_15,
  66. PC_2,
  67. PC_3,
  68. PC_4,
  69. PC_5,
  70. PC_6,
  71. PC_7,
  72. PC_8,
  73. PC_9,
  74. PC_10,
  75. PC_11,
  76. PC_12,
  77. PC_13,
  78. PC_14,
  79. PC_15,
  80. PD_0,
  81. PD_1,
  82. PD_2,
  83. PD_3,
  84. PD_4,
  85. PD_5,
  86. PD_6,
  87. PD_7,
  88. PD_8,
  89. PD_9,
  90. PD_10,
  91. PD_11,
  92. PD_12,
  93. PD_13,
  94. PD_14,
  95. PD_15,
  96. PE_0,
  97. PE_1,
  98. PE_11,
  99. PE_3,
  100. PE_4,
  101. PE_5,
  102. PE_6,
  103. PE_7,
  104. PE_8,
  105. PE_9,
  106. PE_10,
  107. PE_2,
  108. PE_12,
  109. PE_13,
  110. PE_14,
  111. PE_15,
  112. PF_0,
  113. PF_1,
  114. PF_2,
  115. PF_6,
  116. PF_7,
  117. PF_8,
  118. PF_9,
  119. PF_11,
  120. PF_12,
  121. PF_13,
  122. PF_14,
  123. PF_15,
  124. PG_0,
  125. PG_1,
  126. PG_2,
  127. PG_3,
  128. PG_4,
  129. PG_5,
  130. PG_6,
  131. PG_7,
  132. PG_8,
  133. PG_9,
  134. PG_10,
  135. PG_11,
  136. PG_12,
  137. PG_13,
  138. PG_14,
  139. PG_15,
  140. PH_0,
  141. PH_1,
  142. PA_0,
  143. PC_1,
  144. PC_0,
  145. PF_10,
  146. PF_5,
  147. PF_4,
  148. PF_3,
  149. };
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. // ----------------------------------------------------------------------------
  154. #ifdef __cplusplus
  155. extern "C" {
  156. #endif
  157. /**
  158. * @brief System Clock Configuration
  159. * @param None
  160. * @retval None
  161. */
  162. WEAK void SystemClock_Config(void)
  163. {
  164. RCC_OscInitTypeDef RCC_OscInitStruct;
  165. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  166. /**Configure the main internal regulator output voltage
  167. */
  168. __HAL_RCC_PWR_CLK_ENABLE();
  169. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  170. /**Initializes the CPU, AHB and APB busses clocks
  171. */
  172. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  173. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  174. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  175. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  176. RCC_OscInitStruct.PLL.PLLM = 8;
  177. RCC_OscInitStruct.PLL.PLLN = 336;
  178. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  179. RCC_OscInitStruct.PLL.PLLQ = 7;
  180. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  181. _Error_Handler(__FILE__, __LINE__);
  182. }
  183. /**Initializes the CPU, AHB and APB busses clocks
  184. */
  185. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
  186. | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
  187. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  188. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  189. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  190. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  191. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
  192. _Error_Handler(__FILE__, __LINE__);
  193. }
  194. }
  195. #ifdef __cplusplus
  196. }
  197. #endif