variant.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2017, STMicroelectronics
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *******************************************************************************
  29. */
  30. #pragma once
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif // __cplusplus
  34. /*----------------------------------------------------------------------------
  35. * Pins
  36. *----------------------------------------------------------------------------*/
  37. // Left Side
  38. #define PB12 0
  39. #define PB13 1
  40. #define PB14 2
  41. #define PB15 3
  42. #define PD8 4
  43. #define PD9 5
  44. #define PD10 6
  45. #define PD11 7
  46. #define PD12 8
  47. #define PD13 9
  48. #define PD14 10
  49. #define PD15 11
  50. #define PG2 12
  51. #define PG3 13
  52. #define PG4 14
  53. #define PG5 15
  54. #define PG6 16
  55. #define PG7 17
  56. #define PG8 18
  57. #define PC6 19
  58. #define PC7 20
  59. #define PC8 21
  60. #define PC9 22
  61. #define PA8 23
  62. #define PA9 24
  63. #define PA10 25
  64. #define PA11 26 // USB_DM
  65. #define PA12 27 // USB_DP
  66. #define PA13 28
  67. #define PA14 29
  68. #define PA15 30
  69. #define PC10 31
  70. #define PC11 32
  71. #define PC12 33
  72. #define PD0 34
  73. #define PD1 35
  74. #define PD2 36
  75. #define PD3 37
  76. #define PD4 38
  77. #define PD5 39
  78. #define PD6 40
  79. #define PD7 41
  80. #define PG9 42
  81. #define PG10 43
  82. #define PG11 44
  83. #define PG12 45
  84. #define PG13 46
  85. #define PG14 47
  86. #define PG15 48
  87. #define PB3 49
  88. #define PB4 50
  89. #define PB5 51
  90. #define PB6 52
  91. #define PB7 53
  92. #define PB8 54
  93. #define PB9 55
  94. // Right Side
  95. #define PB10 56
  96. #define PB11 57
  97. #define PE14 58
  98. #define PE15 59
  99. #define PE12 60
  100. #define PE13 61
  101. #define PE10 62
  102. #define PE11 63
  103. #define PE8 64
  104. #define PE9 65
  105. #define PG1 66
  106. #define PE7 67
  107. #define PF15 68
  108. #define PG0 69
  109. #define PF13 70
  110. #define PF14 71
  111. #define PF11 72
  112. #define PF12 73
  113. #define PB2 74
  114. #define PB1 75 // A0
  115. #define PC5 76 // A1
  116. #define PB0 77 // A2
  117. #define PA7 78 // A3
  118. #define PC4 79 // A4
  119. #define PA5 80 // A5
  120. #define PA6 81 // A6
  121. #define PA3 82 // A7
  122. #define PA4 83 // A8
  123. #define PA1 84 // A9
  124. #define PA2 85 // A10
  125. #define PC3 86 // A11
  126. #define PA0 87 // A12/PA_0(WK_UP): BUT K_UP)
  127. #define PC1 88 // A13
  128. #define PC2 89 // A14
  129. #define PC0 90 // A15
  130. #define PF8 91 // A16
  131. #define PF6 92 // A17
  132. #define PF7 93 // A18
  133. #define PF9 94 // LED D1 (active low)
  134. #define PF10 95 // LED D2 (active low)
  135. #define PF4 96
  136. #define PF5 97
  137. #define PF2 98
  138. #define PF3 99
  139. #define PF0 100
  140. #define PF1 101
  141. #define PE6 102
  142. #define PC13 103
  143. #define PE4 104 // BUT K0
  144. #define PE5 105 // BUT K1
  145. #define PE2 106
  146. #define PE3 107
  147. #define PE0 108
  148. #define PE1 109
  149. #define PC14 110
  150. #define PC15 111
  151. // This must be a literal
  152. #define NUM_DIGITAL_PINS 112
  153. // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
  154. #define NUM_ANALOG_INPUTS 23
  155. #define NUM_ANALOG_FIRST 75
  156. // Below SPI and I2C definitions already done in the core
  157. // Could be redefined here if differs from the default one
  158. // SPI Definitions
  159. // SPI1 (Winbond on the Lerdge-K)
  160. //#define PIN_SPI_SS PC4
  161. //#define PIN_SPI_SCK PA5
  162. //#define PIN_SPI_MISO PA6
  163. //#define PIN_SPI_MOSI PA7
  164. // SPI2 (Winbond on the Lerdge-S)
  165. //#define PIN_SPI_SS PB12
  166. //#define PIN_SPI_SCK PB13
  167. //#define PIN_SPI_MISO PB14
  168. //#define PIN_SPI_MOSI PB15
  169. // I2C Definitions (Software I2C)
  170. //#define PIN_WIRE_SDA PG13
  171. //#define PIN_WIRE_SCL PG14
  172. // Timer Definitions
  173. // Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
  174. // FANs may require PWM timers 3 10 11 13
  175. // The LED/RGB connectors timer 4
  176. // Beware: MCU_TIMER_STEP default is 6 and MCU_TIMER_TEMP 14 for the F407
  177. #ifndef TIMER_TONE
  178. #define TIMER_TONE TIM8 // TIM3 or TIM8 for SPEAKER compat on the lerdge K (PC6)
  179. #endif // TIM4 for that on the Lerdge S (PD11)
  180. #ifndef TIMER_SERVO
  181. #define TIMER_SERVO TIM1 // Ideally TIM2 for Hardware PWM (PB11)
  182. #endif // TIM4 on the S (PD12)
  183. #ifndef TIMER_SERIAL
  184. #define TIMER_SERIAL TIM7 // Default used in SoftwareSerial lib
  185. #endif
  186. // UART Definitions
  187. // Define here Serial instance number to map on Serial generic name
  188. #define SERIAL_UART_INSTANCE 1 //ex: 2 for Serial2 (USART2)
  189. // DEBUG_UART could be redefined to print on another instance than 'Serial'
  190. //#define DEBUG_UART ((USART_TypeDef *) U(S)ARTX) // ex: USART3
  191. // DEBUG_UART baudrate, default: 9600 if not defined
  192. //#define DEBUG_UART_BAUDRATE x
  193. // DEBUG_UART Tx pin name, default: the first one found in PinMap_UART_TX for DEBUG_UART
  194. //#define DEBUG_PINNAME_TX PX_n // PinName used for TX
  195. // Default pin used for 'Serial' instance (ex: ST-Link)
  196. // Mandatory for Firmata
  197. #define PIN_SERIAL_RX PA10
  198. #define PIN_SERIAL_TX PA9
  199. /* Extra HAL modules */
  200. #ifndef HAL_DAC_MODULE_ENABLED
  201. //#define HAL_DAC_MODULE_ENABLED
  202. #endif
  203. #ifndef HAL_SD_MODULE_ENABLED
  204. #define HAL_SD_MODULE_ENABLED
  205. #endif
  206. #ifndef HAL_SRAM_MODULE_ENABLED
  207. #define HAL_SRAM_MODULE_ENABLED
  208. #endif
  209. #ifndef HAL_EXTI_MODULE_ENABLED
  210. #define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts
  211. #endif
  212. #ifdef __cplusplus
  213. } // extern "C"
  214. #endif
  215. /*----------------------------------------------------------------------------
  216. * Arduino objects - C++ only
  217. *----------------------------------------------------------------------------*/
  218. #ifdef __cplusplus
  219. // These serial port names are intended to allow libraries and architecture-neutral
  220. // sketches to automatically default to the correct port name for a particular type
  221. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  222. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  223. //
  224. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  225. //
  226. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  227. //
  228. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  229. //
  230. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  231. //
  232. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  233. // pins are NOT connected to anything by default.
  234. #define SERIAL_PORT_MONITOR Serial
  235. #define SERIAL_PORT_HARDWARE Serial1
  236. #endif