variant.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif // __cplusplus
  5. // STM32F103VET6 | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL |
  6. //------------------|-------------|---------------|------------|-----------|----------------------|------------|
  7. #define PA0 0 // | | A0 Nozzle T°c | | | | |
  8. #define PA1 1 // | | A1 Bed T°c | | | | |
  9. #define PA2 2 // | | | USART2_TX | | | |
  10. #define PA3 3 // | | DAC_OUT1** | USART2_RX | | | |
  11. #define PA4 4 // | | DAC_OUT2** | | | SPI1_SS*(wired?) | |
  12. #define PA5 5 // | O | | | | SPI1_SCK EEPROM | |
  13. #define PA6 6 // | I | | | | SPI1_MISO EEPROM | |
  14. #define PA7 7 // | O | | | | SPI1_MOSI EEPROM | |
  15. #define PA8 8 // | Od BED | | | | | |
  16. #define PA9 9 // | | | USART1_TX | | | |
  17. #define PA10 10 // | | | USART1_RX | | | |
  18. #define PA11 11 // | I | | | | | USB_DM |
  19. #define PA12 12 // | I | | | | | USB_DP |
  20. #define PA13 13 // | I | | | | | SWD_SWDIO |
  21. #define PA14 14 // | I | | | | | SWD_SWCLK |
  22. #define PA15 15 // | Od FAN | | | | | |
  23. // |-------------|---------------|------------|-----------|----------------------|------------|
  24. #define PB0 16 // | | | | | | |
  25. #define PB1 17 // | | | | | | |
  26. #define PB2 18 // | I+ | | | | | BOOT1 |
  27. #define PB3 19 // | O X_DIR | | | | | |
  28. #define PB4 20 // | O X_STEP | | | | | |
  29. #define PB5 21 // | O X_EN | | | | | |
  30. #define PB6 22 // | O Y_DIR | | | | | |
  31. #define PB7 23 // | O Y_STEP | | | | | |
  32. #define PB8 24 // | O Y_EN | | | | | |
  33. #define PB9 25 // | O Z_DIR | | | | | |
  34. #define PB10 26 // | I+ | | USART3_TX* | TWI2_SCL* | | |
  35. #define PB11 27 // | I+ | | USART3_RX* | TWI2_SDA* | | |
  36. #define PB12 28 // | O TFT | | | | SPI2_SS | TOUCH_CS |
  37. #define PB13 29 // | O TFT | | | | SPI2_SCK | TOUCH_SCK |
  38. #define PB14 30 // | O TFT | | | | SPI2_MISO (bad>MOSI) | TOUCH_MOSI |
  39. #define PB15 31 // | I TFT | | | | SPI2_MOSI (bad>MISO) | TOUCH_MISO |
  40. // |-------------|---------------|------------|-----------|----------------------|------------|
  41. #define PC0 32 // | I E_OUT | | | | | |
  42. #define PC1 33 // | I+ X_MIN | | | | | |
  43. #define PC2 34 // | O LED | | | | | |
  44. #define PC3 35 // | I+ | | | | | |
  45. #define PC4 36 // | O TFT | | | | | TFT RESET |
  46. #define PC5 37 // | O CS1 | | | | for SPI1 EEPROM CS | |
  47. #define PC6 38 // | I TFT | | | | | TOUCH_INT |
  48. #define PC7 39 // | | | | | | |
  49. #define PC8 40 // | x SDIO | | | | | SD_D0 |
  50. #define PC9 41 // | x SDIO | | | | | SD_D1 |
  51. #define PC10 42 // | x SDIO | | | | | SD_D2 |
  52. #define PC11 43 // | x SDIO | | | | | SD_D3 |
  53. #define PC12 44 // | O SDIO | | | | | SD_CLK |
  54. #define PC13 45 // | I | | | | | |
  55. #define PC14 46 // | I+ Y_MAX | | | | | |
  56. #define PC15 47 // | I+ Y_MIN | | | | | |
  57. // |-------------|---------------|------------|-----------|----------------------|------------|
  58. #define PD0 48 // | O TFT | | | | | OSC_IN D2 |
  59. #define PD1 49 // | O TFT | | | | | OSC_OUT D3 |
  60. #define PD2 50 // | O SDIO | | | | | SD_CMD |
  61. #define PD3 51 // | Od NOZZLE | | | | | |
  62. #define PD4 52 // | O TFT | | | | | FSMC_NOE |
  63. #define PD5 53 // | O TFT | | | | | FSMC_NWE |
  64. #define PD6 54 // | I wired?* | | | | | FSMC_NWAIT*|
  65. #define PD7 55 // | O TFT | | | | | FSMC_NE1/CS|
  66. #define PD8 56 // | O TFT | | | | | FSMC_D13 |
  67. #define PD9 57 // | O TFT | | | | | FSMC_D14 |
  68. #define PD10 58 // | O TFT | | | | | FSMC_D15 |
  69. #define PD11 59 // | O TFT | | | | | FSMC_A16 |
  70. #define PD12 60 // | O TFT | | | | | TFT BL |
  71. #define PD13 61 // | Od PWM* | | | | | SERVO0 |
  72. #define PD14 62 // | O TFT | | | | | FSMC_D00 |
  73. #define PD15 63 // | O TFT | | | | | FSMC_D01 |
  74. // |-------------|---------------|------------|-----------|----------------------|------------|
  75. #define PE0 64 // | O Z_STEP | | | | | |
  76. #define PE1 65 // | O Z_EN | | | | | |
  77. #define PE2 66 // | O E0_DIR | | | | | |
  78. #define PE3 67 // | O E0_STEP | | | | | |
  79. #define PE4 68 // | O E0_EN | | | | | |
  80. #define PE5 69 // | I+ Z_MAX | | | | | |
  81. #define PE6 70 // | I+ Z_MIN | | | | | |
  82. #define PE7 71 // | O TFT | | | | | FSMC_D04 |
  83. #define PE8 72 // | O TFT | | | | | FSMC_D05 |
  84. #define PE9 73 // | O TFT | | | | | FSMC_D06 |
  85. #define PE10 74 // | O TFT | | | | | FSMC_D07 |
  86. #define PE11 75 // | O TFT | | | | | FSMC_D08 |
  87. #define PE12 76 // | O TFT | | | | | FSMC_D09 |
  88. #define PE13 77 // | O TFT | | | | | FSMC_D10 |
  89. #define PE14 78 // | O TFT | | | | | FSMC_D11 |
  90. #define PE15 79 // | O TFT | | | | | FSMC_D12 |
  91. //------------------|-------------|---------------|------------|-----------|----------------------|------------|
  92. // This must be a literal
  93. #define NUM_DIGITAL_PINS 80
  94. #define NUM_ANALOG_INPUTS 16 // 2 first are used, but cant be reduced to 2...
  95. // On-board LED pin number
  96. #ifndef LED_BUILTIN
  97. #define LED_BUILTIN PC2
  98. #endif
  99. // On-board user button (not wired)
  100. #ifndef USER_BTN
  101. #define USER_BTN PC13
  102. #endif
  103. // SPI Definition (SPI1 EEPROM)
  104. #define PIN_SPI_SS PC5
  105. #define PIN_SPI_MOSI PA7
  106. #define PIN_SPI_MISO PA6
  107. #define PIN_SPI_SCK PA5
  108. // I2C Definition (Unused)
  109. #define PIN_WIRE_SDA PB11
  110. #define PIN_WIRE_SCL PB10
  111. // Timer Definitions
  112. // Leave TIMER 2 for optional Fan PWM
  113. #define TEMP_TIMER 3
  114. // Leave TIMER 4 for TFT backlight PWM or Servo freq...
  115. #define STEP_TIMER 5
  116. #define TIMER_TONE TIM6 // TIMER_TONE must be defined in this file
  117. #define TIMER_SERVO TIM7 // TIMER_SERVO must be defined in this file
  118. #define TIMER_SERIAL TIM8 // TIMER_SERIAL must be defined in this file
  119. // UART Definitions
  120. // Define here Serial instance number to map on Serial generic name
  121. #define SERIAL_UART_INSTANCE 1
  122. // Default pin used for 'Serial' instance (linked to CH340 USB port)
  123. #define PIN_SERIAL_RX PA10
  124. #define PIN_SERIAL_TX PA9
  125. #define PIN_SERIAL1_RX PA10
  126. #define PIN_SERIAL1_TX PA9
  127. // Default pin used for 'Serial2' instance (connector exists but unsoldered)
  128. #define PIN_SERIAL2_RX PA3
  129. #define PIN_SERIAL2_TX PA2
  130. // Extra HAL modules
  131. #ifdef STM32F103xE
  132. #ifndef HAL_DAC_MODULE_ENABLED
  133. //#define HAL_DAC_MODULE_ENABLED (unused or maybe for the eeprom write?)
  134. #endif
  135. #ifndef HAL_SD_MODULE_ENABLED
  136. #define HAL_SD_MODULE_ENABLED
  137. #endif
  138. #ifndef HAL_SRAM_MODULE_ENABLED
  139. #define HAL_SRAM_MODULE_ENABLED
  140. #endif
  141. #endif
  142. #ifdef __cplusplus
  143. } // extern "C"
  144. #endif
  145. /*----------------------------------------------------------------------------
  146. * Arduino objects - C++ only
  147. *----------------------------------------------------------------------------*/
  148. #ifdef __cplusplus
  149. // These serial port names are intended to allow libraries and architecture-neutral
  150. // sketches to automatically default to the correct port name for a particular type
  151. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  152. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  153. //
  154. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  155. //
  156. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  157. //
  158. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  159. //
  160. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  161. //
  162. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  163. // pins are NOT connected to anything by default.
  164. #define SERIAL_PORT_MONITOR Serial1
  165. #define SERIAL_PORT_HARDWARE Serial1
  166. #define SERIAL_PORT_HARDWARE_OPEN Serial2
  167. #endif