variant.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. // This must be a literal
  102. #define NUM_DIGITAL_PINS 80
  103. #define NUM_ANALOG_INPUTS 16
  104. // On-board LED pin number
  105. #ifndef LED_BUILTIN
  106. #define LED_BUILTIN PB11
  107. #endif
  108. // On-board user button
  109. #ifndef USER_BTN
  110. #define USER_BTN PC13
  111. #endif
  112. // SPI Definitions
  113. #define PIN_SPI_SS PC4
  114. #define PIN_SPI_MOSI PA7
  115. #define PIN_SPI_MISO PA6
  116. #define PIN_SPI_SCK PA5
  117. // I2C Definitions
  118. #define PIN_WIRE_SDA PB7
  119. #define PIN_WIRE_SCL PB6
  120. // Timer Definitions (optional)
  121. // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
  122. #ifndef TIMER_TONE
  123. #define TIMER_TONE TIM6 // TIMER_TONE must be defined in this file
  124. #endif
  125. #ifndef TIMER_SERVO
  126. #define TIMER_SERVO TIM7 // TIMER_SERVO must be defined in this file
  127. #endif
  128. // UART Definitions
  129. // Define here Serial instance number to map on Serial generic name
  130. #define SERIAL_UART_INSTANCE 1
  131. // Extra HAL modules
  132. #if defined(STM32F103xE) || defined(STM32F103xG)
  133. #ifndef HAL_DAC_MODULE_ENABLED
  134. #define HAL_DAC_MODULE_ENABLED
  135. #endif
  136. #ifndef HAL_SD_MODULE_ENABLED
  137. #define HAL_SD_MODULE_ENABLED
  138. #endif
  139. #ifndef HAL_SRAM_MODULE_ENABLED
  140. #define HAL_SRAM_MODULE_ENABLED
  141. #endif
  142. #endif
  143. // Default pin used for 'Serial' instance (ex: ST-Link)
  144. // Mandatory for Firmata
  145. #define PIN_SERIAL_RX PA10
  146. #define PIN_SERIAL_TX PA9
  147. #ifdef __cplusplus
  148. } // extern "C"
  149. #endif
  150. /*----------------------------------------------------------------------------
  151. * Arduino objects - C++ only
  152. *----------------------------------------------------------------------------*/
  153. #ifdef __cplusplus
  154. // These serial port names are intended to allow libraries and architecture-neutral
  155. // sketches to automatically default to the correct port name for a particular type
  156. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  157. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  158. //
  159. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  160. //
  161. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  162. //
  163. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  164. //
  165. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  166. //
  167. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  168. // pins are NOT connected to anything by default.
  169. #define SERIAL_PORT_MONITOR Serial
  170. #define SERIAL_PORT_HARDWARE Serial1
  171. #endif
  172. #endif /* _VARIANT_ARDUINO_STM32_ */