Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h
mmi 1bbfa1c7f3 Added calibration setpoints
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@417 05563f52-14a8-4384-a975-3d1654cca0fa
2018-01-11 13:55:17 +00:00

135 lines
5.1 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_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 (121)
#define APP_FLASH_PRESET_CATHODE_PAGE (122)
#define APP_FLASH_PRESET_MCP_PAGE (123)
#define APP_FLASH_PRESET_TESLA_PAGE (124)
#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 Calibration parameters (setpoints etc)
#define APP_FLASH_CALIBRATION_PAGE (125)
#define APP_FLASH_STORAGE_CALIBRATION (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_CALIBRATION_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_POWERLOSS_PAGE (127)
#define APP_FLASH_STORAGE_POWERLOSS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_POWERLOSS_PAGE)
#define APP_FLASH_POWERLOSS_PAGESIZE (INTERNAL_FLASH_PAGE_SIZE)
// 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_enableSafetyWithError(void);
extern ErrorStatus hsb_enableSafetyWithWarning(void);
extern ErrorStatus hsb_disableSafety(void);
extern bool hsb_safetyIsEnabled(void);
#endif /* HSB_MRTS_H_ */