1 |
582 |
jeremybenn |
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
|
2 |
|
|
* File Name : stm32f10x_rtc.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 09/29/2006
|
5 |
|
|
* Description : This file contains all the functions prototypes for the
|
6 |
|
|
* RTC firmware library.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 04/02/2007: V0.2
|
10 |
|
|
* 02/05/2007: V0.1
|
11 |
|
|
* 09/29/2006: V0.01
|
12 |
|
|
********************************************************************************
|
13 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
14 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
15 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
16 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
17 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
18 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
19 |
|
|
*******************************************************************************/
|
20 |
|
|
|
21 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
22 |
|
|
#ifndef __STM32F10x_RTC_H
|
23 |
|
|
#define __STM32F10x_RTC_H
|
24 |
|
|
|
25 |
|
|
/* Includes ------------------------------------------------------------------*/
|
26 |
|
|
#include "stm32f10x_map.h"
|
27 |
|
|
|
28 |
|
|
/* Exported types ------------------------------------------------------------*/
|
29 |
|
|
/* Exported constants --------------------------------------------------------*/
|
30 |
|
|
/* RTC interrupts define -----------------------------------------------------*/
|
31 |
|
|
#define RTC_IT_OW ((u16)0x0004) /* Overflow interrupt */
|
32 |
|
|
#define RTC_IT_ALR ((u16)0x0002) /* Alarm interrupt */
|
33 |
|
|
#define RTC_IT_SEC ((u16)0x0001) /* Second interrupt */
|
34 |
|
|
|
35 |
|
|
#define IS_RTC_IT(IT) (((IT & (u16)0xFFF8) == 0x00) && (IT != 0x00))
|
36 |
|
|
|
37 |
|
|
#define IS_RTC_GET_IT(IT) ((IT == RTC_IT_OW) || (IT == RTC_IT_ALR) || \
|
38 |
|
|
(IT == RTC_IT_SEC))
|
39 |
|
|
|
40 |
|
|
/* RTC interrupts flags ------------------------------------------------------*/
|
41 |
|
|
#define RTC_FLAG_RTOFF ((u16)0x0020) /* RTC Operation OFF flag */
|
42 |
|
|
#define RTC_FLAG_RSF ((u16)0x0008) /* Registers Synchronized flag */
|
43 |
|
|
#define RTC_FLAG_OW ((u16)0x0004) /* Overflow flag */
|
44 |
|
|
#define RTC_FLAG_ALR ((u16)0x0002) /* Alarm flag */
|
45 |
|
|
#define RTC_FLAG_SEC ((u16)0x0001) /* Second flag */
|
46 |
|
|
|
47 |
|
|
#define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG & (u16)0xFFF0) == 0x00) && (FLAG != 0x00))
|
48 |
|
|
|
49 |
|
|
#define IS_RTC_GET_FLAG(FLAG) ((FLAG == RTC_FLAG_RTOFF) || (FLAG == RTC_FLAG_RSF) || \
|
50 |
|
|
(FLAG == RTC_FLAG_OW) || (FLAG == RTC_FLAG_ALR) || \
|
51 |
|
|
(FLAG == RTC_FLAG_SEC))
|
52 |
|
|
|
53 |
|
|
#define IS_RTC_PRESCALER(PRESCALER) (PRESCALER <= 0xFFFFF)
|
54 |
|
|
|
55 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
56 |
|
|
/* Exported functions ------------------------------------------------------- */
|
57 |
|
|
void RTC_ITConfig(u16 RTC_IT, FunctionalState NewState);
|
58 |
|
|
void RTC_EnterConfigMode(void);
|
59 |
|
|
void RTC_ExitConfigMode(void);
|
60 |
|
|
u32 RTC_GetCounter(void);
|
61 |
|
|
void RTC_SetCounter(u32 CounterValue);
|
62 |
|
|
u32 RTC_GetPrescaler(void);
|
63 |
|
|
void RTC_SetPrescaler(u32 PrescalerValue);
|
64 |
|
|
void RTC_SetAlarm(u32 AlarmValue);
|
65 |
|
|
u32 RTC_GetDivider(void);
|
66 |
|
|
void RTC_WaitForLastTask(void);
|
67 |
|
|
void RTC_WaitForSynchro(void);
|
68 |
|
|
FlagStatus RTC_GetFlagStatus(u16 RTC_FLAG);
|
69 |
|
|
void RTC_ClearFlag(u16 RTC_FLAG);
|
70 |
|
|
ITStatus RTC_GetITStatus(u16 RTC_IT);
|
71 |
|
|
void RTC_ClearITPendingBit(u16 RTC_IT);
|
72 |
|
|
|
73 |
|
|
#endif /* __STM32F10x_RTC_H */
|
74 |
|
|
|
75 |
|
|
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
|