main.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 "stm32l4xx_hal.h"
  29. /* Private includes ----------------------------------------------------------*/
  30. /* USER CODE BEGIN Includes */
  31. /* USER CODE END Includes */
  32. /* Exported types ------------------------------------------------------------*/
  33. /* USER CODE BEGIN ET */
  34. typedef enum {
  35. TimerEventInputCapture,
  36. TimerEventEndOfPulse
  37. } TimerEvent;
  38. /* USER CODE END ET */
  39. /* Exported constants --------------------------------------------------------*/
  40. /* USER CODE BEGIN EC */
  41. /* USER CODE END EC */
  42. /* Exported macro ------------------------------------------------------------*/
  43. /* USER CODE BEGIN EM */
  44. /* USER CODE END EM */
  45. void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
  46. /* Exported functions prototypes ---------------------------------------------*/
  47. void Error_Handler(void);
  48. /* USER CODE BEGIN EFP */
  49. void register_tim8_callback_ch2(void(*callback)(uint16_t ccr, TimerEvent tim_event));
  50. /* USER CODE END EFP */
  51. /* Private defines -----------------------------------------------------------*/
  52. #define CHRG_Pin GPIO_PIN_2
  53. #define CHRG_GPIO_Port GPIOC
  54. #define CHRG_EXTI_IRQn EXTI2_IRQn
  55. #define BATT_V_Pin GPIO_PIN_3
  56. #define BATT_V_GPIO_Port GPIOC
  57. #define IR_RX_Pin GPIO_PIN_0
  58. #define IR_RX_GPIO_Port GPIOA
  59. #define BUTTON_DOWN_Pin GPIO_PIN_1
  60. #define BUTTON_DOWN_GPIO_Port GPIOA
  61. #define BUTTON_DOWN_EXTI_IRQn EXTI1_IRQn
  62. #define DISPLAY_DI_Pin GPIO_PIN_2
  63. #define DISPLAY_DI_GPIO_Port GPIOA
  64. #define SPEAKER_Pin GPIO_PIN_3
  65. #define SPEAKER_GPIO_Port GPIOA
  66. #define RFID_REF_Pin GPIO_PIN_4
  67. #define RFID_REF_GPIO_Port GPIOA
  68. #define BUTTON_BACK_Pin GPIO_PIN_6
  69. #define BUTTON_BACK_GPIO_Port GPIOA
  70. #define BUTTON_BACK_EXTI_IRQn EXTI9_5_IRQn
  71. #define RFID_RF_IN_Pin GPIO_PIN_5
  72. #define RFID_RF_IN_GPIO_Port GPIOC
  73. #define BUTTON_UP_Pin GPIO_PIN_0
  74. #define BUTTON_UP_GPIO_Port GPIOB
  75. #define BUTTON_UP_EXTI_IRQn EXTI0_IRQn
  76. #define LED_BLUE_Pin GPIO_PIN_1
  77. #define LED_BLUE_GPIO_Port GPIOB
  78. #define DISPLAY_RST_Pin GPIO_PIN_10
  79. #define DISPLAY_RST_GPIO_Port GPIOB
  80. #define IR_TX_Pin GPIO_PIN_11
  81. #define IR_TX_GPIO_Port GPIOB
  82. #define RFID_OUT_Pin GPIO_PIN_13
  83. #define RFID_OUT_GPIO_Port GPIOB
  84. #define LED_GREEN_Pin GPIO_PIN_14
  85. #define LED_GREEN_GPIO_Port GPIOB
  86. #define RFID_PULL_Pin GPIO_PIN_15
  87. #define RFID_PULL_GPIO_Port GPIOB
  88. #define VIBRO_Pin GPIO_PIN_6
  89. #define VIBRO_GPIO_Port GPIOC
  90. #define iButton_Pin GPIO_PIN_7
  91. #define iButton_GPIO_Port GPIOC
  92. #define DISPLAY_CS_Pin GPIO_PIN_8
  93. #define DISPLAY_CS_GPIO_Port GPIOC
  94. #define LED_RED_Pin GPIO_PIN_8
  95. #define LED_RED_GPIO_Port GPIOA
  96. #define TMS_Pin GPIO_PIN_13
  97. #define TMS_GPIO_Port GPIOA
  98. #define TCK_Pin GPIO_PIN_14
  99. #define TCK_GPIO_Port GPIOA
  100. #define CC1101_CS_Pin GPIO_PIN_15
  101. #define CC1101_CS_GPIO_Port GPIOA
  102. #define BUTTON_LEFT_Pin GPIO_PIN_4
  103. #define BUTTON_LEFT_GPIO_Port GPIOB
  104. #define BUTTON_LEFT_EXTI_IRQn EXTI4_IRQn
  105. #define DISPLAY_BACKLIGHT_Pin GPIO_PIN_6
  106. #define DISPLAY_BACKLIGHT_GPIO_Port GPIOB
  107. #define CC1101_G0_Pin GPIO_PIN_7
  108. #define CC1101_G0_GPIO_Port GPIOB
  109. #define BUTTON_RIGHT_Pin GPIO_PIN_8
  110. #define BUTTON_RIGHT_GPIO_Port GPIOB
  111. #define BUTTON_RIGHT_EXTI_IRQn EXTI9_5_IRQn
  112. #define BUTTON_OK_Pin GPIO_PIN_9
  113. #define BUTTON_OK_GPIO_Port GPIOB
  114. #define BUTTON_OK_EXTI_IRQn EXTI9_5_IRQn
  115. /* USER CODE BEGIN Private defines */
  116. #define LD2_Pin LED_RED_Pin
  117. #define LD2_GPIO_Port LED_RED_GPIO_Port
  118. #define EM_PIN_GPIO_Port RFID_OUT_GPIO_Port
  119. #define EM_PIN_Pin RFID_OUT_Pin
  120. #define MISO_PIN GpioPin{.port = GPIOC, .pin = GPIO_PIN_11}
  121. // #define MOSI_PIN 11
  122. #define SS_PIN GpioPin{.port = CC1101_CS_GPIO_Port, .pin = CC1101_CS_Pin}
  123. //2 main, 5 remote, 3 M16
  124. #define GDO2 GpioPin{.port = NULL, .pin = 0}
  125. #define GDO0 GpioPin{.port = CC1101_G0_GPIO_Port, .pin = CC1101_G0_Pin}
  126. /* USER CODE END Private defines */
  127. #ifdef __cplusplus
  128. }
  129. #endif
  130. #endif /* __MAIN_H */
  131. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/