My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

variant.cpp 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. Copyright (c) 2011 Arduino. All right reserved.
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14. */
  15. #include "pins_arduino.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. // Pin number
  20. const PinName digitalPin[] = {
  21. PA_0, //D0 //A7
  22. PA_1, //D1 //A8
  23. PA_2, //D2 //A9
  24. PA_3, //D3 //A0
  25. PA_4, //D4 //A1
  26. PA_5, //D5 //A10
  27. PA_6, //D6 //A11
  28. PA_7, //D7 //A12
  29. PA_8, //D8
  30. PA_9, //D9
  31. PA_10, //D10
  32. PA_11, //D11
  33. PA_12, //D12
  34. PA_13, //D13
  35. PA_14, //D14
  36. PA_15, //D15
  37. PB_0, //D16 //A13
  38. PB_1, //D17 //A14
  39. PB_2, //D18
  40. PB_3, //D19
  41. PB_4, //D20
  42. PB_5, //D21
  43. PB_6, //D22
  44. PB_7, //D23
  45. PB_8, //D24
  46. PB_9, //D25
  47. PB_10, //D26
  48. PB_11, //D27
  49. PB_12, //D28
  50. PB_13, //D29
  51. PB_14, //D30
  52. PB_15, //D31
  53. PC_0, //D32 //A2
  54. PC_1, //D33 //A3
  55. PC_2, //D34 //A4
  56. PC_3, //D35 //A5
  57. PC_4, //D36 //A6
  58. PC_5, //D37 //A15
  59. PC_6, //D38
  60. PC_7, //D39
  61. PC_8, //D40
  62. PC_9, //D41
  63. PC_10, //D42
  64. PC_11, //D43
  65. PC_12, //D44
  66. PC_13, //D45
  67. PC_14, //D46
  68. PC_15, //D47
  69. PD_0, //D48
  70. PD_1, //D49
  71. PD_2, //D50
  72. PD_3, //D51
  73. PD_4, //D52
  74. PD_5, //D53
  75. PD_6, //D54
  76. PD_7, //D55
  77. PD_8, //D56
  78. PD_9, //D57
  79. PD_10, //D58
  80. PD_11, //D59
  81. PD_12, //D60
  82. PD_13, //D61
  83. PD_14, //D62
  84. PD_15, //D63
  85. PE_0, //D64
  86. PE_1, //D65
  87. PE_2, //D66
  88. PE_3, //D67
  89. PE_4, //D68
  90. PE_5, //D69
  91. PE_6, //D70
  92. PE_7, //D71
  93. PE_8, //D72
  94. PE_9, //D73
  95. PE_10, //D74
  96. PE_11, //D75
  97. PE_12, //D76
  98. PE_13, //D77
  99. PE_14, //D78
  100. PE_15 //D79
  101. };
  102. // Analog (Ax) pin number array
  103. const uint32_t analogInputPin[] = {
  104. 3, //D3 //A0
  105. 4, //D4 //A1
  106. 32, //D32 //A2
  107. 33, //D33 //A3
  108. 34, //D34 //A4
  109. 35, //D35 //A5
  110. 36, //D36 //A6
  111. 0, //D0 //A7
  112. 1, //D1 //A8
  113. 2, //D2 //A9
  114. 5, //D5 //A10
  115. 6, //D6 //A11
  116. 7, //D7 //A12
  117. 16, //D16 //A13
  118. 17, //D17 //A14
  119. 37 //D37 //A15
  120. };
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. // ----------------------------------------------------------------------------
  125. #ifdef __cplusplus
  126. extern "C" {
  127. #endif
  128. /**
  129. * @brief System Clock Configuration
  130. * The system Clock is configured as follow :
  131. * System Clock source = PLL (HSE)
  132. * SYSCLK(Hz) = 168000000
  133. * HCLK(Hz) = 168000000
  134. * AHB Prescaler = 1
  135. * APB1 Prescaler = 4
  136. * APB2 Prescaler = 2
  137. * HSE Frequency(Hz) = 8000000
  138. * PLL_M = 8
  139. * PLL_N = 336
  140. * PLL_P = 2
  141. * PLL_Q = 7
  142. * VDD(V) = 3.3
  143. * Main regulator output voltage = Scale1 mode
  144. * Flash Latency(WS) = 5
  145. * @param None
  146. * @retval None
  147. */
  148. WEAK void SystemClock_Config(void)
  149. {
  150. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  151. RCC_OscInitTypeDef RCC_OscInitStruct;
  152. RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
  153. /* Enable Power Control clock */
  154. __HAL_RCC_PWR_CLK_ENABLE();
  155. #ifdef HAL_PWR_MODULE_ENABLED
  156. /* The voltage scaling allows optimizing the power consumption when the device is
  157. clocked below the maximum system frequency, to update the voltage scaling value
  158. regarding system frequency refer to product datasheet. */
  159. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  160. #endif
  161. /* Enable HSE Oscillator and activate PLL with HSE as source */
  162. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  163. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  164. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  165. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  166. RCC_OscInitStruct.PLL.PLLM = 6;
  167. RCC_OscInitStruct.PLL.PLLN = 180;
  168. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  169. RCC_OscInitStruct.PLL.PLLQ = 7;
  170. RCC_OscInitStruct.PLL.PLLR = 2;
  171. HAL_RCC_OscConfig(&RCC_OscInitStruct);
  172. HAL_PWREx_EnableOverDrive();
  173. /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
  174. clocks dividers */
  175. RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
  176. RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
  177. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLRCLK;
  178. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  179. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  180. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  181. HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
  182. PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48;
  183. PeriphClkInitStruct.PLLSAI.PLLSAIM = 6;
  184. PeriphClkInitStruct.PLLSAI.PLLSAIN = 96;
  185. PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2;
  186. PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
  187. PeriphClkInitStruct.PLLSAIDivQ = 1;
  188. PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48CLKSOURCE_PLLSAIP;
  189. HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
  190. }
  191. #ifdef __cplusplus
  192. }
  193. #endif