variant_MARLIN_STM32F401RC.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2020-2021, STMicroelectronics
  4. * All rights reserved.
  5. *
  6. * This software component is licensed by ST under BSD 3-Clause license,
  7. * the "License"; You may not use this file except in compliance with the
  8. * License. You may obtain a copy of the License at:
  9. * opensource.org/licenses/BSD-3-Clause
  10. *
  11. *******************************************************************************
  12. */
  13. #pragma once
  14. /*----------------------------------------------------------------------------
  15. * STM32 pins number
  16. *----------------------------------------------------------------------------*/
  17. #define PA0 PIN_A0
  18. #define PA1 PIN_A1
  19. #define PA2 PIN_A2
  20. #define PA3 PIN_A3
  21. #define PA4 PIN_A4
  22. #define PA5 PIN_A5
  23. #define PA6 PIN_A6
  24. #define PA7 PIN_A7
  25. #define PA8 8
  26. #define PA9 9
  27. #define PA10 10
  28. #define PA11 11
  29. #define PA12 12
  30. #define PA13 13
  31. #define PA14 14
  32. #define PA15 15
  33. #define PB0 PIN_A8
  34. #define PB1 PIN_A9
  35. #define PB2 18
  36. #define PB3 19
  37. #define PB4 20
  38. #define PB5 21
  39. #define PB6 22
  40. #define PB7 23
  41. #define PB8 24
  42. #define PB9 25
  43. #define PB10 26
  44. #define PB12 27
  45. #define PB13 28
  46. #define PB14 29
  47. #define PB15 30
  48. #define PC0 PIN_A10
  49. #define PC1 PIN_A11
  50. #define PC2 PIN_A12
  51. #define PC3 PIN_A13
  52. #define PC4 PIN_A14
  53. #define PC5 PIN_A15
  54. #define PC6 37
  55. #define PC7 38
  56. #define PC8 39
  57. #define PC9 40
  58. #define PC10 41
  59. #define PC11 42
  60. #define PC12 43
  61. #define PC13 44
  62. #define PC14 45
  63. #define PC15 46
  64. #define PD2 47
  65. #define PH0 48
  66. #define PH1 49
  67. // Alternate pins number
  68. #define PA0_ALT1 (PA0 | ALT1)
  69. #define PA1_ALT1 (PA1 | ALT1)
  70. #define PA2_ALT1 (PA2 | ALT1)
  71. #define PA2_ALT2 (PA2 | ALT2)
  72. #define PA3_ALT1 (PA3 | ALT1)
  73. #define PA3_ALT2 (PA3 | ALT2)
  74. #define PA4_ALT1 (PA4 | ALT1)
  75. #define PA7_ALT1 (PA7 | ALT1)
  76. #define PA15_ALT1 (PA15 | ALT1)
  77. #define PB0_ALT1 (PB0 | ALT1)
  78. #define PB1_ALT1 (PB1 | ALT1)
  79. #define PB3_ALT1 (PB3 | ALT1)
  80. #define PB4_ALT1 (PB4 | ALT1)
  81. #define PB5_ALT1 (PB5 | ALT1)
  82. #define PB8_ALT1 (PB8 | ALT1)
  83. #define PB9_ALT1 (PB9 | ALT1)
  84. #define NUM_DIGITAL_PINS 50
  85. #define NUM_ANALOG_INPUTS 16
  86. #define NUM_ANALOG_FIRST 192
  87. // On-board LED pin number
  88. #ifndef LED_BUILTIN
  89. #define LED_BUILTIN PNUM_NOT_DEFINED
  90. #endif
  91. // On-board user button
  92. #ifndef USER_BTN
  93. #define USER_BTN PNUM_NOT_DEFINED
  94. #endif
  95. // SPI definitions
  96. #ifndef PIN_SPI_SS
  97. #define PIN_SPI_SS PA4
  98. #endif
  99. #ifndef PIN_SPI_SS1
  100. #define PIN_SPI_SS1 PA15
  101. #endif
  102. #ifndef PIN_SPI_SS2
  103. #define PIN_SPI_SS2 PNUM_NOT_DEFINED
  104. #endif
  105. #ifndef PIN_SPI_SS3
  106. #define PIN_SPI_SS3 PNUM_NOT_DEFINED
  107. #endif
  108. #ifndef PIN_SPI_MOSI
  109. #define PIN_SPI_MOSI PA7
  110. #endif
  111. #ifndef PIN_SPI_MISO
  112. #define PIN_SPI_MISO PA6
  113. #endif
  114. #ifndef PIN_SPI_SCK
  115. #define PIN_SPI_SCK PA5
  116. #endif
  117. // I2C definitions
  118. #ifndef PIN_WIRE_SDA
  119. #define PIN_WIRE_SDA PB3
  120. #endif
  121. #ifndef PIN_WIRE_SCL
  122. #define PIN_WIRE_SCL PB10
  123. #endif
  124. // Timer Definitions
  125. // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
  126. #ifndef TIMER_TONE
  127. #define TIMER_TONE TIM10
  128. #endif
  129. #ifndef TIMER_SERVO
  130. #define TIMER_SERVO TIM11
  131. #endif
  132. // UART Definitions
  133. #ifndef SERIAL_UART_INSTANCE
  134. #define SERIAL_UART_INSTANCE 2
  135. #endif
  136. // Default pin used for generic 'Serial' instance
  137. // Mandatory for Firmata
  138. #ifndef PIN_SERIAL_RX
  139. #define PIN_SERIAL_RX PA3
  140. #endif
  141. #ifndef PIN_SERIAL_TX
  142. #define PIN_SERIAL_TX PA2
  143. #endif
  144. // Extra HAL modules
  145. #ifndef HAL_SD_MODULE_DISABLED
  146. #define HAL_SD_MODULE_ENABLED
  147. #endif
  148. /*----------------------------------------------------------------------------
  149. * Arduino objects - C++ only
  150. *----------------------------------------------------------------------------*/
  151. #ifdef __cplusplus
  152. // These serial port names are intended to allow libraries and architecture-neutral
  153. // sketches to automatically default to the correct port name for a particular type
  154. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  155. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  156. //
  157. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  158. //
  159. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  160. //
  161. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  162. //
  163. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  164. //
  165. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  166. // pins are NOT connected to anything by default.
  167. #ifndef SERIAL_PORT_MONITOR
  168. #define SERIAL_PORT_MONITOR Serial
  169. #endif
  170. #ifndef SERIAL_PORT_HARDWARE
  171. #define SERIAL_PORT_HARDWARE Serial
  172. #endif
  173. #endif