main.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 _reserv: 31;
  38. } flag_t;
  39. extern volatile flag_t Flag;
  40. typedef union {
  41. uint16_t u16; // element specifier for accessing whole u16
  42. int16_t i16; // element specifier for accessing whole i16
  43. uint8_t u8[2];
  44. struct {
  45. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  46. uint8_t u8L; // element specifier for accessing low u8
  47. uint8_t u8H; // element specifier for accessing high u8
  48. #else // Byte-order is big endian
  49. uint8_t u8H; // element specifier for accessing low u8
  50. uint8_t u8L; // element specifier for accessing high u8
  51. #endif
  52. } s16; // element spec. for acc. struct with low or high u8
  53. } nt16_t;
  54. typedef union {
  55. uint32_t u32; // element specifier for accessing whole u32
  56. int32_t i32; // element specifier for accessing whole i32
  57. uint16_t u16[2];
  58. uint8_t u8[4];
  59. struct {
  60. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  61. uint16_t u16L; // element specifier for accessing low u16
  62. uint16_t u16H; // element specifier for accessing high u16
  63. #else // Byte-order is big endian
  64. uint16_t u16H; // element specifier for accessing low u16
  65. uint16_t u16L; // element specifier for accessing high u16
  66. #endif
  67. } s32; // element spec. for acc. struct with low or high u16
  68. } nt32_t;
  69. /* Exported constants --------------------------------------------------------*/
  70. /* Exported macro ------------------------------------------------------------*/
  71. /* Exported functions prototypes ---------------------------------------------*/
  72. void Error_Handler(void);
  73. /* Private defines -----------------------------------------------------------*/
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* _MAIN_H_ */