MG32F157 Standard Peripherals Firmware Library
Macros | Functions
mg32f157_bkp.c File Reference

This file provides all the BKP firmware functions. More...

#include "mg32f157_bkp.h"
#include "mg32f157_rcc.h"

Macros

#define BKP_OFFSET   (BKP_BASE - PERIPH_BASE)
 
#define CR_OFFSET   (BKP_OFFSET + 0x30)
 
#define TPAL_BitNumber   0x01
 
#define CR_TPAL_BB   (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPAL_BitNumber * 4))
 
#define TPE_BitNumber   0x00
 
#define CR_TPE_BB   (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPE_BitNumber * 4))
 
#define CSR_OFFSET   (BKP_OFFSET + 0x34)
 
#define TPIE_BitNumber   0x02
 
#define CSR_TPIE_BB   (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TPIE_BitNumber * 4))
 
#define TIF_BitNumber   0x09
 
#define CSR_TIF_BB   (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TIF_BitNumber * 4))
 
#define TEF_BitNumber   0x08
 
#define CSR_TEF_BB   (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TEF_BitNumber * 4))
 
#define RTCCR_CAL_MASK   ((uint16_t)0xFF80)
 
#define RTCCR_MASK   ((uint16_t)0xFC7F)
 

Functions

void BKP_DeInit (void)
 Deinitializes the BKP peripheral registers to their default reset values. More...
 
void BKP_TamperPinLevelConfig (uint16_t BKP_TamperPinLevel)
 Configures the Tamper Pin active level. More...
 
void BKP_TamperPinCmd (FunctionalState NewState)
 Enables or disables the Tamper Pin activation. More...
 
void BKP_ITConfig (FunctionalState NewState)
 Enables or disables the Tamper Pin Interrupt. More...
 
void BKP_RTCOutputConfig (uint16_t BKP_RTCOutputSource)
 Select the RTC output source to output on the Tamper pin. More...
 
void BKP_SetRTCCalibrationValue (uint8_t CalibrationValue)
 Sets RTC Clock Calibration value. More...
 
void BKP_WriteBackupRegister (uint16_t BKP_DR, uint16_t Data)
 Writes user data to the specified Data Backup Register. More...
 
uint16_t BKP_ReadBackupRegister (uint16_t BKP_DR)
 Reads data from the specified Data Backup Register. More...
 
FlagStatus BKP_GetFlagStatus (void)
 Checks whether the Tamper Pin Event flag is set or not. More...
 
void BKP_ClearFlag (void)
 Clears Tamper Pin Event pending flag. More...
 
ITStatus BKP_GetITStatus (void)
 Checks whether the Tamper Pin Interrupt has occurred or not. More...
 
void BKP_ClearITPendingBit (void)
 Clears Tamper Pin Interrupt pending bit. More...
 

Detailed Description

This file provides all the BKP firmware functions.

Author
MegawinTech Application Team
Version
V0.0.4
Date
16-June-2023