backup_sram.cpp
Go to the documentation of this file.
1 #include "backup_sram.h"
2 
3 #include "stm32f4xx_pwr.h"
4 #include "stm32f4xx_rcc.h"
5 
6 #include <cstring> //For memcpy
7 
9 {
10 #pragma GCC diagnostic push // Ignore old style cast from included library
11 #pragma GCC diagnostic ignored "-Wold-style-cast"
15 #pragma GCC diagnostic pop
17 }
18 
19 void backup_sram_write(const void *src, size_t len)
20 {
22 #pragma GCC diagnostic push // Ignore old style cast from included library
23 #pragma GCC diagnostic ignored "-Wold-style-cast"
24  std::memcpy(reinterpret_cast<void *>(BKPSRAM_BASE), src, len);
25 #pragma GCC diagnostic pop
27 }
28 
29 void backup_sram_read(void *dst, size_t len)
30 {
31 #pragma GCC diagnostic push // Ignore old style cast from included library
32 #pragma GCC diagnostic ignored "-Wold-style-cast"
33  std::memcpy(dst, reinterpret_cast<const void *>(BKPSRAM_BASE), len);
34 #pragma GCC diagnostic pop
35 }
36 
37 void backup_sram_clear(size_t len)
38 {
40 #pragma GCC diagnostic push // Ignore old style cast from included library
41 #pragma GCC diagnostic ignored "-Wold-style-cast"
42  std::memset(reinterpret_cast<void *>(BKPSRAM_BASE), 0, len);
43 #pragma GCC diagnostic pop
45 }
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Enables or disables the Low Speed APB (APB1) peripheral clock.
void backup_sram_init()
Definition: backup_sram.cpp:8
This file contains all the functions prototypes for the PWR firmware library.
void RCC_AHB1PeriphClockCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState)
Enables or disables the AHB1 peripheral clock.
void PWR_BackupAccessCmd(FunctionalState NewState)
Enables or disables access to the RTC and backup registers.
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Forces or releases Low Speed APB (APB1) peripheral reset.
void backup_sram_read(void *dst, size_t len)
Definition: backup_sram.cpp:29
void backup_sram_write(const void *src, size_t len)
Definition: backup_sram.cpp:19
void backup_sram_clear(size_t len)
Definition: backup_sram.cpp:37
void PWR_BackupRegulatorCmd(FunctionalState NewState)
Enables or disables the Backup Regulator.
#define BKPSRAM_BASE
Definition: stm32f4xx.h:1849


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46