|
@@ -23,21 +23,23 @@ void LockAndUnlockCtrl()
|
|
|
static uint16 LockDelay = 0;
|
|
|
static uint16 UnlockDelay = 0;
|
|
|
static uint8 CtrlFlg = 0;
|
|
|
+ static uint16 BleConCounter = 0;
|
|
|
+ static uint16 battSwpeModeCounter = 0;
|
|
|
if (ebcd_flg_ebcManCtrlEn) //手动控制使能
|
|
|
{
|
|
|
- if (ebcd_flg_ebcManCtrlMode==1)
|
|
|
+ if (ebcd_flg_ebcManCtrlMode==1)//循环控制模式
|
|
|
{
|
|
|
- if(ebcd_st_lockSensor==1)//处于锁紧状态
|
|
|
+ if(ebcd_st_lockSensor==1)//处于锁紧状态,传感器判定一个
|
|
|
{
|
|
|
LockDelay = LockDelay + 10;
|
|
|
if(LockDelay>LockDelayTime)//锁紧状态超时就解锁
|
|
|
{
|
|
|
- Control_Times++;
|
|
|
+ ManuControlTimes++;
|
|
|
LockDelay = 0;
|
|
|
CtrlFlg = Unlock;
|
|
|
}
|
|
|
}
|
|
|
- else if(ebcd_st_unlockSensor==1)//处于解锁状态
|
|
|
+ else if(ebcd_st_unlockSensor==1)//处于解锁状态,传感器判定一个
|
|
|
{
|
|
|
UnlockDelay = UnlockDelay + 10;
|
|
|
if(UnlockDelay>UnlockDelayTime)
|
|
@@ -47,20 +49,89 @@ void LockAndUnlockCtrl()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if(ebcd_flg_ebcManCtrlMode==2)
|
|
|
+ else if(ebcd_flg_ebcManCtrlMode==2)//控制锁紧
|
|
|
{
|
|
|
CtrlFlg = Lock;
|
|
|
}
|
|
|
- else if(ebcd_flg_ebcManCtrlMode==3)
|
|
|
+ else if(ebcd_flg_ebcManCtrlMode==3)//控制解锁
|
|
|
{
|
|
|
CtrlFlg = Unlock;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
else //正常工作模式,暂时为空
|
|
|
{
|
|
|
+ switch(ebcd_st_ebcWork)
|
|
|
+ {
|
|
|
+ case 0://行车状态,自动进入,默认状态
|
|
|
+ {
|
|
|
+ PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,0);//行车状态换电指示灯关闭
|
|
|
+ if(bled_flg_handShake==1)
|
|
|
+ {
|
|
|
+ ebcd_st_ebcWork = 1;
|
|
|
+ bled_flg_handShake = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 1://通讯状态,握手才能进入
|
|
|
+ {
|
|
|
+ BleConCounter = BleConCounter + 10;
|
|
|
+ if((BleConCounter%1000)<500)//换电指示灯闪烁
|
|
|
+ {
|
|
|
+ PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,0);
|
|
|
+ }
|
|
|
|
|
|
+ if(BleConCounter>=60*1000||bled_flg_backToDrv == 1)
|
|
|
+ {
|
|
|
+ ebcd_st_ebcWork = 0;//切换到行车状态
|
|
|
+ BleConCounter = 0;
|
|
|
+ bled_flg_backToDrv = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if(BattCD_stWakeupU.B.bLogic==0&&(bled_flg_toSwapMod==1 || BattCD_stWakeupU.B.bWkpSig1==1))
|
|
|
+ {
|
|
|
+ ebcd_st_ebcWork = 2;//切换到换电状态
|
|
|
+ BleConCounter = 0;
|
|
|
+ bled_flg_toSwapMod = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(bled_st_dataTrans==1)
|
|
|
+ {
|
|
|
+ BleConCounter = 0;
|
|
|
+ bled_st_dataTrans = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 2://换电状态
|
|
|
+ {
|
|
|
+ PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,1);//换电状态换电指示灯常亮
|
|
|
+ battSwpeModeCounter = battSwpeModeCounter + 10;
|
|
|
+ if(bled_flg_swapBattDone==1)
|
|
|
+ {
|
|
|
+ bled_flg_swapBattDone = 0;
|
|
|
+ ebcd_st_ebcWork = 1; //切换到通讯状态
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if(battSwpeModeCounter>=60*1000)
|
|
|
+ {
|
|
|
+ battSwpeModeCounter = 0;//切换到行车状态
|
|
|
+ ebcd_st_ebcWork = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(bled_st_dataTrans==1)
|
|
|
+ {
|
|
|
+ battSwpeModeCounter = 0;
|
|
|
+ bled_st_dataTrans = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//锁紧解锁执行
|
|
|
if(CtrlFlg)
|
|
|
{
|
|
@@ -281,540 +352,3 @@ uint16 Look1_u32u8(uint32 u0, uint32 *bp0, uint8 *table, uint16 MaxLen)
|
|
|
}
|
|
|
return y;
|
|
|
}
|
|
|
-#ifdef _APP_TEST_CODE
|
|
|
-void TestDeviceFun(void)
|
|
|
-{
|
|
|
- uint8 ManuEnable = 0;
|
|
|
- //控制算法
|
|
|
- AccPedCD_Update();
|
|
|
- AccPedCD_Monitor();
|
|
|
-
|
|
|
- PulseAcqDrv_GetChanFreq(_PULSEACQ_INDEX_CP_CHAN, &VehCo_fInputUIA[0], &VehCo_rInputUWA[0]);
|
|
|
-
|
|
|
- // DODrv_SetChanState(_DO_INDEX_CPCTL_CHAN,(uint8)VehCo_bTestCPCtrlUW_C);
|
|
|
-
|
|
|
- uint16 DistenceBufferV[2] = {0, 0}, DistenceBufferR[2] = {0, 0};
|
|
|
- //开关1采集
|
|
|
- DINDrv_SetChanThres(_DIN_INDEX_BAK1_CHAN, 1, 4095U);
|
|
|
- Switch1 = !DINDrv_GetChanState(_DIN_INDEX_BAK1_CHAN);
|
|
|
- //手动控制采集
|
|
|
- DINDrv_SetChanThres(_DIN_INDEX_BAK2_CHAN, 1, 4095U);
|
|
|
- ManuEnable = !DINDrv_GetChanState(_DIN_INDEX_BAK2_CHAN);
|
|
|
- //位移量采集
|
|
|
- DistenceBufferV[0] = ATDDrv_GetChanResult(_ATD_INDEX_BAK3_CHAN);
|
|
|
- DistenceBufferR[0] = (uint16)((DistenceBufferV[0] / (5.0 * 4095 - DistenceBufferV[0])) * 1000.0);
|
|
|
- Distence1 = (uint16)((2132 - DistenceBufferR[0]) * (0.1219));
|
|
|
- //压力采集
|
|
|
- PressureValueBuffer = ATDDrv_GetChanResult(_ATD_INDEX_ACCPED1_CHAN);
|
|
|
- PressureValue = (uint32)(PressureValueBuffer * 1000 / 4095.0);
|
|
|
- //控制输出
|
|
|
- VehCo_ctEEPTestUI += 10;
|
|
|
- VehCo_ctEEPTestUB += 10;
|
|
|
- if (VehCo_ctEEPTestUI >= 4 * 1000)
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_PSWT_INDEX_HBAK1_CHAN, 1); //输出 解锁持续9-4s
|
|
|
- ControlState = 1; //解锁
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_PSWT_INDEX_HBAK1_CHAN, 0); //不输出
|
|
|
- ControlState = 2; //锁定 4 秒
|
|
|
- }
|
|
|
- if (VehCo_ctEEPTestUI >= 9 * 1000)
|
|
|
- {
|
|
|
- Control_Times++;
|
|
|
- VehCo_ctEEPTestUI = 0;
|
|
|
- }
|
|
|
- if (ManuEnable == 0)
|
|
|
- {
|
|
|
- Control_Times = 0;
|
|
|
- VehCo_ctEEPTestUI = 0;
|
|
|
- }
|
|
|
-}
|
|
|
-#endif
|
|
|
-#ifdef _APP_TEST_MOTOR_CODE
|
|
|
-void MotorTestFun(void)
|
|
|
-{
|
|
|
- static uint32 MotorRunTimer = 0;
|
|
|
- static uint16 MotorLockReadyTimer = 0;
|
|
|
- static sint8 LockMotorNum = -1;
|
|
|
- static sint8 unLockMotorNum = -1;
|
|
|
- static uint32 testTimer = 0;
|
|
|
- GetDIOState();
|
|
|
- GetAIOValue();
|
|
|
- testTimer = testTimer + 10;
|
|
|
- MotorControlLockNum = LockMotorNum;
|
|
|
- MotorControlunLockNum = unLockMotorNum;
|
|
|
- if (MotorControlCmd == 0) //可进入调试模式
|
|
|
- {
|
|
|
- if (MotorDebugCmd == 1)
|
|
|
- {
|
|
|
- if (getbit(MotorControlEnable, 0) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(0, 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 1) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(1, 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 2) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(2, 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 3) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(3, 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (MotorDebugCmd == 2)
|
|
|
- {
|
|
|
- if (getbit(MotorControlEnable, 0) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(0, 2);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 1) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(1, 2);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 2) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(2, 2);
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (getbit(MotorControlEnable, 3) == 1)
|
|
|
- {
|
|
|
- MotorControlFunc(3, 2);
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (MotorLifeTestCmd == 1)
|
|
|
- {
|
|
|
- if (LockMotorNum < 4 && testTimer > 5000)
|
|
|
- {
|
|
|
- MotorControlCmd = 1;
|
|
|
- }
|
|
|
- else if (unLockMotorNum < 5 && LockMotorNum == 4 && testTimer > 5000)
|
|
|
- {
|
|
|
- MotorControlCmd = 2;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MotorControlFunc(0, 0xF1);
|
|
|
- LockMotorNum = -1;
|
|
|
- unLockMotorNum = -1;
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if (MotorControlCmd == 1) //控制锁紧的自动流程
|
|
|
- {
|
|
|
- switch (LockMotorNum)
|
|
|
- {
|
|
|
- case -1:
|
|
|
- {
|
|
|
- MotorControlFunc(0, 0xF1);
|
|
|
- LockMotorNum = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= LockDelay) || getbit(MotorControlEnable, LockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(LockMotorNum, 0xF1);
|
|
|
- LockMotorNum = 1;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_lockSensor, LockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(LockMotorNum, 1);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= LockDelay) || getbit(MotorControlEnable, LockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(LockMotorNum, 0xF1);
|
|
|
- LockMotorNum = 2;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_lockSensor, LockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(LockMotorNum, 1);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= LockDelay) || getbit(MotorControlEnable, LockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(LockMotorNum, 0xF1);
|
|
|
- LockMotorNum = 3;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_lockSensor, LockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(LockMotorNum, 1);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 3:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= LockDelay) || getbit(MotorControlEnable, LockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(LockMotorNum, 0xF1);
|
|
|
- LockMotorNum = 4;
|
|
|
- unLockMotorNum = -1;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- testTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_lockSensor, LockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(LockMotorNum, 1);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (MotorControlCmd == 2) //控制解锁的自动流程
|
|
|
- {
|
|
|
- switch (unLockMotorNum)
|
|
|
- {
|
|
|
- case -1:
|
|
|
- {
|
|
|
- MotorControlFunc(0, 0xF2);
|
|
|
- unLockMotorNum = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= 1) || getbit(MotorControlEnable, unLockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(unLockMotorNum, 0xF2);
|
|
|
- unLockMotorNum = 1;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_unlockSensor, unLockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(unLockMotorNum, 2);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= 1) || getbit(MotorControlEnable, unLockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(unLockMotorNum, 0xF2);
|
|
|
- unLockMotorNum = 2;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_unlockSensor, unLockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(unLockMotorNum, 2);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= 1) || getbit(MotorControlEnable, unLockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(unLockMotorNum, 0xF2);
|
|
|
- unLockMotorNum = 3;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_unlockSensor, unLockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(unLockMotorNum, 2);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 3:
|
|
|
- {
|
|
|
- if ((MotorRunTimer >= RunFailedDelay) || (MotorLockReadyTimer >= 1) || getbit(MotorControlEnable, unLockMotorNum) != 1)
|
|
|
- {
|
|
|
- MotorControlFunc(unLockMotorNum, 0xF2);
|
|
|
- unLockMotorNum = 4;
|
|
|
- MotorRunTimer = 0;
|
|
|
- MotorLockReadyTimer = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (getbit(ebcd_st_unlockSensor, unLockMotorNum) == 1)
|
|
|
- {
|
|
|
- MotorLockReadyTimer = MotorLockReadyTimer + 10;
|
|
|
- }
|
|
|
- MotorControlFunc(unLockMotorNum, 2);
|
|
|
- MotorRunTimer = MotorRunTimer + 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 4:
|
|
|
- {
|
|
|
- MotorControlFunc(0, 0xF1);
|
|
|
- unLockMotorNum = 5;
|
|
|
- LockMotorNum = -1;
|
|
|
- if (MotorLifeTestCmd == 1)
|
|
|
- {
|
|
|
- LifeTestCounter++;
|
|
|
- testTimer = 0;
|
|
|
- EEPROMDrv_bSaveInstantUB = 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-void MotorControlFunc(UINT8 MotorIdx, UINT8 RotateDirec) // MotorIdx 0-3 表示四个电机,RotateDirec F1停止正转,F2表示反转停止,1表示正转,2表示反转
|
|
|
-{
|
|
|
- switch (MotorIdx)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- {
|
|
|
- switch (RotateDirec)
|
|
|
- {
|
|
|
- case 0xF1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0xF2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- switch (RotateDirec)
|
|
|
- {
|
|
|
- case 0xF1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0xF2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- switch (RotateDirec)
|
|
|
- {
|
|
|
- case 0xF1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0xF2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case 3:
|
|
|
- {
|
|
|
- switch (RotateDirec)
|
|
|
- {
|
|
|
- case 0xF1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 0);
|
|
|
- PSwtDrv_Interface(_M2_C, 0);
|
|
|
- PSwtDrv_Interface(_M3_C, 0);
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0xF2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M1_C, 1);
|
|
|
- PSwtDrv_Interface(_M2_C, 1);
|
|
|
- PSwtDrv_Interface(_M3_C, 1);
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 0:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 1:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- PSwtDrv_Interface(_M_D_C, 0);
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- case 2:
|
|
|
- {
|
|
|
- PSwtDrv_Interface(_M4_C, 1);
|
|
|
- PSwtDrv_Interface(_M_D_C, 1);
|
|
|
- PSwtDrv_Interface(_M4_C, 0);
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-}
|
|
|
-#endif
|