variant.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. Copyright (c) 2011 Arduino. All right reserved.
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with this library; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14. */
  15. #ifndef _VARIANT_ARDUINO_STM32_
  16. #define _VARIANT_ARDUINO_STM32_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif // __cplusplus
  20. /*----------------------------------------------------------------------------
  21. * Pins
  22. *----------------------------------------------------------------------------*/
  23. #define PA0 PIN_A7 //D0
  24. #define PA1 PIN_A8 //D1
  25. #define PA2 PIN_A9 //D2
  26. #define PA3 PIN_A0 //D3
  27. #define PA4 PIN_A1 //D4
  28. #define PA5 PIN_A10 //D5
  29. #define PA6 PIN_A11 //D6
  30. #define PA7 PIN_A12 //D7
  31. #define PA8 8 //D8
  32. #define PA9 9 //D9
  33. #define PA10 10 //D10
  34. #define PA11 11 //D11
  35. #define PA12 12 //D12
  36. #define PA13 13 //D13
  37. #define PA14 14 //D14
  38. #define PA15 15 //D15
  39. #define PB0 PIN_A13 //D16
  40. #define PB1 PIN_A14 //D17
  41. #define PB2 18 //D18
  42. #define PB3 19 //D19
  43. #define PB4 20 //D20
  44. #define PB5 21 //D21
  45. #define PB6 22 //D22
  46. #define PB7 23 //D23
  47. #define PB8 24 //D24
  48. #define PB9 25 //D25
  49. #define PB10 26 //D26
  50. #define PB11 27 //D27
  51. #define PB12 28 //D28
  52. #define PB13 29 //D29
  53. #define PB14 30 //D30
  54. #define PB15 31 //D31
  55. #define PC0 PIN_A2 //D32
  56. #define PC1 PIN_A3 //D33
  57. #define PC2 PIN_A4 //D34
  58. #define PC3 PIN_A5 //D35
  59. #define PC4 PIN_A6 //D36
  60. #define PC5 PIN_A15 //D37
  61. #define PC6 38 //D38
  62. #define PC7 39 //D39
  63. #define PC8 40 //D40
  64. #define PC9 41 //D41
  65. #define PC10 42 //D42
  66. #define PC11 43 //D43
  67. #define PC12 44 //D44
  68. #define PC13 45 //D45
  69. #define PC14 46 //D46
  70. #define PC15 47 //D47
  71. #define PD0 48 //D48
  72. #define PD1 49 //D49
  73. #define PD2 50 //D50
  74. #define PD3 51 //D51
  75. #define PD4 52 //D52
  76. #define PD5 53 //D53
  77. #define PD6 54 //D54
  78. #define PD7 55 //D55
  79. #define PD8 56 //D56
  80. #define PD9 57 //D57
  81. #define PD10 58 //D58
  82. #define PD11 59 //D59
  83. #define PD12 60 //D60
  84. #define PD13 61 //D61
  85. #define PD14 62 //D62
  86. #define PD15 63 //D63
  87. #define PE0 64 //D64
  88. #define PE1 65 //D65
  89. #define PE2 66 //D66
  90. #define PE3 67 //D67
  91. #define PE4 68 //D68
  92. #define PE5 69 //D69
  93. #define PE6 70 //D70
  94. #define PE7 71 //D71
  95. #define PE8 72 //D72
  96. #define PE9 73 //D73
  97. #define PE10 74 //D74
  98. #define PE11 75 //D75
  99. #define PE12 76 //D76
  100. #define PE13 77 //D77
  101. #define PE14 78 //D78
  102. #define PE15 79 //D79
  103. // This must be a literal
  104. #define NUM_DIGITAL_PINS 80
  105. // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
  106. #define NUM_ANALOG_INPUTS 16
  107. // PWM resolution
  108. #define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans
  109. #define PWM_MAX_DUTY_CYCLE 255
  110. // On-board LED pin number
  111. #define LED_BUILTIN PB14
  112. #define LED_HEARTBEAT LED_BUILTIN
  113. // SPI Definitions
  114. #define PIN_SPI_SS PA4
  115. #define PIN_SPI_MOSI PA7
  116. #define PIN_SPI_MISO PA6
  117. #define PIN_SPI_SCK PA5
  118. // I2C Definitions
  119. #define PIN_WIRE_SDA PB9
  120. #define PIN_WIRE_SCL PB8
  121. // Timer Definitions
  122. // Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
  123. #ifndef TIMER_TONE
  124. #define TIMER_TONE TIM6 // TIMER_TONE must be defined in this file
  125. #endif
  126. #ifndef TIMER_SERVO
  127. #define TIMER_SERVO TIM7 // TIMER_SERVO must be defined in this file
  128. #endif
  129. #ifndef TIMER_SERIAL
  130. #define TIMER_SERIAL TIM9 // TIMER_SERIAL must be defined in this file
  131. #endif
  132. // UART Definitions
  133. #define SERIAL_UART_INSTANCE 1 // Connected to EXP3 header
  134. // Default pin used for 'Serial' instance (ex: ST-Link)
  135. // Mandatory for Firmata
  136. #define PIN_SERIAL_RX PA10
  137. #define PIN_SERIAL_TX PA9
  138. /* HAL configuration */
  139. #define HSE_VALUE 12000000U
  140. #ifdef __cplusplus
  141. } // extern "C"
  142. #endif
  143. /*----------------------------------------------------------------------------
  144. * Arduino objects - C++ only
  145. *----------------------------------------------------------------------------*/
  146. #ifdef __cplusplus
  147. // These serial port names are intended to allow libraries and architecture-neutral
  148. // sketches to automatically default to the correct port name for a particular type
  149. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  150. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  151. //
  152. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  153. //
  154. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  155. //
  156. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  157. //
  158. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  159. //
  160. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  161. // pins are NOT connected to anything by default.
  162. #define SERIAL_PORT_MONITOR Serial
  163. #define SERIAL_PORT_HARDWARE_OPEN Serial
  164. #endif
  165. #endif /* _VARIANT_ARDUINO_STM32_ */