variant.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 PB12 27 //D27
  51. #define PB13 28 //D28
  52. #define PB14 29 //D29
  53. #define PB15 30 //D30
  54. #define PC0 31 //D31
  55. #define PC1 32 //D32
  56. #define PC2 33 //D33
  57. #define PC3 34 //D34
  58. #define PC4 35 //D35
  59. #define PC5 36 //D36
  60. #define PC6 37 //D37
  61. #define PC7 38 //D38
  62. #define PC8 39 //D39
  63. #define PC9 40 //D40
  64. #define PC10 41 //D41
  65. #define PC11 42 //D42
  66. #define PC12 43 //D43
  67. #define PC13 44 //D44
  68. #define PC14 45 //D45
  69. #define PC15 46 //D46
  70. #define PD2 47 //D47
  71. #define PH0 48 //D48
  72. #define PH1 49 //D49
  73. // This must be a literal
  74. #define NUM_DIGITAL_PINS 66
  75. // This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
  76. #define NUM_ANALOG_INPUTS 16
  77. #define NUM_ANALOG_FIRST 50
  78. /*
  79. // PWM resolution
  80. #define PWM_RESOLUTION 8
  81. #define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans
  82. #define PWM_MAX_DUTY_CYCLE 255
  83. */
  84. // SPI Definitions
  85. #define PIN_SPI_MOSI PC12
  86. #define PIN_SPI_MISO PC11
  87. #define PIN_SPI_SCK PC10
  88. #define PIN_SPI_SS PA15
  89. // Timer Definitions
  90. // TIM1 - Hardware PWM (HB)
  91. // TIM2 - TIMER_SERVO
  92. // TIM3 - Hardware PWM (FAN0/1/2, HE0)
  93. // TIM4 - Hardware PWM (LED_R/G/B)
  94. // TIM5 - TIMER_TONE
  95. // TIM9 - STEP_TIMER
  96. // TIM10 - TEMP_TIMER
  97. // TIM11 -
  98. #define TIMER_SERVO TIM2 // TIMER_SERVO must be defined in this file
  99. #define TIMER_TONE TIM5 // TIMER_TONE must be defined in this file
  100. // UART Definitions
  101. #define SERIAL_UART_INSTANCE 1
  102. // Default pin used for 'Serial' instance (ex: ST-Link)
  103. // Mandatory for Firmata
  104. #define PIN_SERIAL_RX PA10
  105. #define PIN_SERIAL_TX PA9
  106. #ifdef __cplusplus
  107. } // extern "C"
  108. #endif
  109. /*----------------------------------------------------------------------------
  110. * Arduino objects - C++ only
  111. *----------------------------------------------------------------------------*/
  112. #ifdef __cplusplus
  113. // These serial port names are intended to allow libraries and architecture-neutral
  114. // sketches to automatically default to the correct port name for a particular type
  115. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  116. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  117. //
  118. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  119. //
  120. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  121. //
  122. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  123. //
  124. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  125. //
  126. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  127. // pins are NOT connected to anything by default.
  128. #define SERIAL_PORT_MONITOR Serial
  129. #define SERIAL_PORT_HARDWARE Serial
  130. #endif
  131. #endif /* _VARIANT_ARDUINO_STM32_ */