You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
451 B
22 lines
451 B
6 years ago
|
#include "stm32f4xx.h"
|
||
|
#include "bkp_sram.h"
|
||
|
|
||
|
void bkp_sram_init(void)
|
||
|
{
|
||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
|
||
|
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE);
|
||
|
PWR_BackupAccessCmd(ENABLE);
|
||
|
PWR_BackupRegulatorCmd(ENABLE);
|
||
|
}
|
||
|
|
||
|
void bkp_sram_write(int off, unsigned int value)
|
||
|
{
|
||
|
*(volatile uint32_t *) (BKPSRAM_BASE + off) = value;
|
||
|
}
|
||
|
|
||
|
unsigned int bkp_sram_read(int off)
|
||
|
{
|
||
|
return *(volatile uint32_t *) (BKPSRAM_BASE + off);
|
||
|
}
|
||
|
|