variant.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 0 //D0
  24. #define PA1 1 //D1
  25. #define PA2 2 //D2
  26. #define PA3 3 //D3
  27. #define PA4 4 //D4
  28. #define PA5 5 //D5
  29. #define PA6 6 //D6
  30. #define PA7 7 //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 16 //D16
  40. #define PB1 17 //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 32 //D32
  56. #define PC1 33 //D33
  57. #define PC2 34 //D34
  58. #define PC3 35 //D35
  59. #define PC4 36 //D36
  60. #define PC5 37 //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 with the same value as PEND
  104. #define NUM_DIGITAL_PINS 87
  105. // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
  106. #define NUM_ANALOG_INPUTS 7
  107. #define NUM_ANALOG_FIRST 80
  108. // PWM resolution
  109. #define PWM_RESOLUTION 8
  110. #define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans
  111. #define PWM_MAX_DUTY_CYCLE 255
  112. // SPI Definitions
  113. #define PIN_SPI_SS PA4
  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 PB9
  119. #define PIN_WIRE_SCL PB8
  120. // Timer Definitions
  121. // Do not use timer used by PWM pin. See PinMap_PWM.
  122. #define TIMER_TONE TIM6
  123. #define TIMER_SERVO TIM2
  124. #define TIMER_SERIAL TIM7
  125. // UART Definitions
  126. //#define SERIAL_UART_INSTANCE 1 // Connected to EXP3 header
  127. /* Enable Serial 3 */
  128. #define HAVE_HWSERIAL1
  129. #define HAVE_HWSERIAL3
  130. // Default pin used for 'Serial' instance (ex: ST-Link)
  131. // Mandatory for Firmata
  132. #define PIN_SERIAL_RX PA10
  133. #define PIN_SERIAL_TX PA9
  134. /* HAL configuration */
  135. #define HSE_VALUE 12000000U
  136. #define FLASH_PAGE_SIZE ((uint32_t)(4*1024))
  137. #ifdef __cplusplus
  138. } // extern "C"
  139. #endif
  140. /*----------------------------------------------------------------------------
  141. * Arduino objects - C++ only
  142. *----------------------------------------------------------------------------*/
  143. #ifdef __cplusplus
  144. // These serial port names are intended to allow libraries and architecture-neutral
  145. // sketches to automatically default to the correct port name for a particular type
  146. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  147. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  148. //
  149. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  150. //
  151. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  152. //
  153. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  154. //
  155. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  156. //
  157. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  158. // pins are NOT connected to anything by default.
  159. #define SERIAL_PORT_MONITOR Serial
  160. #define SERIAL_PORT_HARDWARE_OPEN Serial
  161. #endif
  162. #endif /* _VARIANT_ARDUINO_STM32_ */