static void bootstrap() { const int moduleClock = 12000000; const int KHzInHz = 1000; const int baud = 115200; mcgInit(); sdramInit(); svcInit_SetSVCPriority(15); setSysTickPriority(14); setPendSVPriority(14); uartInit(UART2_BASE_PTR, moduleClock/KHzInHz, baud); lcdcInit(); lcdcConsoleInit(&console); adc_init(); vfs_init(); ledInitAll(); pushbuttonInitAll(); TSI_Init(); TSI_Calibrate(); init_memory(); //uinit(); intSerialIOInit(); flexTimerInit(); sysTickInit(); }
/*Start of Main Functions*/ int main(void) { led_ctrl led1,led2; uint8_t SSLSockNo = 0; wiz_ssl_context sslContext; int ret; /*Usart initialization for Debug.*/ USART1Initialze(); printf("USART initialized.\n\r"); uint32_t i,j; /*LED initialization.*/ led_initialize(); led1 = led2 = ON; led2Ctrl(led2); led1Ctrl(led1); /*W5500 initialization.*/ W5500HardwareInitilize(); printf("W5500 hardware interface initialized.\n\r"); W5500Initialze(); printf("W5500 IC initialized.\n\r"); /*Set network informations*/ wizchip_setnetinfo(&gWIZNETINFO); print_network_information(); sysTickInit(); WIZnetRegFuncTicker(getSysTick); wiz_mbedtls_ssl_init(&sslContext,&SSLSockNo); wiz_mbedtls_ssl_socket(SSLSockNo,Sn_MR_TCP,3000,0x00); wiz_mbedtls_ssl_connect(SSLSockNo,testIP,443,1000); ret = wiz_mbedtls_ssl_handshake(&sslContext); if(ret == 0) { while(1) { memset(tempBuffer,0,BUFFER_SIZE); ret = wiz_mbedtls_ssl_read(sslContext.ssl,tempBuffer,BUFFER_SIZE); if(ret > 0) { printf("Received data: %s\r\n",tempBuffer); wiz_mbedtls_ssl_write(sslContext.ssl,tempBuffer,ret); } } } printf("ERROR: %d\r\n",ret); }
void cpuInit() { cpuPllInit(); sysTickInit(); }
int main(void) { /* Initialization Functions */ //Section to initialize switches and displays //Initialize display //used for system clock //Initialize Buttons LEDBARInit(); DIPSWInit(); PBSwInit(); RGB_LEDInit(); sysTickInit(); // potentiometersInit(); RIT128x96x4Init(1000000); RGB_LEDInit(); potentiometersInit(); RIT128x96x4Clear(); while(!progress) { //start on any button press progress = progress || read_PBSwitchNum(1) || read_PBSwitchNum(2) || read_PBSwitchNum(3); RIT128x96x4StringDraw("Tron", 100, 64, 15); //char is 6 wide by 8 tall, Tron = 24w, 8h //res 240 by 96 } progress = 0; //Display instructions while(!progress) { //40 chars will fill the screen progress = progress || read_PBSwitchNum(1) || read_PBSwitchNum(2) || read_PBSwitchNum(3); RIT128x96x4StringDraw("Navigate your", 0, 0, 15); RIT128x96x4StringDraw("lightcycle and avoid", 0, 8, 15); RIT128x96x4StringDraw("touching the paths", 0, 16, 15); RIT128x96x4StringDraw("First player to be", 0, 24, 15); RIT128x96x4StringDraw("trapped by a trail", 0, 32, 15); RIT128x96x4StringDraw("will be derezzed-lose", 0, 40, 15); } progress = 0; //Reset variables to initial state cpuX = 0; cpuY = 48; playerX = 239; playerY = 48; cpuDir = 2; playerDir = 0; while(!progress){ sysTickWait1mS(100); //read buttons to update player direction //rotate counter-clockwise playerDir = (playerDir - read_PBSwitchNum(1))%4; //rotate clockwise playerDir = (playerDir + read_PBSwitchNum(3))%4; //generate random direction for CPU //x = random(); //} //Update Coordinates in array and variables //Check for collisions //No collisions: display the array to the screen //Collision: Determine who collided and display win/lose screen //Go back to instruction screen } }
//***************************************************************************** // MAIN FUNCTION //***************************************************************************** void main() { #if defined(ewarm) IntVTableBaseSet((unsigned long)&__vector_table); #endif // // Board Initialization // MCUInit(); // // Enable the SYSTICK interrupt // IntEnable(FAULT_SYSTICK); sysTickInit(); // // Start the SimpleLink Host // VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); // // WlanStationMode(NULL); // UART_PRINT("hellow i am in\n\r"); // Start the WlanStationMode task // if(OSI_OK !=osi_TaskCreate( WlanStationMode, (const signed char*)"WlanStationMode task", 2048, NULL, 3, NULL )) UART_PRINT("WlanStationMode failed\n\r"); if(OSI_OK != osi_TaskCreate( taskServer, (const signed char*)"taskServer", 2048, NULL, 2, (OsiTaskHandle)&ServerTaskHandle ) ) UART_PRINT("taskServer failed\n\r"); if(OSI_OK != osi_TaskCreate( taskClient, (const signed char*)"taskClient", 2048, NULL, 1, (OsiTaskHandle)&clientTaskHandle )) UART_PRINT("taskClient failed\n\r"); /* if(OSI_OK != osi_TaskCreate( taskTest1, (const signed char*)"taskTest1", 2048, NULL, 1, NULL )) UART_PRINT("taskTest1 failed\n\r"); if(OSI_OK != osi_TaskCreate( taskTest2, (const signed char*)"taskTest2", 2048, NULL, 1, NULL )) UART_PRINT("taskTest1 failed\n\r"); */ // // Start the task scheduler // //osi_start(); vTaskStartScheduler(); }