variant.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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. #ifndef _VARIANT_ARDUINO_STM32_
  31. #define _VARIANT_ARDUINO_STM32_
  32. /*----------------------------------------------------------------------------
  33. * Headers
  34. *----------------------------------------------------------------------------*/
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif // __cplusplus
  38. /*----------------------------------------------------------------------------
  39. * Pins
  40. *----------------------------------------------------------------------------*/
  41. #if defined(ARDUINO_BLACK_F407VE) || defined(ARDUINO_BLACK_F407VG)
  42. // Right Side
  43. #define PE1 0
  44. #define PE0 1
  45. #define PB9 2
  46. #define PB8 3
  47. #define PB7 4
  48. #define PB6 5
  49. #define PB5 6
  50. #define PB3 7
  51. #define PD7 8
  52. #define PD6 9
  53. #define PD5 10
  54. #define PD4 11
  55. #define PD3 12
  56. #define PD2 13
  57. #define PD1 14
  58. #define PD0 15
  59. #define PC12 16
  60. #define PC11 17
  61. #define PC10 18
  62. #define PA15 19
  63. #define PA12 20 // USB_DP
  64. #define PA11 21 // USB_DM
  65. #define PA10 22
  66. #define PA9 23
  67. #define PA8 24
  68. #define PC9 25
  69. #define PC8 26
  70. #define PC7 27
  71. #define PC6 28
  72. #define PD15 29
  73. #define PD14 30
  74. #define PD13 31
  75. #define PD12 32
  76. #define PD11 33
  77. #define PD10 34
  78. #define PD9 35
  79. #define PD8 36
  80. #define PB15 37
  81. // Left Side
  82. #define PE2 38
  83. #define PE3 39
  84. #define PE4 40 // BUT K0
  85. #define PE5 41 // BUT K1
  86. #define PE6 42
  87. #define PC13 43
  88. #define PC0 44 // A0
  89. #define PC1 45 // A1
  90. #define PC2 46 // A2
  91. #define PC3 47 // A3
  92. #define PA0 48 // A4/WK_UP: BUT K_UP
  93. #define PA1 49 // A5
  94. #define PA2 50 // A6
  95. #define PA3 51 // A7
  96. #define PA4 52 // A8
  97. #define PA5 53 // A9
  98. #define PC4 54 // A10
  99. #define PC5 55 // A11
  100. #define PB0 56 // A12
  101. #define PB1 57 // A13
  102. #define PA6 58 // LED D2
  103. #define PA7 59 // LED D3 (active LOW)
  104. #define PE7 60
  105. #define PE8 61
  106. #define PE9 62
  107. #define PE10 63
  108. #define PE11 64
  109. #define PE12 65
  110. #define PE13 66
  111. #define PE14 67
  112. #define PE15 68
  113. #define PB10 69
  114. #define PB11 70
  115. #define PB12 71
  116. #define PB13 72
  117. #define PB14 73
  118. #define PB4 74
  119. // This must be a literal
  120. #define NUM_DIGITAL_PINS 75
  121. // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
  122. #define NUM_ANALOG_INPUTS 14
  123. #define NUM_ANALOG_FIRST 44
  124. // Below ADC, DAC and PWM definitions already done in the core
  125. // Could be redefined here if needed
  126. // ADC resolution is 12bits
  127. //#define ADC_RESOLUTION 12
  128. //#define DACC_RESOLUTION 12
  129. // PWM resolution
  130. //#define PWM_RESOLUTION 8
  131. //#define PWM_FREQUENCY 20000
  132. //#define PWM_MAX_DUTY_CYCLE 255
  133. // On-board LED pin number
  134. #define LED_D2 PA6
  135. #define LED_D3 PA7
  136. // Board specific button
  137. #define BTN_K_UP PA0
  138. #endif // ARDUINO_BLACK_F407VE || ARDUINO_BLACK_F407VG
  139. #if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG)
  140. // Left Side
  141. #define PB12 0
  142. #define PB13 1
  143. #define PB14 2
  144. #define PB15 3
  145. #define PD8 4
  146. #define PD9 5
  147. #define PD10 6
  148. #define PD11 7
  149. #define PD12 8
  150. #define PD13 9
  151. #define PD14 10
  152. #define PD15 11
  153. #define PG2 12
  154. #define PG3 13
  155. #define PG4 14
  156. #define PG5 15
  157. #define PG6 16
  158. #define PG7 17
  159. #define PG8 18
  160. #define PC6 19
  161. #define PC7 20
  162. #define PC8 21
  163. #define PC9 22
  164. #define PA8 23
  165. #define PA9 24
  166. #define PA10 25
  167. #define PA11 26 // USB_DM
  168. #define PA12 27 // USB_DP
  169. #define PA13 28
  170. #define PA14 29
  171. #define PA15 30
  172. #define PC10 31
  173. #define PC11 32
  174. #define PC12 33
  175. #define PD0 34
  176. #define PD1 35
  177. #define PD2 36
  178. #define PD3 37
  179. #define PD4 38
  180. #define PD5 39
  181. #define PD6 40
  182. #define PD7 41
  183. #define PG9 42
  184. #define PG10 43
  185. #define PG11 44
  186. #define PG12 45
  187. #define PG13 46
  188. #define PG14 47
  189. #define PG15 48
  190. #define PB3 49
  191. #define PB4 50
  192. #define PB5 51
  193. #define PB6 52
  194. #define PB7 53
  195. #define PB8 54
  196. #define PB9 55
  197. // Right Side
  198. #define PB10 56
  199. #define PB11 57
  200. #define PE14 58
  201. #define PE15 59
  202. #define PE12 60
  203. #define PE13 61
  204. #define PE10 62
  205. #define PE11 63
  206. #define PE8 64
  207. #define PE9 65
  208. #define PG1 66
  209. #define PE7 67
  210. #define PF15 68
  211. #define PG0 69
  212. #define PF13 70
  213. #define PF14 71
  214. #define PF11 72
  215. #define PF12 73
  216. #define PB2 74
  217. #define PB1 75 // A0
  218. #define PC5 76 // A1
  219. #define PB0 77 // A2
  220. #define PA7 78 // A3
  221. #define PC4 79 // A4
  222. #define PA5 80 // A5
  223. #define PA6 81 // A6
  224. #define PA3 82 // A7
  225. #define PA4 83 // A8
  226. #define PA1 84 // A9
  227. #define PA2 85 // A10
  228. #define PC3 86 // A11
  229. #define PA0 87 // A12/PA_0(WK_UP): BUT K_UP)
  230. #define PC1 88 // A13
  231. #define PC2 89 // A14
  232. #define PC0 90 // A15
  233. #define PF8 91 // A16
  234. #define PF6 92 // A17
  235. #define PF7 93 // A18
  236. #define PF9 94 // LED D1 (active low)
  237. #define PF10 95 // LED D2 (active low)
  238. #define PF4 96
  239. #define PF5 97
  240. #define PF2 98
  241. #define PF3 99
  242. #define PF0 100
  243. #define PF1 101
  244. #define PE6 102
  245. #define PC13 103
  246. #define PE4 104 // BUT K0
  247. #define PE5 105 // BUT K1
  248. #define PE2 106
  249. #define PE3 107
  250. #define PE0 108
  251. #define PE1 109
  252. // This must be a literal
  253. #define NUM_DIGITAL_PINS 110
  254. // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
  255. #define NUM_ANALOG_INPUTS 19
  256. #define NUM_ANALOG_FIRST 75
  257. // On-board LED pin number
  258. #define LED_D2 PF10
  259. #define LED_D1 PF9
  260. // Board specific button
  261. #define BTN_WK_UP PA0
  262. #endif // ARDUINO_BLACK_F407ZE || ARDUINO_BLACK_F407ZG
  263. #define LED_BUILTIN LED_D2
  264. #define LED_GREEN LED_D2
  265. // On-board user button
  266. #define BTN_K0 PE4
  267. #define BTN_K1 PE3
  268. #define USER_BTN BTN_K0
  269. // Below SPI and I2C definitions already done in the core
  270. // Could be redefined here if differs from the default one
  271. // SPI Definitions
  272. #define PIN_SPI_MOSI PB15
  273. #define PIN_SPI_MISO PB14
  274. #define PIN_SPI_SCK PB13
  275. #define PIN_SPI_SS PB12
  276. //#define PIN_SPI_SS1 PB0 // W25Q16 (on board flash)
  277. // I2C Definitions
  278. #define PIN_WIRE_SDA PB7
  279. #define PIN_WIRE_SCL PB6
  280. // Timer Definitions
  281. //Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
  282. #define TIMER_TONE TIM6
  283. // Do not use basic timer: OC is required
  284. #define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work
  285. // UART Definitions
  286. // Define here Serial instance number to map on Serial generic name
  287. #define SERIAL_UART_INSTANCE 1 //ex: 2 for Serial2 (USART2)
  288. // DEBUG_UART could be redefined to print on another instance than 'Serial'
  289. //#define DEBUG_UART ((USART_TypeDef *) U(S)ARTX) // ex: USART3
  290. // DEBUG_UART baudrate, default: 9600 if not defined
  291. //#define DEBUG_UART_BAUDRATE x
  292. // DEBUG_UART Tx pin name, default: the first one found in PinMap_UART_TX for DEBUG_UART
  293. //#define DEBUG_PINNAME_TX PX_n // PinName used for TX
  294. // Default pin used for 'Serial' instance (ex: ST-Link)
  295. // Mandatory for Firmata
  296. #define PIN_SERIAL_RX PA10
  297. #define PIN_SERIAL_TX PA9
  298. /* Extra HAL modules */
  299. #define HAL_DAC_MODULE_ENABLED
  300. #define HAL_SD_MODULE_ENABLED
  301. #ifdef __cplusplus
  302. } // extern "C"
  303. #endif
  304. /*----------------------------------------------------------------------------
  305. * Arduino objects - C++ only
  306. *----------------------------------------------------------------------------*/
  307. #ifdef __cplusplus
  308. // These serial port names are intended to allow libraries and architecture-neutral
  309. // sketches to automatically default to the correct port name for a particular type
  310. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  311. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  312. //
  313. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  314. //
  315. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  316. //
  317. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  318. //
  319. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  320. //
  321. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  322. // pins are NOT connected to anything by default.
  323. #define SERIAL_PORT_MONITOR Serial
  324. #define SERIAL_PORT_HARDWARE Serial1
  325. #endif
  326. #endif /* _VARIANT_ARDUINO_STM32_ */