Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h
mmi 17207a3a4b Fixed some major issues with RAM shortage. Also moved the cached storage to a MALLOC design instead of fixed memory usage. Using freertos porteds malloc and free required to move to HEAP4 to make sure memory does not get fragmented.
Resized nearly all task stacks

Also: 
- Menu fixes for insertion. Almost done, just need to fix the negative voltage insertion for mcp and cathode
- Added Device parameters, must be filled in

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@271 05563f52-14a8-4384-a975-3d1654cca0fa
2017-11-07 15:50:25 +00:00

131 lines
4.7 KiB
C

// -----------------------------------------------------------------------------
/// @file hsb-mrts.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 hsb-mrts.h
/// @ingroup {group_name}
#ifndef HSB_MRTS_H_
#define HSB_MRTS_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
#include "RepairPreset.h"
#include "RepairPresets.h"
#include "gpio.h"
#include "InternalFlash.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define HSB_MAINMENU_TASK_PRIORITY (2)
#define HSB_MAINMENU_TASK_STACKSIZE (512)
#define HSB_MAINDISP_TASK_PRIORITY (2)
#define HSB_MAINDISP_TASK_STACKSIZE (256)
#define HSB_MAINREPR_TASK_PRIORITY (2)
#define HSB_MAINREPR_TASK_STACKSIZE (512)
#define HSB_MAINREPR_OOL_DURATION (20)
#define HSB_MAINREPR_OOL_VALUE (300)
#define HSB_SECURITY_VOLTAGE_THRESHOLD (100)
#define HSB_ADC_ANODE_MIN_VOLTAGE (0)
#define HSB_ADC_ANODE_MAX_VOLTAGE (10042)
#define HSB_ADC_CMCP_MIN_VOLTAGE (0)
#define HSB_ADC_CMCP_MAX_VOLTAGE (-2018)
#define HSB_ADC_TESLA_MIN_VOLTAGE (0)
#define HSB_ADC_TESLA_MAX_VOLTAGE (6070)
#define HSB_DAC_ANODE_MIN_VOLTAGE (0)
#define HSB_DAC_ANODE_MAX_VOLTAGE (10100)
#define HSB_DAC_CMCP_MIN_VOLTAGE (0)
#define HSB_DAC_CMCP_MAX_VOLTAGE (-2200)
#define HSB_DAC_TESLA_MIN_VOLTAGE (0)
#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;
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* hsb_generateStartScreen
* Description of function
*
* @param Display
* @param
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus hsb_generateStartScreen(struct Display* Display);
extern ErrorStatus hsb_enableSafety(void);
extern ErrorStatus hsb_disableSafety(void);
#endif /* HSB_MRTS_H_ */