void DebugMain_Initialise(void) { #ifdef DEBUG_MODE #ifdef FDC_DEBUG FDC_Debug = Debug_Start("fdc-dbg.txt"); Debug_Enable(FDC_Debug,FALSE); #endif #ifdef CRTC_DEBUG CRTC_Debug = Debug_Start("crtc-dbg.txt"); Debug_Enable(CRTC_Debug,FALSE); #endif #ifdef ASIC_DEBUGGING ASIC_Debug = Debug_Start("asic-dbg.txt"); Debug_Enable(ASIC_Debug,FALSE); #endif #ifdef AUDIOEVENT_DEBUG AudioEvent_Debug = Debug_Start("audio-dbg.txt"); Debug_Enable(AudioEvent_Debug,FALSE); #endif #endif }
void DebugMain_Initialise(void) { #ifdef DEBUG_MODE #ifdef FDC_DEBUG FDC_Debug = Debug_Start("fdc-dbg.txt"); Debug_Enable(FDC_Debug,FALSE); #endif #ifdef CRTC_DEBUG CRTC_Debug = Debug_Start("crtc-dbg.txt"); Debug_Enable(CRTC_Debug,FALSE); #endif #ifdef ASIC_DEBUGGING ASIC_Debug = Debug_Start("asic-dbg.txt"); Debug_Enable(ASIC_Debug,FALSE); #endif #ifdef AUDIOEVENT_DEBUG AudioEvent_Debug = Debug_Start("audio-dbg.txt"); Debug_Enable(AudioEvent_Debug,FALSE); #endif #ifdef TZX_DEBUG TZX_Debug = Debug_Start("tzx-dbg.txt"); Debug_Enable(TZX_Debug,FALSE); #endif #ifdef KEY_DEBUG Debug_Keyboard = Debug_Start("key-dbg.txt"); Debug_Enable(Debug_Keyboard, TRUE); #endif #endif }
int main() { PS2Controller psData; char str[20]; uint8 state = 0; CYBIT circle_flag=0,cross_flag=0,previous_circle=0,previous_cross=0; CyGlobalIntEnable; /* Enable global interrupts. */ PS2_Start(); Debug_Start(); initLin(); flag_StartEx(flag_isr); while(1){ psData = PS2_Controller_get(); /*Machine Initialization*/ Automatic_State(0); /*-----Automatic Control------*/ if((psData.SELECT == 1) && (psData.TRIANGLE == 1)){ sprintf(str,"automatic mode\n"); Debug_PutString(str); while(1){ psData = PS2_Controller_get(); //mode reset if((psData.SELECT == 1) &&(psData.START == 1)){ state = 0; sprintf(str,"mode reset\n"); Debug_PutString(str); break; } //State Increment if(psData.CIRCLE != previous_circle){ previous_circle = psData.CIRCLE; if(psData.CIRCLE == 1){ state = state + 1; } } //State Decrement if(psData.CROSS != previous_cross){ previous_cross = psData.CROSS; if(psData.CROSS == 1){ if(state >= 1){ state = state - 1; } } } if(flag == 1){ Automatic_State(state); flag = 0; } } } /*-----Manual Control------*/ if((psData.SELECT == 1) && (psData.CROSS == 1)){ sprintf(str,"manual mode\n"); Debug_PutString(str); while(1){ psData = PS2_Controller_get(); //mode reset if((psData.SELECT == 1) &&(psData.START == 1)){ sprintf(str,"mode reset\n"); Debug_PutString(str); break; } /*Arm*/ Arm_Motion(psData.L1); /*Base*/ Base_Motion(psData.UP,psData.RIGHT,psData.DOWN); /*Air*/ Pantograph_Motion(psData.TRIANGLE); PantographHand_Motion(psData.CIRCLE); MainHand_Motion(psData.SQUARE); SidesHands_Motion(psData.CROSS); } } } }