//设置单片机控制板控制的按键灯 public void SetKeyLedByKey(Board board, ARM_InputPoint Key, LED_State LedState) { IOValue Value = LedState == (LED_State.LED_ON) ? IOValue.IOValueHigh : IOValue.IOValueLow; ARM_OutputPoint KeyLed = ARM_OutputPoint.IO_OUT_LedKeyRun; switch (Key) { case ARM_InputPoint.IO_IN_KeyRun: KeyLed = ARM_OutputPoint.IO_OUT_LedKeyRun; break; case ARM_InputPoint.IO_IN_KeyPause: KeyLed = ARM_OutputPoint.IO_OUT_LedKeyPause; break; case ARM_InputPoint.IO_IN_KeyStop: KeyLed = ARM_OutputPoint.IO_OUT_LedKeyStop; break; case ARM_InputPoint.IO_IN_KeyReset: KeyLed = ARM_OutputPoint.IO_OUT_LedKeyReset; break; default: break; } SetArmControlBoardIo(board, KeyLed, Value); }
public static void ProcessArmControlerInputPoint(Board board) { //解析IoIn for (int i = 0; i < (int)ARM_InputPoint.IO_IN_MAX; i++) { bool State = m_ArmControler.ReadInputPoint((ARM_InputPoint)i); LED_State LedState = State ? LED_State.LED_ON : LED_State.LED_OFF; if (State != m_ArmControler.ReadInputPointStateBackups((ARM_InputPoint)i)) { m_ArmControler.SetInputPointStateBackups((ARM_InputPoint)i, State); ARM_InputPoint temp = (ARM_InputPoint)i; switch (temp) { case ARM_InputPoint.IO_IN_KeyRun: { if (State) { ProcessKey(Key.Key_Run); } DataStruct.SysStat.KeyRun = State; m_ArmControler.SetKeyLedByKey(board, ARM_InputPoint.IO_IN_KeyRun, LedState); } break; case ARM_InputPoint.IO_IN_KeyPause: { if (State) { ProcessKey(Key.Key_Pause); } DataStruct.SysStat.KeyPause = State; m_ArmControler.SetKeyLedByKey(board, ARM_InputPoint.IO_IN_KeyPause, LedState); } break; case ARM_InputPoint.IO_IN_KeyStop: { if (State) { ProcessKey(Key.Key_Stop); } DataStruct.SysStat.KeyStop = State; m_ArmControler.SetKeyLedByKey(board, ARM_InputPoint.IO_IN_KeyStop, LedState); } break; case ARM_InputPoint.IO_IN_KeyReset: { if (State) { ProcessKey(Key.Key_Reset); } DataStruct.SysStat.KeyReset = State; m_ArmControler.SetKeyLedByKey(board, ARM_InputPoint.IO_IN_KeyReset, LedState); } break; default: break; } } } }