variant.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2019, 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. #ifndef _VARIANT_ARDUINO_STM32_
  14. #define _VARIANT_ARDUINO_STM32_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif // __cplusplus
  18. /*----------------------------------------------------------------------------
  19. * Pins
  20. *----------------------------------------------------------------------------*/
  21. #define PA0 0
  22. #define PA1 1
  23. #define PA2 2
  24. #define PA3 3
  25. #define PA4 4
  26. #define PA5 5
  27. #define PA6 6
  28. #define PA7 7
  29. #define PA8 8
  30. #define PA9 9
  31. #define PA10 10
  32. #define PA11 11
  33. #define PA12 12
  34. #define PA13 13
  35. #define PA14 14
  36. #define PA15 15
  37. #define PB0 16
  38. #define PB1 17
  39. #define PB2 18
  40. #define PB3 19
  41. #define PB4 20
  42. #define PB5 21
  43. #define PB6 22
  44. #define PB7 23
  45. #define PB8 24
  46. #define PB9 25
  47. #define PB10 26
  48. #define PB11 27
  49. #define PB12 28
  50. #define PB13 29
  51. #define PB14 30
  52. #define PB15 31
  53. #define PC0 32
  54. #define PC1 33
  55. #define PC2 34
  56. #define PC3 35
  57. #define PC4 36
  58. #define PC5 37
  59. #define PC6 38
  60. #define PC7 39
  61. #define PC8 40
  62. #define PC9 41
  63. #define PC10 42
  64. #define PC11 43
  65. #define PC12 44
  66. #define PC13 45
  67. #define PC14 46
  68. #define PC15 47
  69. #define PD0 48
  70. #define PD1 49
  71. #define PD2 50
  72. #define PD3 51
  73. #define PD4 52
  74. #define PD5 53
  75. #define PD6 54
  76. #define PD7 55
  77. #define PD8 56
  78. #define PD9 57
  79. #define PD10 58
  80. #define PD11 59
  81. #define PD12 60
  82. #define PD13 61
  83. #define PD14 62
  84. #define PD15 63
  85. #define PE0 64
  86. #define PE1 65
  87. #define PE2 66
  88. #define PE3 67
  89. #define PE4 68
  90. #define PE5 69
  91. #define PE6 70
  92. #define PE7 71
  93. #define PE8 72
  94. #define PE9 73
  95. #define PE10 74
  96. #define PE11 75
  97. #define PE12 76
  98. #define PE13 77
  99. #define PE14 78
  100. #define PE15 79
  101. #define PF0 80
  102. #define PF1 81
  103. #define PF2 82
  104. #define PF3 83
  105. #define PF4 84
  106. #define PF5 85
  107. #define PF6 86
  108. #define PF7 87
  109. #define PF8 88
  110. #define PF9 89
  111. #define PF10 90
  112. #define PF11 91
  113. #define PF12 92
  114. #define PF13 93
  115. #define PF14 94
  116. #define PF15 95
  117. #define PG0 96
  118. #define PG1 97
  119. #define PG2 98
  120. #define PG3 99
  121. #define PG4 100
  122. #define PG5 101
  123. #define PG6 102
  124. #define PG7 103
  125. #define PG8 104
  126. #define PG9 105
  127. #define PG10 106
  128. #define PG11 107
  129. #define PG12 108
  130. #define PG13 109
  131. #define PG14 110
  132. #define PG15 111
  133. // This must be a literal
  134. #define NUM_DIGITAL_PINS 112
  135. #define NUM_ANALOG_INPUTS 21
  136. // On-board LED pin number
  137. #ifdef ARDUINO_VCCGND_F103ZET6_MINI
  138. #define LED_BUILTIN PG15
  139. #elif defined(ARDUINO_VCCGND_F103ZET6)
  140. #define LED_BUILTIN PC13
  141. #elif !defined(LED_BUILTIN)
  142. #define LED_BUILTIN PC13
  143. #endif
  144. // On-board user button
  145. #ifndef USER_BTN
  146. #define USER_BTN PB1
  147. #endif
  148. // SPI Definitions
  149. #ifdef ARDUINO_VCCGND_F103ZET6
  150. #define PIN_SPI_SS PA15
  151. #define PIN_SPI_MOSI PB5
  152. #define PIN_SPI_MISO PB4
  153. #define PIN_SPI_SCK PB3
  154. #else
  155. #define PIN_SPI_SS PC4
  156. #define PIN_SPI_MOSI PA7
  157. #define PIN_SPI_MISO PA6
  158. #define PIN_SPI_SCK PA5
  159. #endif
  160. // I2C Definitions
  161. #define PIN_WIRE_SDA PB7
  162. #define PIN_WIRE_SCL PB6
  163. // Timer Definitions (optional)
  164. // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
  165. #define TIMER_TONE TIM6 // TIMER_TONE must be defined in this file
  166. #define TIMER_SERVO TIM7 // TIMER_SERVO must be defined in this file
  167. // UART Definitions
  168. // Define here Serial instance number to map on Serial generic name
  169. #define SERIAL_UART_INSTANCE 1
  170. // Default pin used for 'Serial' instance (ex: ST-Link)
  171. // Mandatory for Firmata
  172. #define PIN_SERIAL_RX PA10
  173. #define PIN_SERIAL_TX PA9
  174. // Default pin used for 'Serial2' instance
  175. #define PIN_SERIAL2_RX PA3
  176. #define PIN_SERIAL2_TX PA2
  177. // Default pin used for 'Serial3' instance
  178. #define PIN_SERIAL3_RX PB11
  179. #define PIN_SERIAL3_TX PB10
  180. /* Extra HAL modules */
  181. #ifndef HAL_DAC_MODULE_ENABLED
  182. #define HAL_DAC_MODULE_ENABLED
  183. #endif
  184. #ifndef HAL_SD_MODULE_ENABLED
  185. #define HAL_SD_MODULE_ENABLED
  186. #endif
  187. #ifndef HAL_SRAM_MODULE_ENABLED
  188. #define HAL_SRAM_MODULE_ENABLED
  189. #endif
  190. #ifdef __cplusplus
  191. } // extern "C"
  192. #endif
  193. /*----------------------------------------------------------------------------
  194. * Arduino objects - C++ only
  195. *----------------------------------------------------------------------------*/
  196. #ifdef __cplusplus
  197. // These serial port names are intended to allow libraries and architecture-neutral
  198. // sketches to automatically default to the correct port name for a particular type
  199. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  200. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  201. //
  202. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  203. //
  204. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  205. //
  206. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  207. //
  208. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  209. //
  210. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  211. // pins are NOT connected to anything by default.
  212. #define SERIAL_PORT_MONITOR Serial
  213. #define SERIAL_PORT_HARDWARE Serial1
  214. #endif
  215. #endif /* _VARIANT_ARDUINO_STM32_ */