CARME-M4 BSP  V1.5
rtc.h
Go to the documentation of this file.
1 #ifndef __RTC_H__
2 #define __RTC_H__
3 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif /* __cplusplus */
76 
77 /*----- Header-Files -------------------------------------------------------*/
78 #include <stm32f4xx.h> /* Processor STM32F407IG */
79 #include <carme.h> /* CARME Module */
80 
81 /*----- Macros -------------------------------------------------------------*/
82 /* error codes */
83 #define CARME_ERROR_RTC CARME_ERROR_RTC_BASE + 0
85 #ifndef CARME_RTC_USE_WAKEUP_ISR
86 #define CARME_RTC_USE_WAKEUP_ISR 0
87 #endif
88 
89 /*----- Data types ---------------------------------------------------------*/
93 typedef struct _CARME_RTC_TIME_t {
94  uint8_t sec;
95  uint8_t min;
96  uint8_t hour;
97  uint8_t day;
98  uint8_t month;
99  uint8_t year;
100  uint8_t wday;
102 
103 #if CARME_RTC_USE_WAKEUP_ISR==1
104 
107 typedef enum _CARME_RTC_WAKEUP_t {
108  CARME_RTC_WAKEUP_STOP =0,
109  CARME_RTC_WAKEUP_30s,
110  CARME_RTC_WAKEUP_10s,
111  CARME_RTC_WAKEUP_5s,
112  CARME_RTC_WAKEUP_1s,
113  CARME_RTC_WAKEUP_500ms,
114  CARME_RTC_WAKEUP_250ms,
115  CARME_RTC_WAKEUP_125ms
116 } CARME_RTC_WAKEUP_t;
117 #endif
118 
119 /*----- Function prototypes ------------------------------------------------*/
120 void CARME_RTC_Init(void);
123 uint32_t get_fattime(void);
124 
125 /*----- Data ---------------------------------------------------------------*/
126 
127 /*----- Implementation -----------------------------------------------------*/
128 
129 #ifdef __cplusplus
130 }
131 #endif /* __cplusplus */
132 
138 #endif /* __RTC_H__ */
uint8_t ERROR_CODES
Error variable.
Definition: carme.h:255
void CARME_RTC_GetTime(CARME_RTC_TIME_t *time)
Get the date and time from the internal rtc.
Definition: rtc.c:204
uint8_t day
Definition: rtc.h:97
void CARME_RTC_Init(void)
Initialize and start the internal RTC of the STM32F4xx. The date and time is set from the external R...
Definition: rtc.c:105
uint8_t month
Definition: rtc.h:98
uint8_t min
Definition: rtc.h:95
uint8_t sec
Definition: rtc.h:94
uint32_t get_fattime(void)
Get the time from the RTC. This function is used from the FatFs and the function prototype is given ...
Definition: rtc.c:326
uint8_t hour
Definition: rtc.h:96
ERROR_CODES CARME_RTC_SetTime(CARME_RTC_TIME_t *time)
Set the internal rtc date and time.
Definition: rtc.c:167
uint8_t wday
Definition: rtc.h:100
struct _CARME_RTC_TIME_t CARME_RTC_TIME_t
Structure to store a full date and time.
Structure to store a full date and time.
Definition: rtc.h:93
uint8_t year
Definition: rtc.h:99