main.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. */
  8. /* Define to prevent recursive inclusion -------------------------------------*/
  9. #ifndef _MAIN_H_
  10. #define _MAIN_H_
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /* Includes ------------------------------------------------------------------*/
  15. #include <stdint.h>
  16. #include <stdlib.h>
  17. #include "stm32f0xx.h"
  18. /* Private includes ----------------------------------------------------------*/
  19. #include "board.h"
  20. #include "rtos.h"
  21. #include "i2c.h"
  22. #include "ds3231.h"
  23. //#include "event-system.h"
  24. //#include "list_event.h"
  25. //#include "clock.h"
  26. /* Exported types ------------------------------------------------------------*/
  27. typedef enum {
  28. Down = 0,
  29. Up = 1
  30. } updown_t;
  31. typedef enum {
  32. Off = 0,
  33. On = 1
  34. } onoff_t;
  35. typedef struct t_flag {
  36. uint32_t RTC_IRQ: 1;
  37. uint32_t I2C_TX_Err: 1;
  38. uint32_t I2C_TX_End: 1;
  39. uint32_t I2C_RX_Err: 1;
  40. uint32_t I2C_RX_End: 1;
  41. uint32_t _reserv: 27;
  42. } flag_t;
  43. extern volatile flag_t Flag;
  44. typedef union {
  45. uint16_t u16; // element specifier for accessing whole u16
  46. int16_t i16; // element specifier for accessing whole i16
  47. uint8_t u8[2];
  48. struct {
  49. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  50. uint8_t u8L; // element specifier for accessing low u8
  51. uint8_t u8H; // element specifier for accessing high u8
  52. #else // Byte-order is big endian
  53. uint8_t u8H; // element specifier for accessing low u8
  54. uint8_t u8L; // element specifier for accessing high u8
  55. #endif
  56. } s16; // element spec. for acc. struct with low or high u8
  57. } nt16_t;
  58. typedef union {
  59. uint32_t u32; // element specifier for accessing whole u32
  60. int32_t i32; // element specifier for accessing whole i32
  61. uint16_t u16[2];
  62. uint8_t u8[4];
  63. struct {
  64. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  65. uint16_t u16L; // element specifier for accessing low u16
  66. uint16_t u16H; // element specifier for accessing high u16
  67. #else // Byte-order is big endian
  68. uint16_t u16H; // element specifier for accessing low u16
  69. uint16_t u16L; // element specifier for accessing high u16
  70. #endif
  71. } s32; // element spec. for acc. struct with low or high u16
  72. } nt32_t;
  73. /* Exported constants --------------------------------------------------------*/
  74. /* Exported macro ------------------------------------------------------------*/
  75. /* Exported functions prototypes ---------------------------------------------*/
  76. void Error_Handler(void);
  77. /* Private defines -----------------------------------------------------------*/
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* _MAIN_H_ */