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 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. #if defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG)
  35. // Pin number
  36. // This array allows to wrap Arduino pin number(Dx or x)
  37. // to STM32 PinName (PX_n)
  38. const PinName digitalPin[] = {
  39. // Right Side
  40. //Int //Ext
  41. //3V3 //3V3
  42. //3V3 //3V3
  43. //BOOT0 //BOOT1
  44. //GND //GND
  45. //GND //GND
  46. PE_1, PE_0, // D0, D1
  47. PB_9, PB_8,
  48. PB_7, PB_6,
  49. PB_5, PB_3,
  50. PD_7, PD_6,
  51. PD_5, PD_4, // D10, D11
  52. PD_3, PD_2,
  53. PD_1, PD_0,
  54. PC_12, PC_11,
  55. PC_10, PA_15,
  56. PA_12, PA_11, // D20, D21 PA_11: USB_DM, PA_12: USB_DP
  57. PA_10, PA_9,
  58. PA_8, PC_9,
  59. PC_8, PC_7,
  60. PC_6, PD_15,
  61. PD_14, PD_13, // D30, D31
  62. PD_12, PD_11,
  63. PD_10, PD_9,
  64. PD_8, PB_15,
  65. // Left Side
  66. //Ext //Int
  67. //5V //5V
  68. //5V //5V
  69. //3V3 //3V3
  70. //3V3 //3V3
  71. //GND //GND
  72. PE_2, PE_3,
  73. PE_4, PE_5, // D40, D41 PE_4: BUT K0, PE_5: BUT K1
  74. PE_6, PC_13,
  75. PC_0, PC_1,
  76. PC_2, PC_3,
  77. //VREF- //VREF+
  78. PA_0, PA_1, // PA_0(WK_UP): BUT K_UP)
  79. PA_2, PA_3, // D50, D51
  80. PA_4, PA_5,
  81. /*PA_6, PA_7,*/ // PA_6, PA_7: Moved to allow contiguous analog pins
  82. PC_4, PC_5,
  83. PB_0, PB_1,
  84. PA_6, PA_7, // PA_6: LED D2, PA_7: LED D3 (active LOW)
  85. PE_7, PE_8, // D60, D61
  86. PE_9, PE_10,
  87. PE_11, PE_12,
  88. PE_13, PE_14,
  89. PE_15, PB_10,
  90. PB_11, PB_12, // D70, D71
  91. PB_13, PB_14,
  92. PB_4,
  93. };
  94. #endif // ARDUINO_BLACK_F407VE || ARDUINO_BLACK_F407VG
  95. #if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG)
  96. const PinName digitalPin[] = {
  97. // Left Side
  98. //Ext //Int
  99. //GND //5V
  100. //GND //3V3
  101. PB_12, PB_13,
  102. PB_14, PB_15,
  103. PD_8, PD_9,
  104. PD_10, PD_11,
  105. PD_12, PD_13,
  106. PD_14, PD_15,
  107. PG_2, PG_3,
  108. PG_4, PG_5,
  109. PG_6, PG_7,
  110. PG_8, PC_6,
  111. PC_7, PC_8,
  112. PC_9, PA_8,
  113. PA_9, PA_10,
  114. PA_11, PA_12, // PA_11: USB_DM, PA_12: USB_DP
  115. PA_13, PA_14,
  116. PA_15, PC_10,
  117. PC_11, PC_12,
  118. PD_0, PD_1,
  119. PD_2, PD_3,
  120. PD_4, PD_5,
  121. PD_6, PD_7,
  122. PG_9, PG_10,
  123. PG_11, PG_12,
  124. PG_13, PG_14,
  125. PG_15, PB_3,
  126. PB_4, PB_5,
  127. PB_6, PB_7,
  128. PB_8, PB_9,
  129. // Right Side
  130. //Int //Ext
  131. //3V3 //3V3
  132. //BOOT1 //BOOT0
  133. //GND //GND
  134. //VREF+ //GND
  135. PB_10, PB_11,
  136. PE_14, PE_15,
  137. PE_12, PE_13,
  138. PE_10, PE_11,
  139. PE_8, PE_9,
  140. PG_1, PE_7,
  141. PF_15, PG_0,
  142. PF_13, PF_14,
  143. PF_11, PF_12,
  144. PB_2, // PB1 PB2 Inverted to allow contiguous analog pins
  145. PB_1,
  146. PC_5, PB_0,
  147. PA_7, PC_4,
  148. PA_5, PA_6,
  149. PA_3, PA_4,
  150. PA_1, PA_2,
  151. PC_3, PA_0, // PA_0(WK_UP): BUT K_UP)
  152. PC_1, PC_2,
  153. /*PF_10,*/PC_0, // PF_10: Moved to allow contiguous analog pins
  154. PF_8, /*PF_9,*/ // PF_9: Moved to allow contiguous analog pins
  155. PF_6, PF_7,
  156. PF_10, PF_9, // PF_10: LED D2, PF_9: LED D1 (active low)
  157. PF_4, PF_5,
  158. PF_2, PF_3,
  159. PF_0, PF_1,
  160. PE_6, PC_13,
  161. PE_4, PE_5, // PE_4: BUT K0, PE_5: BUT K1
  162. PE_2, PE_3,
  163. PE_0, PE_1,
  164. };
  165. #endif // ARDUINO_BLACK_F407ZE || ARDUINO_BLACK_F407ZG
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169. // ----------------------------------------------------------------------------
  170. #ifdef __cplusplus
  171. extern "C" {
  172. #endif
  173. /**
  174. * @brief System Clock Configuration
  175. * @param None
  176. * @retval None
  177. */
  178. WEAK void SystemClock_Config(void)
  179. {
  180. RCC_OscInitTypeDef RCC_OscInitStruct;
  181. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  182. /**Configure the main internal regulator output voltage
  183. */
  184. __HAL_RCC_PWR_CLK_ENABLE();
  185. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  186. /**Initializes the CPU, AHB and APB busses clocks
  187. */
  188. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  189. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  190. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  191. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  192. RCC_OscInitStruct.PLL.PLLM = 8;
  193. RCC_OscInitStruct.PLL.PLLN = 336;
  194. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  195. RCC_OscInitStruct.PLL.PLLQ = 7;
  196. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  197. _Error_Handler(__FILE__, __LINE__);
  198. }
  199. /**Initializes the CPU, AHB and APB busses clocks
  200. */
  201. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
  202. | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
  203. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  204. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  205. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  206. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  207. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
  208. _Error_Handler(__FILE__, __LINE__);
  209. }
  210. /**Configure the Systick interrupt time
  211. */
  212. HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
  213. /**Configure the Systick
  214. */
  215. HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
  216. /* SysTick_IRQn interrupt configuration */
  217. HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  218. }
  219. #ifdef __cplusplus
  220. }
  221. #endif