Merge branch 'master' of https://github.com/noisymime/speeduino
This commit is contained in:
commit
0a7d27370e
|
@ -81,6 +81,7 @@ void initialiseAll()
|
|||
//if user let go of key within 1 second erase eeprom
|
||||
if(digitalRead(EEPROM_RESET_PIN) != LOW){
|
||||
#if defined(FLASH_AS_EEPROM_h)
|
||||
EEPROM.read(0); //needed for SPI eeprom emulation.
|
||||
EEPROM.clear();
|
||||
#else
|
||||
for (int i = 0 ; i < EEPROM.length() ; i++) { EEPROM.write(i, 255);}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#if defined(STM32F407xx)
|
||||
#include "BackupSramAsEEPROM.h"
|
||||
|
||||
|
||||
BackupSramAsEEPROM::BackupSramAsEEPROM(){
|
||||
//Enable the power interface clock
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
|
||||
|
@ -25,6 +26,7 @@
|
|||
//Wait until the backup power regulator is ready
|
||||
while ((PWR->CSR & PWR_CSR_BRR) == 0);
|
||||
}
|
||||
uint16_t BackupSramAsEEPROM::length(){ return 4096; }
|
||||
int8_t BackupSramAsEEPROM::write_byte( uint8_t *data, uint16_t bytes, uint16_t offset ) {
|
||||
uint8_t* base_addr = (uint8_t *) BKPSRAM_BASE;
|
||||
uint16_t i;
|
||||
|
|
|
@ -17,6 +17,7 @@ class BackupSramAsEEPROM {
|
|||
uint8_t read(uint16_t address);
|
||||
int8_t write(uint16_t address, uint8_t val);
|
||||
int8_t update(uint16_t address, uint8_t val);
|
||||
uint16_t length();
|
||||
template< typename T > T &get( int idx, T &t ){
|
||||
uint16_t e = idx;
|
||||
uint8_t *ptr = (uint8_t*) &t;
|
||||
|
|
Loading…
Reference in New Issue