main.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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) 2021 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 CC1101_G0_Pin GPIO_PIN_1
  82. #define CC1101_G0_GPIO_Port GPIOA
  83. #define RFID_PULL_Pin GPIO_PIN_2
  84. #define RFID_PULL_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_TUNE_Pin GPIO_PIN_8
  96. #define RFID_TUNE_GPIO_Port GPIOA
  97. #define I2C_SCL_Pin GPIO_PIN_9
  98. #define I2C_SCL_GPIO_Port GPIOA
  99. #define RF_SW_0_Pin GPIO_PIN_4
  100. #define RF_SW_0_GPIO_Port GPIOC
  101. #define RFID_RF_IN_Pin GPIO_PIN_5
  102. #define RFID_RF_IN_GPIO_Port GPIOC
  103. #define PB2_Pin GPIO_PIN_2
  104. #define PB2_GPIO_Port GPIOB
  105. #define BUTTON_UP_Pin GPIO_PIN_10
  106. #define BUTTON_UP_GPIO_Port GPIOB
  107. #define BUTTON_UP_EXTI_IRQn EXTI15_10_IRQn
  108. #define BUTTON_LEFT_Pin GPIO_PIN_11
  109. #define BUTTON_LEFT_GPIO_Port GPIOB
  110. #define BUTTON_LEFT_EXTI_IRQn EXTI15_10_IRQn
  111. #define DISPLAY_RST_Pin GPIO_PIN_0
  112. #define DISPLAY_RST_GPIO_Port GPIOB
  113. #define DISPLAY_DI_Pin GPIO_PIN_1
  114. #define DISPLAY_DI_GPIO_Port GPIOB
  115. #define NFC_CS_Pin GPIO_PIN_4
  116. #define NFC_CS_GPIO_Port GPIOE
  117. #define BUTTON_RIGHT_Pin GPIO_PIN_12
  118. #define BUTTON_RIGHT_GPIO_Port GPIOB
  119. #define BUTTON_RIGHT_EXTI_IRQn EXTI15_10_IRQn
  120. #define RFID_OUT_Pin GPIO_PIN_13
  121. #define RFID_OUT_GPIO_Port GPIOB
  122. #define iBTN_Pin GPIO_PIN_14
  123. #define iBTN_GPIO_Port GPIOB
  124. #define SPI_D_MOSI_Pin GPIO_PIN_15
  125. #define SPI_D_MOSI_GPIO_Port GPIOB
  126. #define BUTTON_DOWN_Pin GPIO_PIN_6
  127. #define BUTTON_DOWN_GPIO_Port GPIOC
  128. #define I2C_SDA_Pin GPIO_PIN_10
  129. #define I2C_SDA_GPIO_Port GPIOA
  130. #define VIBRO_Pin GPIO_PIN_15
  131. #define VIBRO_GPIO_Port GPIOA
  132. #define SD_CD_Pin GPIO_PIN_10
  133. #define SD_CD_GPIO_Port GPIOC
  134. #define DISPLAY_CS_Pin GPIO_PIN_11
  135. #define DISPLAY_CS_GPIO_Port GPIOC
  136. #define SD_CS_Pin GPIO_PIN_12
  137. #define SD_CS_GPIO_Port GPIOC
  138. #define CC1101_CS_Pin GPIO_PIN_0
  139. #define CC1101_CS_GPIO_Port GPIOD
  140. #define SPI_D_SCK_Pin GPIO_PIN_1
  141. #define SPI_D_SCK_GPIO_Port GPIOD
  142. #define PB3_Pin GPIO_PIN_3
  143. #define PB3_GPIO_Port GPIOB
  144. #define SPI_R_MISO_Pin GPIO_PIN_4
  145. #define SPI_R_MISO_GPIO_Port GPIOB
  146. #define SPI_R_MOSI_Pin GPIO_PIN_5
  147. #define SPI_R_MOSI_GPIO_Port GPIOB
  148. /* USER CODE BEGIN Private defines */
  149. #define MISO_PIN GpioPin{.port = SPI_R_MISO_GPIO_Port, .pin = SPI_R_MISO_Pin}
  150. #define SPI_R hspi1
  151. #define SPI_D hspi2
  152. #define SPI_SD_HANDLE SPI_D
  153. extern TIM_HandleTypeDef htim1;
  154. extern TIM_HandleTypeDef htim2;
  155. extern TIM_HandleTypeDef htim16;
  156. #define TIM_A htim1
  157. #define TIM_B htim2
  158. #define TIM_C htim16
  159. #define SPEAKER_TIM htim16
  160. #define SPEAKER_CH TIM_CHANNEL_1
  161. #define LFRFID_TIM htim1
  162. #define LFRFID_CH TIM_CHANNEL_1
  163. #define IRDA_TX_TIM htim1
  164. #define IRDA_TX_CH TIM_CHANNEL_3
  165. // only for reference
  166. // IRDA RX timer dont exist in F2
  167. // and timer need more data to init (NVIC IRQn to set priority)
  168. #define IRDA_RX_TIM htim2
  169. #define IRDA_RX_FALLING_CH TIM_CHANNEL_1
  170. #define IRDA_RX_RISING_CH TIM_CHANNEL_2
  171. #define NFC_IRQ_Pin RFID_PULL_Pin
  172. #define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
  173. #define VIBRO_Pin GPIO_PIN_10
  174. #define VIBRO_GPIO_Port GPIOC
  175. /* USER CODE END Private defines */
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179. #endif /* __MAIN_H */
  180. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/