main.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 "stm32l4xx_hal.h"
  28. /* Private includes ----------------------------------------------------------*/
  29. /* USER CODE BEGIN Includes */
  30. #include "iic.h"
  31. #include "SSCMAN.h"
  32. #include <string.h> //memset
  33. #include <stdio.h> //printf
  34. #include <stdbool.h> // bool
  35. #include <stdlib.h> // 引入标准库,包含 malloc �?? free 的声�??
  36. #include <math.h>
  37. #include "FLASH.h"
  38. /* USER CODE END Includes */
  39. /* Exported types ------------------------------------------------------------*/
  40. /* USER CODE BEGIN ET */
  41. struct thermo_save
  42. {
  43. //
  44. uint32_t Thermoelectric_couple;
  45. uint32_t thermopile;
  46. uint32_t ID;
  47. uint32_t SendT;
  48. uint32_t change;
  49. uint8_t sendflag;
  50. uint32_t sendcount;
  51. //
  52. };
  53. typedef struct thermo_save thermo_struct;
  54. // 定义压力结构体
  55. typedef struct {
  56. uint16_t second_threshold; // 二级警报阈值
  57. uint8_t delay_receivedValue; // 初始上报频率
  58. uint8_t reserve1;
  59. } FlashData;
  60. extern FlashData flash_data;
  61. /* USER CODE END ET */
  62. /* Exported constants --------------------------------------------------------*/
  63. /* USER CODE BEGIN EC */
  64. extern thermo_struct thermo;
  65. #define thermo_SendT (50)
  66. /* USER CODE END EC */
  67. /* Exported macro ------------------------------------------------------------*/
  68. /* USER CODE BEGIN EM */
  69. HAL_StatusTypeDef CAN_FilterInit(void);
  70. //void CAN_Send_Msg(uint8_t *msg,uint8_t len,uint32_t id);
  71. void CAN_Send_Msg(uint8_t *msg,uint8_t len,uint32_t node_id, uint8_t sequence, uint8_t slice_num, uint8_t slice_id);
  72. /* USER CODE END EM */
  73. /* Exported functions prototypes ---------------------------------------------*/
  74. void Error_Handler(void);
  75. /* USER CODE BEGIN EFP */
  76. void SystemClock_Config(void);
  77. /* USER CODE END EFP */
  78. /* Private defines -----------------------------------------------------------*/
  79. #define CAN_SHDN_Pin GPIO_PIN_15
  80. #define CAN_SHDN_GPIO_Port GPIOB
  81. #define CAN_RS_Pin GPIO_PIN_8
  82. #define CAN_RS_GPIO_Port GPIOA
  83. #define IIC_SCL_Pin GPIO_PIN_9
  84. #define IIC_SCL_GPIO_Port GPIOA
  85. #define IIC_SDA_Pin GPIO_PIN_10
  86. #define IIC_SDA_GPIO_Port GPIOA
  87. #define LED1_Pin GPIO_PIN_4
  88. #define LED1_GPIO_Port GPIOB
  89. /* USER CODE BEGIN Private defines */
  90. /* USER CODE END Private defines */
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif /* __MAIN_H */