#ifndef __CONTROLSYSTEM_H__
#define __CONTROLSYSTEM_H__
/*--------------------------------------------------------------------------------------
*  @file     ControlSystem.h
*  @author   ZhangJing
*  @version  base on stm32f0x   
*  @date     2015.09.11
*  @brief    整个系统的控制动作及策略
---------------------------------------------------------------------------------------*/
#include "stdint.h"

typedef enum
{
	EnterStartup = 1,//进入开机页
	EnterHistory = 2,//进入历史回顾
	EnterDeviceID = 3,//进入设备ID设置
	EnterDispTime = 4,//进入时间显示
	EnterSetTime = 5,//进入时间设置
	EnterSetPassword = 6,//进入密码设置
	EnterVerifyInfo = 7,//进入确认住院信息
	EnterSetParam = 8,//进入参数设置
	EnterAirout = 9,//进入排气
	EnterRunFirstDose = 10,//进入运行首次量
	EnterRunMain = 11,//进入运行主界面
	EnterRunPressure = 12,//进入运行压力界面
	EnterLockPassword = 13,//进入锁定密码
	EnterTransfuseOver = 14,//输液完毕
	EnterMechanicalFault = 15,//机械故障
	EnterJamFault = 16,//堵塞故障
	EnterMaxFault = 17,//极限值故障
	EnterBubbleFault = 18,//气泡或无液
	EnterNonePillCaseFault = 19,//未装药盒
	EnterBatteryVoltLow = 20,//电池电量低
	EnterLineLost = 21,//管路脱落
	EnterEvaluateTransfuse = 22,//进入随访-输注评价	
	EnterEvaluatePain = 23,//进入疼痛评价
	EnterLimbMyodynamia = 24,//进入四肢肌力
	EnterEvaluateVerify = 25,//进入确认评价
	EnterEngineeringMode1	= 26,//进入工程模式1
	EnterEngineeringMode2 = 27,//进入工程模式2
	EnterSetVerifyInfo = 28,//进入设置确认住院信息
	EnterPowerON = 29,//进入供电状态
	EnterPowerOFF = 30,//进入断电状态
	EnterInputTotal = 31,//进入输入总量报警状态
	EnterInpatien = 32, //为设置住院号提示界面
	EnterDetection =33,
}SysWorkStepType;

typedef enum
{
	FirstDoseMode = 1,//首次量
	ContinueMode = 2,//持续量
	SuperadditionMode = 3,//追加量
}SysInfusionModeType;//系统输液模式类型

void CntlSysInitWork( void );
void CntlMotorWork( uint16_t pwmSetValue );
void CntlSystemWorkStep( void );
void CntlSystemWorkTimer( void );
void RealTimeStateUpdate( void );
void CntlSpeakerWork( void );
void CntlSensorPWWork( void );
void CntlAutoPowerOff( void );
void CntlNoActionHint( void );
void CntlLCDBlackWork( void );
void ScanKeyWorkType( void );
void CntlSystemStandby( void );
void InfusionControl(SysInfusionModeType infusionMode);
void CntlInpatienPicture(void);  //未设置住院号提醒界面
void HornWorkStatus(uint8_t status);
void CntlHornWork( void );

extern SysWorkStepType emSysWorkStep;//系统工作步骤
extern SysWorkStepType emAlarmRecordStep;//报警时要将现在在哪页记录下来
extern SysWorkStepType emAlarmRememberStep;//报警时记录报警界面
extern uint32_t	InfusionStopTimer;//输液时间
extern uint32_t	InfusionXmitTimer;//输注发送时间
extern uint8_t TotalDoesChange0 ;//工程模式输注总量变化1变0
extern uint8_t TotalDoesChange1 ;//工程模式输注总量变化0变1
//extern uint8_t TestSwitch ;			//工程模式中测试开关打开其他数据不在发送
extern uint8_t pca_count;							//一小时内PCA按压次数
extern uint8_t LimitBeginsTime;
extern SysInfusionModeType infusionMode ;
extern uint8_t sysPromptToneTypebf;  //声音类型记录
extern uint8_t FackreadIndex;			//假读索引
#endif
