main.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 "display.h"
  24. //#include "event-system.h"
  25. //#include "list_event.h"
  26. //#include "clock.h"
  27. /* Exported types ------------------------------------------------------------*/
  28. typedef enum {
  29. Down = 0,
  30. Up = 1
  31. } updown_t;
  32. typedef enum {
  33. Off = 0,
  34. On = 1
  35. } onoff_t;
  36. typedef struct t_flag {
  37. uint32_t RTC_IRQ: 1;
  38. uint32_t I2C_TX_Err: 1;
  39. uint32_t I2C_TX_End: 1;
  40. uint32_t I2C_RX_Err: 1;
  41. uint32_t I2C_RX_End: 1;
  42. uint32_t DISP_BSY: 1;
  43. uint32_t _reserv: 26;
  44. } flag_t;
  45. extern volatile flag_t Flag;
  46. typedef union {
  47. uint16_t u16; // element specifier for accessing whole u16
  48. int16_t i16; // element specifier for accessing whole i16
  49. uint8_t u8[2];
  50. struct {
  51. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  52. uint8_t u8L; // element specifier for accessing low u8
  53. uint8_t u8H; // element specifier for accessing high u8
  54. #else // Byte-order is big endian
  55. uint8_t u8H; // element specifier for accessing low u8
  56. uint8_t u8L; // element specifier for accessing high u8
  57. #endif
  58. } s16; // element spec. for acc. struct with low or high u8
  59. } nt16_t;
  60. typedef union {
  61. uint32_t u32; // element specifier for accessing whole u32
  62. int32_t i32; // element specifier for accessing whole i32
  63. uint16_t u16[2];
  64. uint8_t u8[4];
  65. struct {
  66. #ifdef LITTLE_ENDIAN // Byte-order is little endian
  67. uint16_t u16L; // element specifier for accessing low u16
  68. uint16_t u16H; // element specifier for accessing high u16
  69. #else // Byte-order is big endian
  70. uint16_t u16H; // element specifier for accessing low u16
  71. uint16_t u16L; // element specifier for accessing high u16
  72. #endif
  73. } s32; // element spec. for acc. struct with low or high u16
  74. } nt32_t;
  75. /* Exported constants --------------------------------------------------------*/
  76. /* Exported macro ------------------------------------------------------------*/
  77. /* Exported functions prototypes ---------------------------------------------*/
  78. void Error_Handler(void);
  79. void NMI_Handler(void);
  80. void HardFault_Handler(void);
  81. void SVC_Handler(void);
  82. void PendSV_Handler(void);
  83. /* Private defines -----------------------------------------------------------*/
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif /* _MAIN_H_ */