Updated memory storage functionality
- cachedStorage is functional - Presets can be loaded from FLASH - CRC32 added and applied - Presets with corrputed data will be replaced by default preset Next: Preset update functionality from menu git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@269 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0xA000 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x8000 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -60,5 +61,25 @@ struct RepairPreset
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* RepairPreset_generateDefaultPreset
|
||||
* Generates a default preset
|
||||
* Values that are used are:
|
||||
* numberOfStages: 1
|
||||
* softstart: 100 seconds
|
||||
* Duration: 200 seconds
|
||||
* Voltage: 0 Volts
|
||||
* The voltage is chosen to support both positive and negative voltages
|
||||
*
|
||||
* @param self The repair preset object
|
||||
* @param presetNumber the index of the preset
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if generation was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus RepairPreset_generateDefaultPreset(struct RepairPreset* self, unsigned int presetNumber);
|
||||
|
||||
#endif /* REPAIRPRESET_H_ */
|
||||
@@ -0,0 +1,120 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file RepairPresets.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file RepairPresets.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef REPAIRPRESETS_H_
|
||||
#define REPAIRPRESETS_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "RepairPreset.h"
|
||||
|
||||
#include "CachedStorage.h"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define REPAIR_PRESETS_NUMBER_OF_PRESETS (9)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REPAIR_PRESETS_ANODE,
|
||||
REPAIR_PRESETS_CATHODE,
|
||||
REPAIR_PRESETS_MCP,
|
||||
REPAIR_PRESETS_TESLA,
|
||||
}REPAIR_PRESETS_ID;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* RepairPresets_construct
|
||||
* Constructor for repair presets
|
||||
*
|
||||
* @return ErrorStatus
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus RepairPresets_construct(struct CachedStorage* presetStorage, struct MemoryDevice* memoryDevice);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* RepairPresets_destruct
|
||||
* Destructor for repair presets
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void RepairPresets_destruct(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* RepairPresets_loadPresets
|
||||
* Loads a new set of presets into the cached storage
|
||||
* Prior to loading, any previously loaded presets will be unloaded
|
||||
* automatically
|
||||
*
|
||||
* @param presetID Identifier of the set of presets
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if loading was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus RepairPresets_loadPresets(REPAIR_PRESETS_ID presetID);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* RepairPresets_getPreset
|
||||
* Returns a pointer to a specific repair preset
|
||||
*
|
||||
* @param index Index of the repair preset to return
|
||||
* must be between 1 and
|
||||
* REPAIR_PRESETS_NUMBER_OF_PRESETS
|
||||
*
|
||||
* @return const struct RepairPreset*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern const struct RepairPreset* RepairPresets_getPreset(unsigned int index);
|
||||
|
||||
|
||||
|
||||
#endif /* REPAIRPRESETS_H_ */
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "repairPreset.h"
|
||||
#include "RepairPreset.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
|
||||
@@ -33,7 +33,11 @@
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "RepairPreset.h"
|
||||
#include "RepairPresets.h"
|
||||
|
||||
#include "gpio.h"
|
||||
#include "InternalFlash.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -67,6 +71,32 @@
|
||||
#define HSB_DAC_TESLA_MAX_VOLTAGE (6200)
|
||||
|
||||
|
||||
// FLASH ADDRESSES FOR DATA STORAGE
|
||||
|
||||
// Define storage for presets, which is the biggest storage part
|
||||
// Each set of presets is written/saved on a dedicated page. This reduces
|
||||
// cache size when erasing page prior to write
|
||||
#define APP_FLASH_PRESET_ANODE_PAGE (122)
|
||||
#define APP_FLASH_PRESET_CATHODE_PAGE (123)
|
||||
#define APP_FLASH_PRESET_MCP_PAGE (124)
|
||||
#define APP_FLASH_PRESET_TESLA_PAGE (125)
|
||||
#define APP_FLASH_STORAGE_PRESET_SIZE (sizeof(struct RepairPreset) * REPAIR_PRESETS_NUMBER_OF_PRESETS)
|
||||
#define APP_FLASH_STORAGE_PRESET_ANODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_ANODE_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_CATHODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_CATHODE_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_MCP (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_MCP_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_TESLA (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_TESLA_PAGE)
|
||||
|
||||
// Define storage for device parameters like PID constants and others
|
||||
#define APP_FLASH_PARAMETERS_PAGE (126)
|
||||
#define APP_FLASH_STORAGE_PARAMETERS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PARAMETERS_PAGE)
|
||||
|
||||
// Define storage for power-down detection flag
|
||||
#define APP_FLASH_POWERDOWN_PAGE (127)
|
||||
#define APP_FLASH_STORAGE_POWERDOWN (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_POWERDOWN_PAGE)
|
||||
|
||||
|
||||
|
||||
|
||||
// Exports of objects on application level
|
||||
extern struct Display* const mainDisplay;
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -38,9 +38,10 @@
|
||||
#include "semphr.h"
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include "repairPreset.h"
|
||||
#include "RepairPreset.h"
|
||||
#include "repairProcess.h"
|
||||
|
||||
#include "CachedStorage.h"
|
||||
#include "Interlock.h"
|
||||
#include "keypadMatrix.h"
|
||||
#include "Observable.h"
|
||||
@@ -134,6 +135,8 @@ struct RepairMenu
|
||||
bool initialized;
|
||||
struct Display* display;
|
||||
struct KeyboardDevice* keyboardDevice;
|
||||
struct MemoryDevice* memoryDevice;
|
||||
struct CachedStorage presetStorage;
|
||||
T_MenuState menuState;
|
||||
int cursorIndex;
|
||||
int scrollOffset;
|
||||
@@ -167,7 +170,7 @@ struct RepairMenu
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, Observer repairScreenUpdateObserver);
|
||||
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* display, struct KeyboardDevice* keyboardDevice, struct MemoryDevice* memoryDevice, int taskPriority, uint16_t stackSize, Observer repairScreenUpdateObserver);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "ADConverter.h"
|
||||
#include "DAConverter.h"
|
||||
#include "repairPreset.h"
|
||||
#include "RepairPreset.h"
|
||||
#include "repairProcessRow.h"
|
||||
#include "SignalProfileGenerator.h"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "repairPreset.h"
|
||||
#include "RepairPreset.h"
|
||||
#include "repairProcess.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user