main.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. ******************************************************************************
  3. * @file : main.h
  4. * @brief : Header for main.c file.
  5. * This file contains the common defines of the application.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __MAIN_H
  21. #define __MAIN_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32g0xx.h"
  27. /* Private includes ----------------------------------------------------------*/
  28. #include "board.h"
  29. #include "sensor.h"
  30. #include "i2c.h"
  31. #include "ds3231.h"
  32. #include "bme280.h"
  33. #include "rtos.h"
  34. #include "event-system.h"
  35. #include "list_event.h"
  36. #include "clock.h"
  37. /* Exported types ------------------------------------------------------------*/
  38. typedef enum {
  39. DOWN = 0,
  40. UP = 1
  41. } updown_t;
  42. typedef enum {
  43. OFF = 0,
  44. ON = 1
  45. } onoff_t;
  46. typedef struct t_flag {
  47. uint32_t RTC_IRQ: 1;
  48. uint32_t SPI_TX_End: 1;
  49. uint32_t I2C_TX_End: 1;
  50. uint32_t I2C_RX_End: 1;
  51. uint32_t I2C_TX_Err: 1;
  52. uint32_t I2C_RX_Err: 1;
  53. uint32_t BME280: 1;
  54. uint32_t Blink_1: 1;
  55. uint32_t Blink_2: 1;
  56. uint32_t Blink_3: 1;
  57. uint32_t Blink_4: 1;
  58. uint32_t Blink_5: 1;
  59. uint32_t Now_Day: 1;
  60. uint32_t _reserv: 19;
  61. } flag_t;
  62. extern volatile flag_t Flag;
  63. typedef union {
  64. uint16_t u16; // element specifier for accessing whole u16
  65. int16_t i16; // element specifier for accessing whole i16
  66. uint8_t u8[2];
  67. struct {
  68. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  69. uint8_t u8L; // element specifier for accessing low u8
  70. uint8_t u8H; // element specifier for accessing high u8
  71. #else // Byte-order is big endian
  72. uint8_t u8H; // element specifier for accessing low u8
  73. uint8_t u8L; // element specifier for accessing high u8
  74. #endif
  75. } s16; // element spec. for acc. struct with low or high u8
  76. } nt16_t;
  77. typedef union {
  78. uint32_t u32; // element specifier for accessing whole u32
  79. int32_t i32; // element specifier for accessing whole i32
  80. uint16_t u16[2];
  81. uint8_t u8[4];
  82. struct {
  83. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  84. uint16_t u16L; // element specifier for accessing low u16
  85. uint16_t u16H; // element specifier for accessing high u16
  86. #else // Byte-order is big endian
  87. uint16_t u16H; // element specifier for accessing low u16
  88. uint16_t u16L; // element specifier for accessing high u16
  89. #endif
  90. } s32; // element spec. for acc. struct with low or high u16
  91. } nt32_t;
  92. /* Exported constants --------------------------------------------------------*/
  93. /* Exported macro ------------------------------------------------------------*/
  94. /* Exported functions prototypes ---------------------------------------------*/
  95. void Error_Handler(void);
  96. /* Private defines -----------------------------------------------------------*/
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* __MAIN_H */
  101. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/