stm320518_eval.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. /**
  2. ******************************************************************************
  3. * @file stm320518_eval.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 20-April-2012
  7. * @brief This file contains definitions for STM320518_EVAL's Leds, push-buttons
  8. * and COM ports hardware resources.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM320518_EVAL_H
  30. #define __STM320518_EVAL_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f0xx.h"
  36. #include "stm32_eval_legacy.h"
  37. /** @addtogroup Utilities
  38. * @{
  39. */
  40. /** @addtogroup STM32_EVAL
  41. * @{
  42. */
  43. /** @addtogroup STM320518_EVAL
  44. * @{
  45. */
  46. /** @addtogroup STM320518_EVAL_LOW_LEVEL
  47. * @{
  48. */
  49. /** @defgroup STM320518_EVAL_LOW_LEVEL_Exported_Types
  50. * @{
  51. */
  52. typedef enum
  53. {
  54. LED1 = 0,
  55. LED2 = 1,
  56. LED3 = 2,
  57. LED4 = 3
  58. } Led_TypeDef;
  59. typedef enum
  60. {
  61. BUTTON_TAMPER = 0,
  62. BUTTON_KEY = 1,
  63. BUTTON_RIGHT = 2,
  64. BUTTON_LEFT = 3,
  65. BUTTON_UP = 4,
  66. BUTTON_DOWN = 5,
  67. BUTTON_SEL = 6
  68. } Button_TypeDef;
  69. typedef enum
  70. {
  71. BUTTON_MODE_GPIO = 0,
  72. BUTTON_MODE_EXTI = 1
  73. } ButtonMode_TypeDef;
  74. typedef enum
  75. {
  76. JOY_NONE = 0,
  77. JOY_SEL = 1,
  78. JOY_DOWN = 2,
  79. JOY_LEFT = 3,
  80. JOY_RIGHT = 4,
  81. JOY_UP = 5
  82. } JOYState_TypeDef
  83. ;
  84. typedef enum
  85. {
  86. COM1 = 0,
  87. COM2 = 1
  88. } COM_TypeDef;
  89. /**
  90. * @}
  91. */
  92. /** @defgroup STM320518_EVAL_LOW_LEVEL_Exported_Constants
  93. * @{
  94. */
  95. /**
  96. * @brief Define for STM320518_EVAL board
  97. */
  98. #if !defined (USE_STM320518_EVAL)
  99. #define USE_STM320518_EVAL
  100. #endif
  101. /**
  102. * @brief Select the revision A or B(default) of the EVAL board used.
  103. */
  104. #if !defined (STM320518_EVAL_REVB)
  105. #define STM320518_EVAL_REVB
  106. #endif
  107. #if !defined (STM320518_EVAL_REVA)
  108. //#define STM320518_EVAL_REVA
  109. #endif
  110. /** @addtogroup STM320518_EVAL_LOW_LEVEL_LED
  111. * @{
  112. */
  113. #define LEDn 4
  114. #define LED1_PIN GPIO_Pin_10
  115. #define LED1_GPIO_PORT GPIOC
  116. #define LED1_GPIO_CLK RCC_AHBPeriph_GPIOC
  117. #define LED2_PIN GPIO_Pin_11
  118. #define LED2_GPIO_PORT GPIOC
  119. #define LED2_GPIO_CLK RCC_AHBPeriph_GPIOC
  120. #define LED3_PIN GPIO_Pin_12
  121. #define LED3_GPIO_PORT GPIOC
  122. #define LED3_GPIO_CLK RCC_AHBPeriph_GPIOC
  123. #define LED4_PIN GPIO_Pin_2
  124. #define LED4_GPIO_PORT GPIOD
  125. #define LED4_GPIO_CLK RCC_AHBPeriph_GPIOD
  126. /**
  127. * @}
  128. */
  129. /** @addtogroup STM320518_EVAL_LOW_LEVEL_BUTTON
  130. * @{
  131. */
  132. #define BUTTONn 7
  133. /**
  134. * @brief Tamper push-button
  135. */
  136. #define TAMPER_BUTTON_PIN GPIO_Pin_13
  137. #define TAMPER_BUTTON_GPIO_PORT GPIOC
  138. #define TAMPER_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOC
  139. #define TAMPER_BUTTON_EXTI_LINE EXTI_Line13
  140. #define TAMPER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
  141. #define TAMPER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource13
  142. #define TAMPER_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  143. /**
  144. * @brief Key push-button
  145. */
  146. #define KEY_BUTTON_PIN GPIO_Pin_8
  147. #define KEY_BUTTON_GPIO_PORT GPIOB
  148. #define KEY_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOB
  149. #define KEY_BUTTON_EXTI_LINE EXTI_Line8
  150. #define KEY_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOB
  151. #define KEY_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource8
  152. #define KEY_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  153. /**
  154. * @brief Joystick Right push-button
  155. */
  156. #define RIGHT_BUTTON_PIN GPIO_Pin_8
  157. #define RIGHT_BUTTON_GPIO_PORT GPIOC
  158. #define RIGHT_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOC
  159. #define RIGHT_BUTTON_EXTI_LINE EXTI_Line8
  160. #define RIGHT_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
  161. #define RIGHT_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource8
  162. #define RIGHT_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  163. /**
  164. * @brief Joystick Left push-button
  165. */
  166. #define LEFT_BUTTON_PIN GPIO_Pin_9
  167. #define LEFT_BUTTON_GPIO_PORT GPIOC
  168. #define LEFT_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOC
  169. #define LEFT_BUTTON_EXTI_LINE EXTI_Line9
  170. #define LEFT_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
  171. #define LEFT_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource9
  172. #define LEFT_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  173. /**
  174. * @brief Joystick Up push-button
  175. */
  176. #define UP_BUTTON_PIN GPIO_Pin_6
  177. #define UP_BUTTON_GPIO_PORT GPIOC
  178. #define UP_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOC
  179. #define UP_BUTTON_EXTI_LINE EXTI_Line6
  180. #define UP_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
  181. #define UP_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource6
  182. #define UP_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  183. /**
  184. * @brief Joystick Down push-button
  185. */
  186. #define DOWN_BUTTON_PIN GPIO_Pin_7
  187. #define DOWN_BUTTON_GPIO_PORT GPIOC
  188. #define DOWN_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOC
  189. #define DOWN_BUTTON_EXTI_LINE EXTI_Line7
  190. #define DOWN_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
  191. #define DOWN_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource7
  192. #define DOWN_BUTTON_EXTI_IRQn EXTI4_15_IRQn
  193. /**
  194. * @brief Joystick Sel push-button
  195. */
  196. #define SEL_BUTTON_PIN GPIO_Pin_0
  197. #define SEL_BUTTON_GPIO_PORT GPIOA
  198. #define SEL_BUTTON_GPIO_CLK RCC_AHBPeriph_GPIOA
  199. #define SEL_BUTTON_EXTI_LINE EXTI_Line0
  200. #define SEL_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA
  201. #define SEL_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0
  202. #define SEL_BUTTON_EXTI_IRQn EXTI0_1_IRQn
  203. /**
  204. * @}
  205. */
  206. /** @addtogroup STM320518_EVAL_LOW_LEVEL_COM
  207. * @{
  208. */
  209. #define COMn 1
  210. /**
  211. * @brief Definition for COM port1, connected to USART1
  212. */
  213. #define EVAL_COM1 USART1
  214. #define EVAL_COM1_CLK RCC_APB2Periph_USART1
  215. #define EVAL_COM1_TX_PIN GPIO_Pin_9
  216. #define EVAL_COM1_TX_GPIO_PORT GPIOA
  217. #define EVAL_COM1_TX_GPIO_CLK RCC_AHBPeriph_GPIOA
  218. #define EVAL_COM1_TX_SOURCE GPIO_PinSource9
  219. #define EVAL_COM1_TX_AF GPIO_AF_1
  220. #define EVAL_COM1_RX_PIN GPIO_Pin_10
  221. #define EVAL_COM1_RX_GPIO_PORT GPIOA
  222. #define EVAL_COM1_RX_GPIO_CLK RCC_AHBPeriph_GPIOA
  223. #define EVAL_COM1_RX_SOURCE GPIO_PinSource10
  224. #define EVAL_COM1_RX_AF GPIO_AF_1
  225. #define EVAL_COM1_CTS_PIN GPIO_Pin_11
  226. #define EVAL_COM1_CTS_GPIO_PORT GPIOA
  227. #define EVAL_COM1_CTS_GPIO_CLK RCC_AHBPeriph_GPIOA
  228. #define EVAL_COM1_CTS_SOURCE GPIO_PinSource11
  229. #define EVAL_COM1_CTS_AF GPIO_AF_1
  230. #define EVAL_COM1_RTS_PIN GPIO_Pin_12
  231. #define EVAL_COM1_RTS_GPIO_PORT GPIOA
  232. #define EVAL_COM1_RTS_GPIO_CLK RCC_AHBPeriph_GPIOA
  233. #define EVAL_COM1_RTS_SOURCE GPIO_PinSource12
  234. #define EVAL_COM1_RTS_AF GPIO_AF_1
  235. #define EVAL_COM1_IRQn USART1_IRQn
  236. /**
  237. * @}
  238. */
  239. /** @addtogroup STM320518_EVAL_LOW_LEVEL_SD_SPI
  240. * @{
  241. */
  242. /**
  243. * @brief SD SPI Interface pins
  244. */
  245. #define SD_SPI SPI1
  246. #define SD_SPI_CLK RCC_APB2Periph_SPI1
  247. #define SD_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */
  248. #define SD_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */
  249. #define SD_SPI_SCK_GPIO_CLK RCC_AHBPeriph_GPIOA
  250. #define SD_SPI_SCK_SOURCE GPIO_PinSource5
  251. #define SD_SPI_SCK_AF GPIO_AF_0
  252. #if defined (STM320518_EVAL_REVA)
  253. #define SD_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */
  254. #define SD_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */
  255. #define SD_SPI_MISO_GPIO_CLK RCC_AHBPeriph_GPIOA
  256. #define SD_SPI_MISO_SOURCE GPIO_PinSource6
  257. #define SD_SPI_MISO_AF GPIO_AF_0
  258. #elif defined (STM320518_EVAL_REVB)
  259. #define SD_SPI_MISO_PIN GPIO_Pin_4 /* PB.04 */
  260. #define SD_SPI_MISO_GPIO_PORT GPIOB /* GPIOB */
  261. #define SD_SPI_MISO_GPIO_CLK RCC_AHBPeriph_GPIOB
  262. #define SD_SPI_MISO_SOURCE GPIO_PinSource4
  263. #define SD_SPI_MISO_AF GPIO_AF_0
  264. #endif /* STM320518_EVAL_REVA*/
  265. #define SD_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */
  266. #define SD_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */
  267. #define SD_SPI_MOSI_GPIO_CLK RCC_AHBPeriph_GPIOA
  268. #define SD_SPI_MOSI_SOURCE GPIO_PinSource7
  269. #define SD_SPI_MOSI_AF GPIO_AF_0
  270. #define SD_CS_PIN GPIO_Pin_5 /* PF.05 */
  271. #define SD_CS_GPIO_PORT GPIOF /* GPIOF */
  272. #define SD_CS_GPIO_CLK RCC_AHBPeriph_GPIOF
  273. #define SD_DETECT_PIN GPIO_Pin_15 /* PB.15 */
  274. #define SD_DETECT_EXTI_LINE EXTI_Line15
  275. #define SD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource15
  276. #define SD_DETECT_GPIO_PORT GPIOB /* GPIOB */
  277. #define SD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOB
  278. #define SD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOB
  279. #define SD_DETECT_EXTI_IRQn EXTI4_15_IRQn
  280. /**
  281. * @}
  282. */
  283. /** @addtogroup STM320518_EVAL_LOW_LEVEL_TSENSOR_I2C
  284. * @{
  285. */
  286. /**
  287. * @brief LM75 Temperature Sensor I2C Interface pins
  288. */
  289. #define LM75_I2C I2C1
  290. #define LM75_I2C_CLK RCC_APB1Periph_I2C1
  291. #define LM75_I2C_SCL_PIN GPIO_Pin_6 /* PB.06 */
  292. #define LM75_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */
  293. #define LM75_I2C_SCL_GPIO_CLK RCC_AHBPeriph_GPIOB
  294. #define LM75_I2C_SCL_SOURCE GPIO_PinSource6
  295. #define LM75_I2C_SCL_AF GPIO_AF_1
  296. #define LM75_I2C_SDA_PIN GPIO_Pin_7 /* PB.07 */
  297. #define LM75_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */
  298. #define LM75_I2C_SDA_GPIO_CLK RCC_AHBPeriph_GPIOB
  299. #define LM75_I2C_SDA_SOURCE GPIO_PinSource7
  300. #define LM75_I2C_SDA_AF GPIO_AF_1
  301. #define LM75_I2C_SMBUSALERT_PIN GPIO_Pin_5 /* PB.05 */
  302. #define LM75_I2C_SMBUSALERT_GPIO_PORT GPIOB /* GPIOB */
  303. #define LM75_I2C_SMBUSALERT_GPIO_CLK RCC_AHBPeriph_GPIOB
  304. #define LM75_I2C_SMBUSALERT_SOURCE GPIO_PinSource5
  305. #define LM75_I2C_SMBUSALERT_AF GPIO_AF_3
  306. /**
  307. * @}
  308. */
  309. /** @addtogroup STM320518_EVAL_LOW_LEVEL_I2C_EE
  310. * @{
  311. */
  312. /**
  313. * @brief I2C EEPROM Interface pins
  314. */
  315. #define sEE_I2C I2C1
  316. #define sEE_I2C_CLK RCC_APB1Periph_I2C1
  317. #define sEE_I2C_SCL_PIN GPIO_Pin_6 /* PB.06 */
  318. #define sEE_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */
  319. #define sEE_I2C_SCL_GPIO_CLK RCC_AHBPeriph_GPIOB
  320. #define sEE_I2C_SCL_SOURCE GPIO_PinSource6
  321. #define sEE_I2C_SCL_AF GPIO_AF_1
  322. #define sEE_I2C_SDA_PIN GPIO_Pin_7 /* PB.07 */
  323. #define sEE_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */
  324. #define sEE_I2C_SDA_GPIO_CLK RCC_AHBPeriph_GPIOB
  325. #define sEE_I2C_SDA_SOURCE GPIO_PinSource7
  326. #define sEE_I2C_SDA_AF GPIO_AF_1
  327. /**
  328. * @}
  329. */
  330. /** @defgroup STM320518_EVAL_LOW_LEVEL_Exported_Functions
  331. * @{
  332. */
  333. void STM_EVAL_LEDInit(Led_TypeDef Led);
  334. void STM_EVAL_LEDOn(Led_TypeDef Led);
  335. void STM_EVAL_LEDOff(Led_TypeDef Led);
  336. void STM_EVAL_LEDToggle(Led_TypeDef Led);
  337. void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
  338. uint32_t STM_EVAL_PBGetState(Button_TypeDef Button);
  339. void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct);
  340. void SD_LowLevel_DeInit(void);
  341. void SD_LowLevel_Init(void);
  342. void sFLASH_LowLevel_DeInit(void);
  343. void sFLASH_LowLevel_Init(void);
  344. void LM75_LowLevel_DeInit(void);
  345. void LM75_LowLevel_Init(void);
  346. void sEE_LowLevel_DeInit(void);
  347. void sEE_LowLevel_Init(void);
  348. /**
  349. * @}
  350. */
  351. #ifdef __cplusplus
  352. }
  353. #endif
  354. #endif /* __STM320518_EVAL_H */
  355. /**
  356. * @}
  357. */
  358. /**
  359. * @}
  360. */
  361. /**
  362. * @}
  363. */
  364. /**
  365. * @}
  366. */
  367. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/