VOID PowerOnInNormalMode ( VOID ) { DBG (INFO_MESSAGE, "PowerOnInNormalMode"); InitSerial (&USARTD0, b9600, Ridiculous); BTHC05_KEY_PORT.OUTCLR = BTHC05_KEY_PIN; _delay_ms(10); EnablePower (); }
//--------------------------------------- // Main program //--------------------------------------- void main(void) { InitSerial(); // Initialize serial port putchar(0x0C); // clear hyper terminal DelayMs(5); WriteBYTE(0x0000); WriteI2C('A'); //Write Data's Here WriteI2C('B'); WriteI2C('C'); WriteI2C('D'); WriteI2C('E'); WriteI2C('F'); Stop(); DelayMs(10); ReadBYTE(0x0000); EData[0] = ReadI2C(NO_ACK); EData[1] = ReadI2C(NO_ACK); EData[2] = ReadI2C(NO_ACK); EData[3] = ReadI2C(NO_ACK); EData[4] = ReadI2C(NO_ACK); EData[5] = ReadI2C(NO_ACK); for(i=0;i<6;i++) { printf("value = %c\n",EData[i]); // display data */ DelayMs(100); } while(1); }
int main() { pFunction Jump_To_Application; uint32_t JumpAddress; SystemInit(); /* 配置系统时钟为72M */ NVIC_Configuration(); watchdog_init(); delay_init(72); //72M w25x64_init(); InitSerial(); Signel_led_init(); TIM_init(); SerialPutString("BootLoader Runing...\n"); SerialPutString("BootLoader for "); SerialPutString(SYSTEM_NAME); SerialPutString("\n"); ymodem(); iap(); SerialPutString("Load App!\n"); TIM_Cmd(TIM2,DISABLE); if (((*(__IO uint32_t*)APP_LOCATION) & 0x2FFE0000 ) == 0x20000000) { JumpAddress = *(__IO uint32_t*) (APP_LOCATION + 4); Jump_To_Application = (pFunction) JumpAddress; __set_MSP(*(__IO uint32_t*) APP_LOCATION); Jump_To_Application(); } return 0; }
int main() // Main function { All_LED( 0 ); InitSerial(); Sensors_Start( PIN_SDI, PIN_SDO, PIN_SCL, PIN_CS_AG, PIN_CS_M, PIN_CS_ALT, PIN_LED, (int)&LEDValue[0], LED_COUNT ); loopTimer = CNT; int filter = 256; while(1) { //Read ALL inputs from the sensors into local memory, starting at Temperature memcpy( &sens, Sensors_Address(), Sensors_ParamsSize ); S4_Put( 0, '$' ); // Send a $ as a signature (like a packet start) LogInt( sens.GyroY ); // Sends an integer, followed by a space LogInt( sens.AccelX ); // Sends an integer, followed by a space LogInt( sens.AccelZ ); // Sends an integer, followed by a space S4_Put( 0, 13 ); // Send a carriage return ++counter; loopTimer += 80000000 / 100; waitcnt( loopTimer ); } }
/*! \fn Create::Create(int sock, struct sockaddr_in & createPort, unsigned long connectedHost) * \brief A constructor for Create class. The serial communication is initialized here. */ Create::Create() { _fd = -1; isEnding = false; pthread_mutex_init(&_serialMutex, NULL); _bufLength = 0; InitSerial(); }
void main() { Init_iMCU(); // Initialize iMCUW7100A InitSerial(); // Initialize serial Init_Network(); // Initialize Network Configuration printf("LOOPBACK_UDP_START\n"); while (1){ loopback_udp(0, port, data_buf, 0); } }
void init (struct multiboot_info *mb_info, uint32_t kernel_esp) { // Clear screen cls(); // HAL-Services kprintln ("Booting up..."); detect_cpu(); InitSerial (115200, 0, 8); InitGlobalDescriptors (kernel_esp); InitInterruptDescriptors(); InitPit (CLOCKS_PER_SEC); InitPmm (mb_info); InitVmm (mb_info); kinit_heap(); #ifdef SELF_TEST if (selfTest() != 0) { kprintln ("Will not start up because of self test errors!"); while (1); } #endif // Erstes Modul ist unsere RAM-Disk InitRamdisk ( ( (struct multiboot_module *) mb_info->mbs_mods_addr)->mod_start); InitMultitasking(); // while(1); // kprintf((char*) ((struct multiboot_module*) // mb_info->mbs_mods_addr)->mod_start); InitBootDrivers(); //int32_test(); __asm ("sti"); for (;;); }
TBMC711::TBMC711( DWORD macID, DWORD com ) { // 记录当前machine ID if( macID>16 ) throw 0; _macID = macID; // 第一个对象则初始化串口 if( ++_obCount==1 ) { bool rt = InitSerial( com ); assert( rt==true ); } // 运行macID对应的箱子 if( IsRunning()==false ) Run(); }
int main() { inbound_queue = QueueCreate(sizeof(char), 20) ; ClearScreen(0x07) ; SetCursorVisible(TRUE) ; InitSerial() ; InitOutBound() ; InitInBound() ; for (;;) { OutBound() ; InBound() ; } return 0 ; }
void main(void) { OSInit(); InitSerial(); TMOD = (TMOD & 0XF0) | 0X01; TL0 = 0x0; TH0 = 0x0; TR0 = 1; ET0 = 1; TF0 = 0; OSTaskCreate(Recuve, NULL, 0); OSTaskCreate(TaskB, NULL, 1); OSTaskCreate(TaskD, NULL, 2); while(1) { PCON = PCON | 0x01; /* CPU进入休眠状态 */ } }
static short StartQL(void) { short e; e=QL_memory(); if(e==0) { e=LoadRoms(); if(e==0) { InitSerial(); RestartQL(); e=AllocateDisk(); if(e==0) e=AllocateSound(); if(e==0) { qlRunning=true; StartTimer(); } else DisposePtr((Ptr)theROM); } else DisposePtr((Ptr)theROM); } return e; }
//--------------------------------------- // Main program //--------------------------------------- void main(void) { InitSerial(); // Initialize serial port //printf("%s",&Int2Day(1)); //----------------------------------- // Setup time and enable oscillator //----------------------------------- ReadRTC(&RTC_ARR[0]); RTC_ARR[0] = RTC_ARR[0] & 0x7F; // enable oscillator (bit 7=0) RTC_ARR[1] = 0x59; // minute = 59 RTC_ARR[2] = 0x23; // hour = 05 ,24-hour mode(bit 6=0) RTC_ARR[3] = 0x04; // Day = 1 or sunday RTC_ARR[4] = 0x31; // Date = 30 RTC_ARR[5] = 0x10; // month = August RTC_ARR[6] = 0x05; // year = 05 or 2005 WriteRTC(&RTC_ARR[0]); // Set RTC //----------------------------------- while(1) { ReadRTC(&RTC_ARR[0]); putchar(0x0C); // clear Hyper terminal printf("Day : %s\r\n",Int2Day(RTC_ARR[3])); printf("Time : %02bX:%02bX:%02bX\r\n",RTC_ARR[2],RTC_ARR[1],RTC_ARR[0]); printf("Data : %02bX-%s-20%02bX",RTC_ARR[4],Int2Month(RTC_ARR[5]),RTC_ARR[6]); // DelayMs(1000); // delay about 1 second } }
int main() { int u; u = InitSerial(); if( u == -1 ) { fprintf(stderr,"InitSerial Error!\n"); return -1; } char *buffer = (char*)malloc(8*sizeof(char)); *buffer = 0xff; *(buffer+1) = 0xff; *(buffer+2) = 0xfe;//broadcast *(buffer+3) = 0x04; *(buffer+4) = 0x03;//write data *(buffer+5) = 0x04; *(buffer+6) = 0x01; int sum; sum = 0xfe; sum += 0x04; sum += 0x03; sum += 0x04+1; sum = sum&0xff; sum = ~sum; char *chsum = (char*)malloc(sizeof(char)); memcpy(chsum,&sum,sizeof(char)); *(buffer+7) = *chsum;//checksum char todisplay[50]; char * p_display=todisplay; memset(p_display,0,50*sizeof(char)); ByteToHexStr(buffer,p_display,8*sizeof(char)); printf("Sending:\n %s \n",p_display); UART_Send(u,buffer,8*sizeof(char)); free(buffer); close(u); }
//***************************************************************************** // This example demonstrates MIDI functionality and control methods //***************************************************************************** int main(void){ // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Enable the peripherals used by this VS1053. SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); // VS1053 Serial SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // VS1053 Serial SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); // VS1053 Reset + EMG Input SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); // EMG Input 1 // Enable PC Console InitSerial(); // Enable processor interrupts. IntMasterEnable(); // Set GPIO B0 and B1 as UART pins for VS1053 Control GPIOPinConfigure(GPIO_PB0_U1RX); GPIOPinConfigure(GPIO_PB1_U1TX); GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); // Set GPIO E4 as Hardware Reset pin and E5 as ADC Input GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_4); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_5); // Configure the UART1 as according to VS1053 Datasheet with baudrate of 31250 UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 31250, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // Setup ADC Sampling Sequences 3, configure step 0. // Note: Sequence 1 and 2 has 4 step, which would be great for 3-channel sampling ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH8 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 3); ADCIntClear(ADC0_BASE, 3); // Example Started UARTprintf("VS1053 Test\n"); // Reset the VS1053 VS1053_Reset(); // Setup the MIDI Channel 0 midiSetChannelBank(0, VS1053_BANK_MELODY); midiSetInstrument(0, VS1053_GM1_OCARINA); midiSetChannelVolume(0, 127); midiNoteOn(0, 70, 127); Delay(1000); // Setup the MIDI Channel 1 midiSetChannelBank(1, VS1053_BANK_MELODY); midiSetInstrument(1, VS1053_GM1_OCARINA); midiSetChannelVolume(1, 0); midiNoteOn(1, 60, 127); // Setup variables for ADC uint32_t ADC_Output[1]; uint8_t volume; // Infinite Loop of execution while(1) { // ADC Sampling Procedures ADCProcessorTrigger(ADC0_BASE, 3); while(!ADCIntStatus(ADC0_BASE, 3, false)) {} ADCIntClear(ADC0_BASE, 3); ADCSequenceDataGet(ADC0_BASE, 3, ADC_Output); UARTprintf("AIN8 = %4d\n", ADC_Output[0]); // Play Sound as according to voltage level volume = inputMapping(ADC_Output[0], 3000, 4000, 50, 127); midiSetChannelVolume(0, volume); UARTprintf("Volume Level = %4d\n", volume); // Delay Delay(100); } }
void ModemGSM_Init( void ){ char cBuffer[32]; BYTE i; INT iCounter; // inicializa a conexão serial com o Modem InitSerial( 0, MODEM_BAUD, ST_1, PR_NONE, ModemGSM_ProcessaMensagens ); //cdantas - alterei a função de UART para utilizar o HardWare //memset( (char*)ModemGSM_Varzea, 0, sizeof( ModemGSM_Varzea )); //for ( i = 0; i < sizeof( ModemGSM_Varzea ); i++ ){ // ModemGSM_Varzea[i] = (i % 2)? 0x55 : 0xAA; //} //for ( i = 0; i < sizeof( ModemGSM_Varzea2 ); i++ ){ // ModemGSM_Varzea2[i] = (i % 2)? 0x55 : 0xAA; //} for( ModemGSM_DataCounter = 0; ModemGSM_DataCounter < /*sizeof ( ModemGSM_Buffer )*/BUFFER_GSM_LEN; ModemGSM_DataCounter++ ){ ModemGSM_Buffer[ModemGSM_DataCounter] = (ModemGSM_DataCounter % 2) ? 0xAA: 0x55; } // inicializa os pinos de conexão com os SIMs cards ModemGSM_InitGPIO(); ModemGSM_ResetStateSIMCARD(); ModemGSM_Change_State_SIM_PRESENCE( 0 ); ModemGSM_Ready = FALSE; ModemGSM_DataCounter = 0; ModemGSM_TimerHandle = GetTimer( MODEMGSM_TIMEROVF ); if ( !ModemGSM_IsOn() ){ #ifdef _BAUDRATE_AUTOBAUD if ( ModemGSM_On() == TRUE ){ // wait a delay before send a first command to modem. delay( TIMEOUT_START_MODEM ); // Send a .AT. string to modem to detect the baudrate strcpypgm2ram( (char*)cBuffer, (const MEM_MODEL rom char*)".AT." ); ModemGSM_SendATCMD( (BYTE*)cBuffer, strlen( cBuffer ) ); delay( TIMEOUT_START_MODEM ); strcpypgm2ram( (char*)cBuffer, (const MEM_MODEL rom char*)"AT+IPR=?\r\n" ); ModemGSM_SendATCMD( (BYTE*)cBuffer, strlen( cBuffer ) ); } #else ModemGSM_On(); #endif } else{ ModemGSM_Ready = TRUE; } if ( ModemGSM_Ready == TRUE ){ //Dev_ChangeState( DEV_GSM_PWR_KEY, ON ); SetStatus( ST_MODEM_RDY ); for ( i = 0 ; i < GET_VEC_NUM_MEMBERS(dev); i++ ){ if ( dev[i].ID == DEV_GSM_PWR_KEY ){ dev[i].bState = ON; dev[i].bNextState = ON; } } } timerCheckONOFF = GetTimer( TIMEOUT_START_MODEM ); return; }
int main(int argc, char *argv[]) { long iter, repeat = 0; double interval_sec = (double)1/20; struct timespec start, end; int opt; /* * get command line options */ while ((opt = getopt(argc, argv, "i:h")) != -1) { switch (opt) { case 'i': /* iterations */ repeat = strtol(optarg, NULL, 0); PDEBUG("repeat=%ld\n", repeat); break; case 'h': usage(argc, argv); break; } } /* Initialize model */ EKF_IFS_2_initialize(); /* Initialize hardware */ InitIMU(); /* vectornav */ InitSerial(); /* arduino */ clock_gettime(CLOCK_REALTIME, &start); iter = 0; while (1) { double remain_us; uint64_t tmpdiff; /* Get sensor data */ GetIMUData(&EKF_IFS_2_U); /* Get Arduino Data */ GetSerialData(&EKF_IFS_2_U); /* Get moving points Data */ InitMovingWaypoints(&EKF_IFS_2_U); /* Get waypoints Data */ InitStaticWaypoints(&EKF_IFS_2_U); /* Get Servo deflection Data */ InitOther(&EKF_IFS_2_U); /* Step the model */ EKF_IFS_2_step(); /* Output to the motor controller */ SendSerialData(&EKF_IFS_2_Y); /* Time book keeping */ clock_gettime(CLOCK_REALTIME, &end); tmpdiff = get_elapsed(&start, &end); remain_us = (interval_sec * 1000000 - tmpdiff / 1000); if (remain_us > 0) { usleep((useconds_t)remain_us); } clock_gettime(CLOCK_REALTIME, &start); iter++; PDEBUG("iter %ld took %" PRIu64 "us\n", iter, tmpdiff/1000); PDEBUG("Out: throttle=%f elevator=%f aileron=%f rudder=%f\n", EKF_IFS_2_Y.ControlSurfaceCommands.throttle_cmd, EKF_IFS_2_Y.ControlSurfaceCommands.elevator_cmd, EKF_IFS_2_Y.ControlSurfaceCommands.aileron_cmd, EKF_IFS_2_Y.ControlSurfaceCommands.rudder_cmd); if (iter >= repeat) break; } /* Matfile logging */ rt_StopDataLogging(MATFILE, EKF_IFS_2_M->rtwLogInfo); /* Terminate model */ EKF_IFS_2_terminate(); /* Close hardware */ CloseIMU(); CloseSerial(); return 0; }
void InitROM(void) { w32 saved_regs[16]; char qvers[6]; char *initstr="UQLX v%s, release\012 %s\012QDOS Version %s\012"; long sysvars,sxvars; if((long)((Ptr)gPC-(Ptr)theROM)-2 != ROMINIT_CMD_ADDR) { exception=4; extraFlag=true; return; } #if 0 printf("a6=%x, basic at %x\n",aReg[6],ReadLong(0x28010)); #endif save_regs(saved_regs); do_update=1; /* flip in screen RAM */ #ifdef OLD_PATCH /* lea $0C000,a3 */ aReg[3]=0x0c000; gPC+=2; #else #warning UNUSED OLD_PATCH WW((Ptr)gPC-2,0x0c93); /* restore original instruction */ #endif #if 0 KillSound(); CloseSerial(); InitSerial(); ZeroKeyboardBuffer(); #endif /* delete old MDV drivers (for optical reasons) */ WriteLong(0x28048,0); InitFileDrivers(); InitDrivers(); #ifdef XSCREEN /*printf("call init_xscreen\n");*/ init_xscreen(); #else #warning UNUSED XSCREEN #endif SchedInit(); init_bas_exts(); QLtrap(1,0,20000l); #if 0 printf("QDOS vars at %x, trap res=%d, RTOP=%d\n",aReg[0],reg[0],RTOP); #endif sysvars=aReg[0]; sxvars=RL((Ptr)theROM+sysvars+0x7c); #if 0 if (isMinerva) printf("Minerva extended vars at %x\n",sxvars); #endif if (V3) printf("sysvars at %x, ux RAMTOP %d, sys.ramt %d, qlscreen at %d\n", sysvars,RTOP,sysvar_l(20),qlscreen.qm_lo); // QDOS version WL((Ptr)qvers,reg[2]);qvers[4]=0; #if 0 p=(Ptr)theROM+RTOP-0x07FFEl; sprintf(p,initstr,uqlx_version,release,qvers); WriteWord(aReg[1]=RTOP-0x08000l,strlen(p)); #if 1 QLvector(0xd0,200000); #else WriteLong((*sp)-=4,(w32)gPC-(w32)theROM); gPC=(uw16*)((Ptr)theROM+RW((uw16*)((Ptr)theROM+0xd0))); /* write string */ #endif #endif /*HACK: allow breakpoints in ROM*/ #if DEBUG_ROM RamMap[0]=RamMap[1]=RamMap[2]=3; uqlx_protect(0,3*32768,QX_RAM); #endif /* now install TKII defaults */ reg[1]=0x6c; reg[2]=0; QLtrap(1,0x18,200000); if(reg[0]==0){ if (V3)printf("Initialising TK2 device defaults\n"); WriteLong(0x28070+0x3c,aReg[0]); WriteLong(0x28070+0x40,32+aReg[0]); WriteLong(0x28070+0x44,64+aReg[0]); WriteWord(aReg[0],strlen(DATAD));strcpy((char*)((Ptr)theROM+aReg[0]+2),DATAD); WriteWord(aReg[0]+32,strlen(PROGD));strcpy((char*)((Ptr)theROM+aReg[0]+34),PROGD); WriteWord(aReg[0]+64,strlen(SPOOLD));strcpy((char*)((Ptr)theROM+aReg[0]+66),SPOOLD); } /* link in Minerva keyboard handling */ #if 1 if (isMinerva) { reg[1]=8; reg[2]=0; QLtrap(1,0x18,200000); if(reg[0]==0) { WW((Ptr)theROM+MIPC_CMD_ADDR,MIPC_CMD_CODE); WL((Ptr)theROM+aReg[0],RL((Ptr)theROM+sxvars+0x14)); WL((Ptr)theROM+aReg[0]+4,MIPC_CMD_ADDR); WL((Ptr)theROM+sxvars+0x14,aReg[0]); } WW((Ptr)theROM+KBENC_CMD_ADDR,KBENC_CMD_CODE); orig_kbenc=RL((Ptr)theROM+sxvars+0x10); WL((Ptr)theROM+sxvars+0x10,KBENC_CMD_ADDR); #if 0 printf("orig_kbenc=%x\nreplacement kbenc=%x\n",orig_kbenc,KBENC_CMD_ADDR); printf("sx_kbenc addr=%x\n",sxvars+0x10); #endif } #endif init_poll(); /* make sure it wasn't changed somewhere */ restore_regs(saved_regs); #ifdef OLD_PATCH aReg[3]=0x0c000; #endif #ifndef OLD_PATCH table[code=0x0c93](); /* run the original routine */ #endif }
void main( int argc, char** argv) { //struct Position Pos; int Ix; strcpy( ConfigFile, "config.dat"); Parity = NoneParity; DataBits = 8; StopBits = 1; CalledByGuideFlag = No; KeepGoingFlag = No; ReadSlewFlag = No; StartScrollFlag = No; /* if '-k' and '-s' (after full init): slew to Ra, Dec in slew.dat and keep going, exiting when desired, writing slew_out.dat file; if '-k' (before full init): (no slew.dat), keep going until centered on init position, write slew_out.dat file and exit; if '-s': slew to Ra, Dec in slew.dat and exit, writing slew_out.dat file; if no '-k' and no '-s': write slew_out.dat file and exit; if -c, then use following string as configuration file name, ie scope.exe -c config.dat will result in config.dat being used if -x, then use following string as scroll file name, and execute scroll file upon program startup, ie scope.exe -x nan.scr will cause nan.scr to be loaded and started */ /* argv[0] is name of executing program */ for( Ix = 1; Ix < argc; Ix++) if( argv[Ix][0] == '-') if( strcmpi( &argv[Ix][1], "GUIDE") == 0) CalledByGuideFlag = Yes; else if( argv[Ix][1] == 'k') KeepGoingFlag = Yes; else if( argv[Ix][1] == 's') ReadSlewFlag = Yes; else if( (argv[Ix][1] == 'c' || argv[Ix][1] == 'C') && Ix < argc-1) strcpy( ConfigFile, argv[Ix+1]); else if( (argv[Ix][1] == 'x' || argv[Ix][1] == 'X') && Ix < argc-1) { strcpy( ScrollFilename, argv[Ix+1]); StartScrollFlag = Yes; } InitCommonVars(); ReadConfig(); /* Pos.Ra = Pos.Dec = 0; applyCorrectionsFromDataFileCoordYearToEpochNow(&Pos); printf("\n%f %f %f %f %f %f %f %f", Pos.Precession.A*RadToArcsec, Pos.Precession.Z*RadToArcsec, Pos.Nutation.A*RadToArcsec, Pos.Nutation.Z*RadToArcsec, Pos.AnnualAberration.A*RadToArcsec, Pos.AnnualAberration.Z*RadToArcsec, Pos.Ra*RadToArcsec, Pos.Dec*RadToArcsec); ContMsgRoutine(); */ /* HsRecFile = fopen( HsRecFilename, "w"); if( HsRecFile == NULL) BadExit( strcat( "Could not create ", HsRecFilename)); HsRecIx = 0; */ /* InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); InitConvert(); TestConvert(); getch(); TestAltAltAzTrack(); */ if( DisplayOpeningMsgs) { printf( "\nCopyright BBAstroDesigns Inc. 2009\n"); printf( "\nLIMITED WARRANTY This software is provided ``as is'' and any express or"); printf( "\nimplied warranties, including, but not limited to, the implied warranties"); printf( "\nof merchantability and fitness for a particular purpose are disclaimed."); printf( "\nIn no event shall BBAstroDesigns be liable for any direct, indirect,"); printf( "\nincidental, special, exemplary, nor consequential damages (including, but"); printf( "\nnot limited to, procurement of substitute goods or services, loss of use,"); printf( "\ndate, or profits, or business interruption) however caused and on any"); printf( "\ntheory of liability, whether in contract, strict liability, or tort"); printf( "\n(including negligence or otherwise) arising in any way out of the use of"); printf( "\nthis software, even if advised of the possibility of such damage.\n"); printf( "\nThis software licensed under the GNU GENERAL PUBLIC LICENSE. You may"); printf( "\ndistribute this software per the GNU GPL. See the enclosed gpl.txt.\n\n"); ContMsgRoutine(); } if( DisplayOpeningMsgs) printf( "\ncalled by guide: %d, keep_going: %d, read slew.dat file %d", CalledByGuideFlag, KeepGoingFlag, ReadSlewFlag); /* if( strcmpi( TestString, "TestSerial") == 0) { InitSerial( EncoderComPort, EncoderBaudRate, Parity, DataBits, StopBits); TestSerial( EncoderComPort); CloseSerial( EncoderComPort); } */ /* else if( strcmpi( TestString, "TestVideo") == 0) { InitVideo( DisplayOpeningMsgs); TestVideo(); } */ /* else if( strcmpi( TestString, "TestATimes") == 0) { InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); TestTimes(); } */ /* else if( strcmpi( TestString, "TestParallelPort") == 0) { InitPPort(); TestPPort(); ClosePPort(); } */ /* else if( strcmpi( TestString, "TestRefract") == 0) { InitRefract(); TestRefract(); } */ /* else if( strcmpi( TestString, "TestMouse") == 0) { TestMouse(); } */ /* else if( strcmpi( TestString, "TestEncoders") == 0) { InitSerial( EncoderComPort, EncoderBaudRate, Parity, DataBits, StopBits); InitEncoders(); TestEncoders(); CloseSerial( EncoderComPort); } */ /* else if( strcmpi( TestString, "TestHandpad") == 0) { InitPPort(); InitializeHandpad(); TestHandpad(); ClosePPort(); } */ /* else if( strcmpi( TestString, "TestConversion") == 0) { InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); InitConvert(); TestConvert(); } */ /* else if( strcmpi( TestString, "TestAltOffset") == 0) { InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); InitConvert(); TestAltOffset(); } */ /* else if( strcmpi( TestString, "TestIACA") == 0) { InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); TestIACA(); InitIACA(); } */ /* else if( strcmpi( TestString, "WritePWMValues") == 0) { InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); InitVideo( DisplayOpeningMsgs); InitPPort(); InitMotors(); WritePWMValues(); CloseSteppers(); ClosePPort(); } else */ { if( strcmpi( TestString, "NoTest") != 0 && strcmpi( TestString, "PreloadGuidexx.dat") != 0 && strcmpi( TestString, "Track") != 0) { if( DisplayOpeningMsgs) printf( "\nsetting unrecognized TestString to 'NoTest'"); strcpy( TestString, "NoTest"); } InitSerial( EncoderComPort, EncoderBaudRate, Parity, DataBits, StopBits); InitEncoders(); InitMouseControl(); InitTimes( DisplayOpeningMsgs, Tz, DST, LongitudeDeg); InitVideo( DisplayOpeningMsgs); InitPPort(); InitializeHandpad(); InitMotors(); InitConvert(); InitRefract(); InitPEC(); InitGuide(); if( strcmpi( TestString, "PreloadGuidexx.dat") == 0) { LoadGuideAlts(); LoadGuideAzs(); } InitIACA(); InitLX200Input(); InitHPEvent(); if( !CalledByGuideFlag || (CalledByGuideFlag && (KeepGoingFlag || ReadSlewFlag))) { InitKBEvent(); if( ReadSlewFlag) InputEquatSlewDat(); if( StartScrollFlag) LoadScrollFileFromFile(); if( strcmpi( TestString, "Track") == 0) Start2MotorTrackWithDefaultValues(); while( !QuitFlag) { SequentialTaskController(); /* GrandTourFlag used to flag next object: set in ProcessHPEventsModeSwitch() */ if( GrandTourLoaded && GrandTourFlag) ProcessGrandTour(); else if( ScrollLoaded && ScrollFlag) ProcessScroll(); else if( HPPolarAlignLoaded && HPPolarAlignFlag) ProcessHPPolarAlign(); else { if( UseMouseFlag && ProcessMouseEvent()) ; else if( KeyStroke) ProcessKBEvents(); else ProcessHPEvents(); } } CloseKBEvent(); if( DisplayOpeningMsgs) { AskAndWriteConfig(); WriteLogFile(); } } CloseSteppers(); ClosePPort(); CloseEncoderResetLogFile(); CloseSerial( EncoderComPort); CloseSerial( LX200ComPort); if( CalledByGuideFlag) WriteAltazSlewOutFile(); CloseMouseControl(); } /* for( Ix = 0; Ix < HsRecSize; Ix++) fprintf( HsRecFile, "%8ld %8ld\n", HsRec[Ix].A, HsRec[Ix].Z); // first position is index 0 fprintf( HsRecFile, " last entry in circular queue at position %d", HsRecIx); fclose( HsRecFile); */ }