summaryrefslogtreecommitdiff
path: root/bsp/apm32/libraries/APM32S10x_Library/APM32S10x_StdPeriphDriver/inc/apm32s10x_bakpr.h
blob: 317f1f3a09c4865872db405883e5c6576eb1be35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*!
 * @file        apm32s10x_bakr.h
 *
 * @brief       This file contains all the functions prototypes for the BAKPR firmware library.
 *
 * @version     V1.0.1
 *
 * @date        2022-12-31
 *
 * @attention
 *
 *  Copyright (C) 2022-2023 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be usefull and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef __APM32S10X_BAKPR_H
#define __APM32S10X_BAKPR_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes */
#include "apm32s10x.h"

/** @addtogroup APM32S10x_StdPeriphDriver
  @{
*/

/** @addtogroup BAKPR_Driver BAKPR Driver
  @{
*/

/** @defgroup BAKPR_Enumerations Enumerations
  @{
*/

/**
 * @brief BAKPR TAMPER Pin Active Level
 */
typedef enum
{
    BAKPR_TAMPER_PIN_LEVEL_HIGH,
    BAKPR_TAMPER_PIN_LEVEL_LOW
} BAKPR_TAMPER_PIN_LEVEL_T;

/**
 * @brief BAKPR RTC output source
 */
typedef enum
{
    BAKPR_RTC_OUTPUT_SOURCE_NONE,
    BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK,
    BAKPR_RTC_OUTPUT_SOURCE_ALARM,
    BAKPR_RTC_OUTPUT_SOURCE_SECOND
} BAKPR_RTC_OUTPUT_SOURCE_T;

/**
 * @brief BAKPR DATA register Addr
 */
typedef enum
{
    BAKPR_DATA1  = ((uint16_t)0x0004),
    BAKPR_DATA2  = ((uint16_t)0x0008),
    BAKPR_DATA3  = ((uint16_t)0x000C),
    BAKPR_DATA4  = ((uint16_t)0x0010),
    BAKPR_DATA5  = ((uint16_t)0x0014),
    BAKPR_DATA6  = ((uint16_t)0x0018),
    BAKPR_DATA7  = ((uint16_t)0x001C),
    BAKPR_DATA8  = ((uint16_t)0x0020),
    BAKPR_DATA9  = ((uint16_t)0x0024),
    BAKPR_DATA10 = ((uint16_t)0x0028)
} BAKPR_DATA_T;

/**@} end of group BAKPR_Enumerations */

/** @defgroup BAKPR_Functions Functions
  @{
*/

/* BAKPR reset and configuration */
void BAKPR_Reset(void);
void BAKPR_ConfigTamperPinLevel(BAKPR_TAMPER_PIN_LEVEL_T value);
void BAKPR_EnableTamperPin(void);
void BAKPR_DisableTamperPin(void);
void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure);
void BAKPR_ConfigRTCCalibrationValue(uint8_t calibrationValue);
void BAKPR_ConfigBackupRegister(BAKPR_DATA_T bakrData, uint16_t data);
uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData);

/* Interrupts and flags */
void BAKPR_EnableInterrupt(void);
void BAKPR_DisableInterrupt(void);
uint8_t BAKPR_ReadStatusFlag(void);
void BAKPR_ClearStatusFlag(void);
uint8_t BAKPR_ReadIntFlag(void);
void BAKPR_ClearIntFlag(void);

/**@} end of group BAKPR_Functions */
/**@} end of group BAKPR_Driver */
/**@} end of group APM32S10x_StdPeriphDriver */

#ifdef __cplusplus
}
#endif

#endif /* __APM32S10X_BAKPR_H */