main.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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) 2024 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. /* Private includes ----------------------------------------------------------*/
  29. /* USER CODE BEGIN Includes */
  30. #include "stdbool.h"
  31. #include "stdio.h"
  32. #include "net4g.h"
  33. #include "oled.h"
  34. #include "key.h"
  35. #include "interface.h"
  36. #include "string.h"
  37. #include "mba32a.h"
  38. #include "ConfigMacros.h"
  39. //#include "bmp.h"
  40. //#include "bmp.h"
  41. /* USER CODE END Includes */
  42. /* Exported types ------------------------------------------------------------*/
  43. /* USER CODE BEGIN ET */
  44. struct keys
  45. {
  46. unsigned char judge_sta; //判断按键按键按下的动作到了第几步
  47. bool key_sta; //如果按键被按下,为0
  48. bool key_flag; //如果确认被按下,为1
  49. };
  50. typedef struct
  51. {
  52. uint8_t current; //当前状态索引号
  53. uint8_t up; //向下一个
  54. uint8_t next; //向下一个
  55. uint8_t enter; //确定
  56. uint8_t back; //退出
  57. unsigned char* sn; //sn
  58. unsigned char home;
  59. } Menu_table;
  60. /* USER CODE END ET */
  61. /* Exported constants --------------------------------------------------------*/
  62. /* USER CODE BEGIN EC */
  63. /* USER CODE END EC */
  64. /* Exported macro ------------------------------------------------------------*/
  65. /* USER CODE BEGIN EM */
  66. #define BUFFER_SIZE 256
  67. extern uint8_t recvBuff[BUFFER_SIZE]; //接收数据缓存
  68. extern volatile uint8_t recvLength; //接收一帧数据的长度
  69. extern volatile uint8_t recvDndFlag; //一帧数据接收完成标志
  70. /* USER CODE END EM */
  71. /* Exported functions prototypes ---------------------------------------------*/
  72. void Error_Handler(void);
  73. /* USER CODE BEGIN EFP */
  74. void updatekeystate(void);
  75. void execute_function(Menu_table menu);
  76. /* USER CODE END EFP */
  77. /* Private defines -----------------------------------------------------------*/
  78. #define WDI_Pin GPIO_PIN_0
  79. #define WDI_GPIO_Port GPIOC
  80. #define REST_4G_Pin GPIO_PIN_1
  81. #define REST_4G_GPIO_Port GPIOA
  82. #define CS_Pin GPIO_PIN_4
  83. #define CS_GPIO_Port GPIOA
  84. #define SCL_Pin GPIO_PIN_5
  85. #define SCL_GPIO_Port GPIOA
  86. #define DC_Pin GPIO_PIN_6
  87. #define DC_GPIO_Port GPIOA
  88. #define SDA_Pin GPIO_PIN_7
  89. #define SDA_GPIO_Port GPIOA
  90. #define RES_Pin GPIO_PIN_4
  91. #define RES_GPIO_Port GPIOC
  92. #define SCK_2_Pin GPIO_PIN_13
  93. #define SCK_2_GPIO_Port GPIOB
  94. #define SDA_2_Pin GPIO_PIN_15
  95. #define SDA_2_GPIO_Port GPIOB
  96. #define REST_433_Pin GPIO_PIN_7
  97. #define REST_433_GPIO_Port GPIOC
  98. #define REST_BT_Pin GPIO_PIN_15
  99. #define REST_BT_GPIO_Port GPIOA
  100. /* USER CODE BEGIN Private defines */
  101. #define open16 11
  102. #define close16 12
  103. #define resetDevAddr ((uint32_t)0x8075000)
  104. /* USER CODE END Private defines */
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif /* __MAIN_H */