variant.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. #pragma once
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif // __cplusplus
  34. //
  35. /*----------------------------------------------------------------------------
  36. * Pins
  37. *----------------------------------------------------------------------------*/
  38. // | DIGITAL | ANALOG IN | ANALOG OUT | UART/USART | TWI | SPI | SPECIAL |
  39. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  40. #define PA0 PIN_A0 // | 0 | A0 (ADC1) | | UART4_TX | | | |
  41. #define PA1 PIN_A1 // | 1 | A1 (ADC1) | | UART4_RX | | | |
  42. #define PA2 PIN_A2 // | 2 | A2 (ADC1) | | USART2_TX | | | |
  43. #define PA3 PIN_A3 // | 3 | A3 (ADC1) | | USART2_RX | | | |
  44. #define PA4 PIN_A4 // | 4 | A4 (ADC1) | DAC_OUT1 | | | SPI1_SS, (SPI3_SS) | |
  45. #define PA5 PIN_A5 // | 5 | A5 (ADC1) | DAC_OUT2 | | | SPI1_SCK | |
  46. #define PA6 PIN_A6 // | 6 | A6 (ADC1) | | | | SPI1_MISO | |
  47. #define PA7 PIN_A7 // | 7 | A7 (ADC1) | | | | SPI1_MOSI | |
  48. #define PA8 8 // | 8 | | | | TWI3_SCL | | |
  49. #define PA9 9 // | 9 | | | USART1_TX | | | |
  50. #define PA10 10 // | 10 | | | USART1_RX | | | |
  51. #define PA11 11 // | 11 | | | | | | |
  52. #define PA12 12 // | 12 | | | | | | |
  53. #define PA13 13 // | 13 | | | | | | SWD_SWDIO |
  54. #define PA14 14 // | 14 | | | | | | SWD_SWCLK |
  55. #define PA15 15 // | 15 | | | | | SPI3_SS, (SPI1_SS) | |
  56. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  57. #define PB0 PIN_A8 // | 16 | A8 (ADC1) | | | | | |
  58. #define PB1 PIN_A9 // | 17 | A9 (ADC1) | | | | | |
  59. #define PB2 18 // | 18 | | | | | | BOOT1 |
  60. #define PB3 19 // | 19 | | | | | SPI3_SCK, (SPI1_SCK) | |
  61. #define PB4 20 // | 20 | | | | | SPI3_MISO, (SPI1_MISO) | |
  62. #define PB5 21 // | 21 | | | | | SPI3_MOSI, (SPI1_MOSI) | |
  63. #define PB6 22 // | 22 | | | USART1_TX | TWI1_SCL | | |
  64. #define PB7 23 // | 23 | | | USART1_RX | TWI1_SDA | | |
  65. #define PB8 24 // | 24 | | | | TWI1_SCL | | |
  66. #define PB9 25 // | 25 | | | | TWI1_SDA | SPI2_SS | |
  67. #define PB10 26 // | 26 | | | USART3_TX, (UART4_TX) | TWI2_SCL | SPI2_SCK | |
  68. #define PB11 27 // | 27 | | | USART3_RX | TWI2_SDA | | |
  69. #define PB12 28 // | 28 | | | | | SPI2_SS | |
  70. #define PB13 29 // | 29 | | | | | SPI2_SCK | |
  71. #define PB14 30 // | 30 | | | | | SPI2_MISO | |
  72. #define PB15 31 // | 31 | | | | | SPI2_MOSI | |
  73. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  74. #define PC0 PIN_A10 // | 32 | A10 (ADC1) | | | | | |
  75. #define PC1 PIN_A11 // | 33 | A11 (ADC1) | | | | | |
  76. #define PC2 PIN_A12 // | 34 | A12 (ADC1) | | | | SPI2_MISO | |
  77. #define PC3 PIN_A13 // | 35 | A13 (ADC1) | | | | SPI2_MOSI | |
  78. #define PC4 PIN_A14 // | 36 | A14 (ADC1) | | | | | |
  79. #define PC5 PIN_A15 // | 37 | A15 (ADC1) | | USART3_RX | | | |
  80. #define PC6 38 // | 38 | | | USART6_TX | | | |
  81. #define PC7 39 // | 39 | | | USART6_RX | | | |
  82. #define PC8 40 // | 40 | | | | | | |
  83. #define PC9 41 // | 41 | | | USART3_TX | TWI3_SDA | | |
  84. #define PC10 42 // | 42 | | | | | SPI3_SCK | |
  85. #define PC11 43 // | 43 | | | USART3_RX, (UART4_RX) | | SPI3_MISO | |
  86. #define PC12 44 // | 44 | | | UART5_TX | | SPI3_MOSI | |
  87. #define PC13 45 // | 45 | | | | | | |
  88. #define PC14 46 // | 46 | | | | | | OSC32_IN |
  89. #define PC15 47 // | 47 | | | | | | OSC32_OUT |
  90. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  91. #define PD0 48 // | 48 | | | | | | |
  92. #define PD1 49 // | 49 | | | | | | |
  93. #define PD2 50 // | 50 | | | UART5_RX | | | |
  94. #define PD3 51 // | 51 | | | | | | |
  95. #define PD4 52 // | 52 | | | | | | |
  96. #define PD5 53 // | 53 | | | USART2_TX | | | |
  97. #define PD6 54 // | 54 | | | USART2_RX | | | |
  98. #define PD7 55 // | 55 | | | | | | |
  99. #define PD8 56 // | 56 | | | USART3_TX | | | |
  100. #define PD9 57 // | 57 | | | USART3_RX | | | |
  101. #define PD10 58 // | 58 | | | | | | |
  102. #define PD11 59 // | 59 | | | | | | |
  103. #define PD12 60 // | 60 | | | | | | |
  104. #define PD13 61 // | 61 | | | | | | |
  105. #define PD14 62 // | 62 | | | | | | |
  106. #define PD15 63 // | 63 | | | | | | |
  107. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  108. #define PE0 64 // | 64 | | | | | | |
  109. #define PE1 65 // | 65 | | | | | | |
  110. #define PE2 66 // | 66 | | | | | | |
  111. #define PE3 67 // | 67 | | | | | | |
  112. #define PE4 68 // | 68 | | | | | | |
  113. #define PE5 69 // | 69 | | | | | | |
  114. #define PE6 70 // | 70 | | | | | | |
  115. #define PE7 71 // | 71 | | | | | | |
  116. #define PE8 72 // | 72 | | | | | | |
  117. #define PE9 73 // | 73 | | | | | | |
  118. #define PE10 74 // | 74 | | | | | | |
  119. #define PE11 75 // | 75 | | | | | | |
  120. #define PE12 76 // | 76 | | | | | | |
  121. #define PE13 77 // | 77 | | | | | | |
  122. #define PE14 78 // | 78 | | | | | | |
  123. #define PE15 79 // | 79 | | | | | | |
  124. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  125. #define PH0 80 // | 80 | | | | | | OSC_IN |
  126. #define PH1 81 // | 81 | | | | | | OSC_OUT |
  127. // |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------|
  128. // This must be a literal
  129. #define NUM_DIGITAL_PINS 82
  130. #define NUM_ANALOG_INPUTS 16
  131. // Below SPI and I2C definitions already done in the core
  132. // Could be redefined here if differs from the default one
  133. // SPI Definitions
  134. #define PIN_SPI_SS PC9
  135. #define PIN_SPI_SCK PC10
  136. #define PIN_SPI_MISO PC11
  137. #define PIN_SPI_MOSI PC12
  138. // I2C Definitions
  139. #define PIN_WIRE_SCL PB8
  140. #define PIN_WIRE_SDA PB9
  141. // Timer Definitions
  142. // Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
  143. // TIM1 = HEATER0, HEATER1, [SERVO]
  144. // TIM2 = FAN1, FAN2, [BEEPER]
  145. // TIM4 = HEATER_BED
  146. // TIM5 = HEATER2, FAN0
  147. // Uses default for STM32F4xx STEP_TIMER 6 and TEMP_TIMER 14
  148. #define TIMER_SERVO TIM1 // TIMER_SERVO must be defined in this file
  149. #define TIMER_TONE TIM2 // TIMER_TONE must be defined in this file
  150. #define TIMER_SERIAL TIM3 // TIMER_SERIAL must be defined in this file
  151. // USART1 (direct to RK3328 SoC)
  152. #define ENABLE_HWSERIAL1
  153. #define PIN_SERIAL1_TX PA9
  154. #define PIN_SERIAL1_RX PA10
  155. // USART3 connector
  156. #define ENABLE_HWSERIAL3
  157. #define PIN_SERIAL3_TX PB10
  158. #define PIN_SERIAL3_RX PB11
  159. #ifdef __cplusplus
  160. } // extern "C"
  161. #endif
  162. /*----------------------------------------------------------------------------
  163. * Arduino objects - C++ only
  164. *----------------------------------------------------------------------------*/
  165. #ifdef __cplusplus
  166. // These serial port names are intended to allow libraries and architecture-neutral
  167. // sketches to automatically default to the correct port name for a particular type
  168. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  169. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  170. //
  171. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  172. //
  173. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  174. //
  175. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  176. //
  177. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  178. //
  179. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  180. // pins are NOT connected to anything by default.
  181. #define SERIAL_PORT_MONITOR Serial1
  182. #define SERIAL_PORT_USBVIRTUAL SerialUSB
  183. #define SERIAL_PORT_HARDWARE Serial1
  184. #define SERIAL_PORT_HARDWARE1 Serial3
  185. #define SERIAL_PORT_HARDWARE_OPEN Serial1
  186. #define SERIAL_PORT_HARDWARE_OPEN1 Serial3
  187. #endif