main.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.h
  5. * @brief : Header for main.c file.
  6. * This file contains the common defines of the application.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST under Ultimate Liberty license
  14. * SLA0044, the "License"; You may not use this file except in compliance with
  15. * the License. You may obtain a copy of the License at:
  16. * www.st.com/SLA0044
  17. *
  18. ******************************************************************************
  19. */
  20. /* USER CODE END Header */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __MAIN_H
  23. #define __MAIN_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32wbxx_hal.h"
  29. #include "stm32wbxx.h"
  30. #include "stm32wbxx_ll_i2c.h"
  31. #include "stm32wbxx_ll_bus.h"
  32. #include "stm32wbxx_ll_cortex.h"
  33. #include "stm32wbxx_ll_rcc.h"
  34. #include "stm32wbxx_ll_system.h"
  35. #include "stm32wbxx_ll_utils.h"
  36. #include "stm32wbxx_ll_pwr.h"
  37. #include "stm32wbxx_ll_gpio.h"
  38. #include "stm32wbxx_ll_dma.h"
  39. #include "stm32wbxx_ll_exti.h"
  40. /* Private includes ----------------------------------------------------------*/
  41. /* USER CODE BEGIN Includes */
  42. /* USER CODE END Includes */
  43. /* Exported types ------------------------------------------------------------*/
  44. /* USER CODE BEGIN ET */
  45. /* USER CODE END ET */
  46. /* Exported constants --------------------------------------------------------*/
  47. /* USER CODE BEGIN EC */
  48. /* USER CODE END EC */
  49. /* Exported macro ------------------------------------------------------------*/
  50. /* USER CODE BEGIN EM */
  51. /* USER CODE END EM */
  52. /* Exported functions prototypes ---------------------------------------------*/
  53. void Error_Handler(void);
  54. /* USER CODE BEGIN EFP */
  55. /* USER CODE END EFP */
  56. /* Private defines -----------------------------------------------------------*/
  57. #define BUTTON_BACK_Pin GPIO_PIN_13
  58. #define BUTTON_BACK_GPIO_Port GPIOC
  59. #define BUTTON_BACK_EXTI_IRQn EXTI15_10_IRQn
  60. #define QUARTZ_32MHZ_IN_Pin GPIO_PIN_14
  61. #define QUARTZ_32MHZ_IN_GPIO_Port GPIOC
  62. #define QUARTZ_32MHZ_OUT_Pin GPIO_PIN_15
  63. #define QUARTZ_32MHZ_OUT_GPIO_Port GPIOC
  64. #define BUTTON_OK_Pin GPIO_PIN_3
  65. #define BUTTON_OK_GPIO_Port GPIOH
  66. #define BUTTON_OK_EXTI_IRQn EXTI3_IRQn
  67. #define SPEAKER_Pin GPIO_PIN_8
  68. #define SPEAKER_GPIO_Port GPIOB
  69. #define IR_TX_Pin GPIO_PIN_9
  70. #define IR_TX_GPIO_Port GPIOB
  71. #define PC0_Pin GPIO_PIN_0
  72. #define PC0_GPIO_Port GPIOC
  73. #define PC1_Pin GPIO_PIN_1
  74. #define PC1_GPIO_Port GPIOC
  75. #define SPI_D_MISO_Pin GPIO_PIN_2
  76. #define SPI_D_MISO_GPIO_Port GPIOC
  77. #define PC3_Pin GPIO_PIN_3
  78. #define PC3_GPIO_Port GPIOC
  79. #define IR_RX_Pin GPIO_PIN_0
  80. #define IR_RX_GPIO_Port GPIOA
  81. #define RF_SW_0_Pin GPIO_PIN_1
  82. #define RF_SW_0_GPIO_Port GPIOA
  83. #define RF_SW_1_Pin GPIO_PIN_2
  84. #define RF_SW_1_GPIO_Port GPIOA
  85. #define PERIPH_POWER_Pin GPIO_PIN_3
  86. #define PERIPH_POWER_GPIO_Port GPIOA
  87. #define PA4_Pin GPIO_PIN_4
  88. #define PA4_GPIO_Port GPIOA
  89. #define SPI_R_SCK_Pin GPIO_PIN_5
  90. #define SPI_R_SCK_GPIO_Port GPIOA
  91. #define PA6_Pin GPIO_PIN_6
  92. #define PA6_GPIO_Port GPIOA
  93. #define PA7_Pin GPIO_PIN_7
  94. #define PA7_GPIO_Port GPIOA
  95. #define RFID_PULL_Pin GPIO_PIN_8
  96. #define RFID_PULL_GPIO_Port GPIOA
  97. #define RFID_PULL_EXTI_IRQn EXTI9_5_IRQn
  98. #define I2C_SCL_Pin GPIO_PIN_9
  99. #define I2C_SCL_GPIO_Port GPIOA
  100. #define CC1101_G0_Pin GPIO_PIN_4
  101. #define CC1101_G0_GPIO_Port GPIOC
  102. #define RFID_RF_IN_Pin GPIO_PIN_5
  103. #define RFID_RF_IN_GPIO_Port GPIOC
  104. #define PB2_Pin GPIO_PIN_2
  105. #define PB2_GPIO_Port GPIOB
  106. #define BUTTON_UP_Pin GPIO_PIN_10
  107. #define BUTTON_UP_GPIO_Port GPIOB
  108. #define BUTTON_UP_EXTI_IRQn EXTI15_10_IRQn
  109. #define BUTTON_LEFT_Pin GPIO_PIN_11
  110. #define BUTTON_LEFT_GPIO_Port GPIOB
  111. #define BUTTON_LEFT_EXTI_IRQn EXTI15_10_IRQn
  112. #define DISPLAY_RST_Pin GPIO_PIN_0
  113. #define DISPLAY_RST_GPIO_Port GPIOB
  114. #define BUTTON_DOWN_Pin GPIO_PIN_1
  115. #define BUTTON_DOWN_GPIO_Port GPIOB
  116. #define BUTTON_DOWN_EXTI_IRQn EXTI1_IRQn
  117. #define NFC_CS_Pin GPIO_PIN_4
  118. #define NFC_CS_GPIO_Port GPIOE
  119. #define BUTTON_RIGHT_Pin GPIO_PIN_12
  120. #define BUTTON_RIGHT_GPIO_Port GPIOB
  121. #define BUTTON_RIGHT_EXTI_IRQn EXTI15_10_IRQn
  122. #define RFID_OUT_Pin GPIO_PIN_13
  123. #define RFID_OUT_GPIO_Port GPIOB
  124. #define iBTN_Pin GPIO_PIN_14
  125. #define iBTN_GPIO_Port GPIOB
  126. #define SPI_D_MOSI_Pin GPIO_PIN_15
  127. #define SPI_D_MOSI_GPIO_Port GPIOB
  128. #define DISPLAY_DI_Pin GPIO_PIN_6
  129. #define DISPLAY_DI_GPIO_Port GPIOC
  130. #define I2C_SDA_Pin GPIO_PIN_10
  131. #define I2C_SDA_GPIO_Port GPIOA
  132. #define SD_CD_Pin GPIO_PIN_15
  133. #define SD_CD_GPIO_Port GPIOA
  134. #define VIBRO_Pin GPIO_PIN_10
  135. #define VIBRO_GPIO_Port GPIOC
  136. #define DISPLAY_CS_Pin GPIO_PIN_11
  137. #define DISPLAY_CS_GPIO_Port GPIOC
  138. #define SD_CS_Pin GPIO_PIN_12
  139. #define SD_CS_GPIO_Port GPIOC
  140. #define CC1101_CS_Pin GPIO_PIN_0
  141. #define CC1101_CS_GPIO_Port GPIOD
  142. #define SPI_D_SCK_Pin GPIO_PIN_1
  143. #define SPI_D_SCK_GPIO_Port GPIOD
  144. #define PB3_Pin GPIO_PIN_3
  145. #define PB3_GPIO_Port GPIOB
  146. #define SPI_R_MISO_Pin GPIO_PIN_4
  147. #define SPI_R_MISO_GPIO_Port GPIOB
  148. #define SPI_R_MOSI_Pin GPIO_PIN_5
  149. #define SPI_R_MOSI_GPIO_Port GPIOB
  150. /* USER CODE BEGIN Private defines */
  151. #define MISO_PIN GpioPin{.port = SPI_R_MISO_GPIO_Port, .pin = SPI_R_MISO_Pin}
  152. #define SPI_R hspi1
  153. #define SPI_D hspi2
  154. #define SPI_SD_HANDLE SPI_D
  155. extern TIM_HandleTypeDef htim1;
  156. extern TIM_HandleTypeDef htim2;
  157. extern TIM_HandleTypeDef htim16;
  158. #define TIM_A htim1
  159. #define TIM_B htim2
  160. #define TIM_C htim16
  161. #define SPEAKER_TIM htim16
  162. #define SPEAKER_CH TIM_CHANNEL_1
  163. #define LFRFID_TIM htim1
  164. #define LFRFID_CH TIM_CHANNEL_1
  165. #define IRDA_TX_TIM htim1
  166. #define IRDA_TX_CH TIM_CHANNEL_3
  167. // only for reference
  168. // IRDA RX timer dont exist in F2
  169. // and timer need more data to init (NVIC IRQn to set priority)
  170. #define IRDA_RX_TIM htim2
  171. #define IRDA_RX_FALLING_CH TIM_CHANNEL_1
  172. #define IRDA_RX_RISING_CH TIM_CHANNEL_2
  173. #define NFC_IRQ_Pin RFID_PULL_Pin
  174. #define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
  175. #define VIBRO_Pin GPIO_PIN_10
  176. #define VIBRO_GPIO_Port GPIOC
  177. /* USER CODE END Private defines */
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif /* __MAIN_H */
  182. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/