main.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. * Copyright (c) 2025 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __MAIN_H
  22. #define __MAIN_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32f1xx_hal.h"
  28. #include "Battery.h"
  29. /* Private includes ----------------------------------------------------------*/
  30. /* USER CODE BEGIN Includes */
  31. /* USER CODE END Includes */
  32. /* Exported types ------------------------------------------------------------*/
  33. /* USER CODE BEGIN ET */
  34. /* USER CODE END ET */
  35. /* Exported constants --------------------------------------------------------*/
  36. /* USER CODE BEGIN EC */
  37. /* USER CODE END EC */
  38. /* Exported macro ------------------------------------------------------------*/
  39. /* USER CODE BEGIN EM */
  40. /* USER CODE END EM */
  41. /* Exported functions prototypes ---------------------------------------------*/
  42. void Error_Handler(void);
  43. /* USER CODE BEGIN EFP */
  44. /* USER CODE END EFP */
  45. /* Private defines -----------------------------------------------------------*/
  46. #define SOS_KEY_Pin GPIO_PIN_14
  47. #define SOS_KEY_GPIO_Port GPIOB
  48. #define SOS_KEY_EXTI_IRQn EXTI15_10_IRQn
  49. #define JUGE_PIN_Pin GPIO_PIN_15
  50. #define JUGE_PIN_GPIO_Port GPIOB
  51. #define JUGE_PIN_EXTI_IRQn EXTI15_10_IRQn
  52. #define POWER_ON_Pin GPIO_PIN_8
  53. #define POWER_ON_GPIO_Port GPIOA
  54. #define CTL_LORA_POWER_Pin GPIO_PIN_15
  55. #define CTL_LORA_POWER_GPIO_Port GPIOA
  56. #define PowerLED_Pin GPIO_PIN_3
  57. #define PowerLED_GPIO_Port GPIOB
  58. /* USER CODE BEGIN Private defines */
  59. #define FLASH_USER_ADDR 0x0800FC00 // 用户存储页(最后 1KB)
  60. extern uint8_t rx_buf[25];
  61. extern uint8_t rx_buf_uart2[25];
  62. extern uint8_t rx_buf_uart2_DMA[25];
  63. extern uint8_t loraSendNextDataFlag;
  64. extern uint8_t totalData[50][25];
  65. extern RTC_HandleTypeDef hrtc;
  66. extern uint8_t workMode; // 0: 接收蓝牙数据 1: 使用lora发生数据。
  67. extern uint8_t receiveBlDataCount;
  68. extern UART_HandleTypeDef huart1;
  69. extern UART_HandleTypeDef huart2;
  70. extern UART_HandleTypeDef huart3;
  71. extern DMA_HandleTypeDef hdma_usart2_rx;
  72. extern uint8_t Mac_Addr[6];
  73. void Flash_Write_LoraAddr(uint8_t addrH, uint8_t addrL);
  74. /* USER CODE END Private defines */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* __MAIN_H */