void UserMain( void * pd ) { bool beeping = true; init(); J2[36].function(PINJ2_36_T0OUT); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); while(1) { getchar(); Beep(5, 1); } }
void UserMain( void * pd ) { initWithWeb(); EnableSmartTraps(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); iprintf("FlashCompare: %s\n", FlashCompare( SPI_Config_Base, (const uint8_t *)&gConfigRec, GCSTORE_SIZE) == 0 ? "Success" : "Failure"); iprintf("FlashCompare: %s\n", FlashCompare( SPI_Config_Base, ((const uint8_t *)&gConfigRec)+1, GCSTORE_SIZE) == 0 ? "Success" : "Failure"); while(1) { OSTimeDly(TICKS_PER_SECOND); } }
void UserMain( void * pd ) { initWithWeb(); Nunchuck_Init(); // FIXME LLInit(1); TheWSHandler = MyDoWSUpgrade; stepper.Init(); ConfigureStepper( &stepper, 1 ); stepSpeed = 100; stepDir = 1; StartStepper( 1, stepDir, stepSpeed ); stepForever = true; OSSemInit( &SockReadySem, 0 ); OSCritInit( &I2CLock ); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); OSTimeDly(2); OSSimpleTaskCreate(ReportTask, 5); OSSimpleTaskCreate(InputTask, MAIN_PRIO-1); OSSimpleTaskCreate(RangingTask, 2); EnableEncoder(EncodeStep, ButtonChange, ButtonDoubleClick ); ClearTaskTimes(); SMPoolPtr pp; while(1) { fd_set error_fds; FD_ZERO( &error_fds ); OSCritEnter( &I2CLock, 0 ); nun.Update(); OSCritLeave( &I2CLock ); serv_x.SetPos(nun.stick.x); serv_y.SetPos(nun.stick.y); // iprintf("%lu\na_x: %4.4d - a_y: %4.4d - a_z: %4.4d\ns_x: %3.3d - s_y: %3.3d - b_z: %d - b_c: %d\n\n", // TimeTick, nun.accel.x, nun.accel.y, nun.accel.z, // nun.stick.x, nun.stick.y, // nun.button.z, nun.button.c); // iprintf("range: %u\n", lidarRange); if (ws_fd > 0){ SendConfigReport(ws_fd); } } }
void UserMain( void * pd ) { Config(); initWithWeb(); EnableSmartTraps(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); getchar(); EnableTrace(CS_NUM); while(1) { // for (uint16_t i = 0; i < 512; i++) { // trace = i; // } iprintf("SR: 0x%04X\n", GetSR_IntLevel()); OSTimeDly(TICKS_PER_SECOND); } }
/*------------------------------------------------------------------- User Main ------------------------------------------------------------------*/ extern "C" void UserMain(void * pd) { init(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); // Create TCP Server task OSTaskCreate( TcpServerTask, (void *)TCP_LISTEN_PORT, &TcpServerTaskStack[USER_TASK_STK_SIZE] , TcpServerTaskStack, MAIN_PRIO - 1); // higher priority than UserMain while (1) { OSTimeDly( TICKS_PER_SECOND * 5 ); } }
extern "C" void UserMain( void * pd ) { initWithWeb(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); if ( EnableMultiPartForms( MAX_FILE_SIZE ) ) { iprintf("Allocated %ld bytes of memory for MultiPart Forms\r\n",(DWORD)MAX_FILE_SIZE ); iprintf("Maximum file path length: %d\r\n", (WORD)MAX_PATH_LEN ); SetNewPostHandler( MyDoPost ); } else { iprintf( "Could not allocate MultiPart Form memory\r\n" ); } while (1) { OSTimeDly(TICKS_PER_SECOND); } }
/******************************************************************** * UserMain Task *******************************************************************/ extern "C" void UserMain( void *pd ) { init(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); // Display informational message iprintf( "Listening for UDP packets on "); ShowIP( EthernetIP ); iprintf( ": %d\r\n", UDP_LISTEN_PORT ); // Create FIFO to store incoming packets and initialize it OS_FIFO UdpListenFifo; OSFifoInit( &UdpListenFifo ); // Register to listen for UDP packets on the specified port number, and // specify the fifo and callback function to use when data is received. RegisterUDPFifoWithNotify( UDP_LISTEN_PORT, &UdpListenFifo, UdpListenCallback ); while ( 1 ) { OSTimeDly( TICKS_PER_SECOND ); } }
extern "C" void UserMain( void *pd ) { init(); iprintf("Application: %s\r\nNNDK Revision: %s\r\n",AppName,GetReleaseTag()); // Resolve the NTP Server and start the NTP Client BOOL result = FALSE; while(!result) { IPADDR ipa = 0; int rv = GetHostByName( NTP_SERVER_IP, &ipa, 0, TICKS_PER_SECOND *10 ); if ( rv == DNS_OK ) { result = SetNTPTime(ipa); if(!result) { iprintf("SetNTPTime() failed, waiting 30 seconds to try again\r\n"); OSTimeDly( TICKS_PER_SECOND * 30 ); } } else { iprintf("Name resolution failed, waiting 30 seconds to try again\r\n"); OSTimeDly( TICKS_PER_SECOND * 30 ); } } // Display the current system time every 10 seconds while ( 1 ) { DWORD tv = time( NULL ); struct tm tm_struct; /* struct tm *gmtime_r(const time_t *clock, struct tm *result); Converts a time in seconds since the Epoch (00:00:00 UTC, January 1, 1970) into a broken-down time, expressed as Coordinated Universal Time (UTC). clock = The time to be converted result = Points to the structure where the converted time is to be stored On success, gmtime_r() return result. On error, it returns NULL */ gmtime_r( (const time_t *) &tv, &tm_struct ); iprintf( "UTC time = " ); PrintTimeStruct( tm_struct ); tzsetchar((char*)"EST5EDT4,M3.2.0/01:00:00,M11.1.0/02:00:00"); localtime_r((const time_t *) &tv, &tm_struct ); PrintTimeStruct( tm_struct ); tzsetchar((char*)"CST6CDT5,M3.2.0/01:00:00,M11.1.0/02:00:00"); localtime_r((const time_t *) &tv, &tm_struct ); PrintTimeStruct( tm_struct ); tzsetchar((char*)"MST7MDT6,M3.2.0/01:00:00,M11.1.0/02:00:00"); localtime_r((const time_t *) &tv, &tm_struct ); PrintTimeStruct( tm_struct ); tzsetchar((char*)"PST8PDT7,M3.2.0/01:00:00,M11.1.0/02:00:00"); localtime_r((const time_t *) &tv, &tm_struct ); PrintTimeStruct( tm_struct ); OSTimeDly( TICKS_PER_SECOND * 10 ); } }