2014-08-29 07:52:33 -07:00
|
|
|
/**
|
|
|
|
* @file flash_main.h
|
|
|
|
* @brief
|
|
|
|
*
|
|
|
|
* @date Sep 19, 2013
|
2015-01-12 15:04:10 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2015
|
2014-08-29 07:52:33 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FLASH_MAIN_H_
|
|
|
|
#define FLASH_MAIN_H_
|
|
|
|
|
|
|
|
#include "engine_configuration.h"
|
2014-11-02 10:03:07 -08:00
|
|
|
#include "engine.h"
|
2014-08-29 07:52:33 -07:00
|
|
|
|
2015-05-22 20:08:51 -07:00
|
|
|
#define FLASH_DATA_VERSION 8100
|
2014-08-29 07:52:33 -07:00
|
|
|
|
|
|
|
void readFromFlash(void);
|
2015-01-14 16:03:39 -08:00
|
|
|
void initFlash(Logging *sharedLogger, Engine *engine);
|
2014-11-02 10:03:07 -08:00
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
/**
|
|
|
|
* Because of hardware-related issues, stm32f4 chip is totally
|
|
|
|
* frozen while we are writing to internal flash. Writing the configuration takes
|
|
|
|
* about 1-2 seconds, we cannot afford to do that while the engine is
|
|
|
|
* running so we postpone the write until the engine is stopped.
|
|
|
|
*/
|
2015-02-19 06:04:18 -08:00
|
|
|
void writeToFlashNow(void);
|
2014-08-29 07:52:33 -07:00
|
|
|
void setNeedToWriteConfiguration(void);
|
|
|
|
/**
|
|
|
|
* @return true if an flash write is pending
|
|
|
|
*/
|
|
|
|
bool getNeedToWriteConfiguration(void);
|
|
|
|
void writeToFlashIfPending(void);
|
|
|
|
|
|
|
|
#endif /* FLASH_MAIN_H_ */
|