void tests_ht_compass(void) { #ifdef TEST_PORT4_I2C U32 sensor = 3; #else U32 sensor = 2; #endif hello(); nx_display_clear(); nx_display_cursor_set_pos(0, 0); nx_display_string("Test of compass\n\n"); //nx_i2c_init(); nx_display_string("Press OK to stop\n\n"); ht_compass_init(sensor); if( ! ht_compass_detect(sensor) ) { nx_display_string("No compass!\n"); goodbye(); return; } ht_compass_info(sensor); while(nx_avr_get_button() != BUTTON_OK) { nx_display_cursor_set_pos(9, 6); nx_display_string(" "); nx_display_cursor_set_pos(9, 6); nx_display_uint( ht_compass_read_heading(sensor) ); nx_systick_wait_ms(100); } ht_compass_close(sensor); goodbye(); }
void tests_ht_color(void) { #ifdef TEST_PORT4_I2C U32 sensor = 3; #else U32 sensor = 2; #endif hello(); nx_display_clear(); nx_display_cursor_set_pos(0, 0); nx_display_string("Test of ht_color\n\n"); //nx_i2c_init(); nx_display_string("Press OK to stop\n"); ht_color_init(sensor); if( ! ht_color_detect(sensor) ) { nx_display_string("No color!\n"); goodbye(); return; } ht_color_info(sensor); ht_color_values values; while(nx_avr_get_button() != BUTTON_OK) { if ( ! ht_color_read_values(sensor, &values) ) { nx_display_string("Error reading!"); break; } nx_display_cursor_set_pos(0, 5); nx_display_string("#: "); nx_display_int(values.colornum); nx_display_string(" "); nx_display_cursor_set_pos(9, 5); nx_display_string("R: "); nx_display_int(values.redval); nx_display_string(" "); nx_display_cursor_set_pos(0, 6); nx_display_string("G: "); nx_display_int(values.greenval); nx_display_string(" "); nx_display_cursor_set_pos(9, 6); nx_display_string("B: "); nx_display_int(values.blueval); nx_display_string(" "); nx_display_end_line(); nx_systick_wait_ms(100); } ht_color_close(sensor); goodbye(); }
// funciton definition int main() { printf("the program begins...\n"); first_function(); goodbye(); return 0; }
void tests_sensors(void) { U32 i, sensor; const U32 display_seconds = 15; hello(); for (sensor=0; sensor<NXT_N_SENSORS; sensor++) { nx_sensors_analog_enable(sensor); } for (i=0; i<(display_seconds*4); i++) { nx_display_clear(); nx_display_cursor_set_pos(0,0); nx_display_string("- Sensor info -\n" "----------------\n"); for (sensor=0; sensor<NXT_N_SENSORS; sensor++){ nx_display_string("Port "); nx_display_uint(sensor); nx_display_string(": "); nx_display_uint(nx_sensors_analog_get(sensor)); nx_display_end_line(); } nx_systick_wait_ms(250); } for (sensor=0; sensor<NXT_N_SENSORS; sensor++) { nx_sensors_analog_disable(sensor); } goodbye(); }
void tests_sound(void) { enum { end = 0, sleep500 = 1, si = 990, dod = 1122, re = 1188, mi = 1320, fad = 1496, sol = 1584, } pain[] = { si, sleep500, fad, si, sol, sleep500, fad, mi, fad, sleep500, mi, fad, sol, sol, fad, mi, si, sleep500, fad, si, sol, sleep500, fad, mi, re, sleep500, mi, re, dod, dod, re, dod, si, end }; int i = 0; hello(); nx_display_clear(); nx_display_cursor_set_pos(0,0); nx_display_string("-- Sound test --\n" "----------------\n"); while (pain[i] != end) { if (pain[i] == sleep500) nx_systick_wait_ms(150); else nx_sound_freq(pain[i], 150); nx_systick_wait_ms(150); i++; } nx_systick_wait_ms(1000); goodbye(); }
void tests_fs(void) { hello(); fs_test_infos(); nx_systick_wait_ms(2000); fs_test_dump(); goodbye(); }
int main() { mailand(); foo(glob); verylongfun(); goodbye(); }
main(){ //printf("main = 0x%lf \n", &main); char name[12], pw[12]; /* passwords are short! */ //printf("&name[123] = 0x%lx \n",&name); //printf("&pw[123] = 0x%lx \n",&pw); char *good = "Welcome to The Machine!\n"; char *evil = "Invalid identity, exiting!\n"; //printf("good = 0x%lx , &good = 0x%lx \n",good, &good); //printf("evil = 0x%lx , &evil = 0x%lx \n",evil, &evil); //printf("match = 0x%lx \n",&match); //printf("welcome = 0x%lx \n", &welcome); //printf("goodbye = 0x%lx \n", &goodbye); printf("login: "******"%s", name); printf("password: "******"%s", pw); if( match(name,pw) == 0 ) welcome( good ); else goodbye(evil ); }
int main() { int alldone = 0; welcome(); do { if (checkdata() == 1) { resetstatus(); } do { if (checkstatus() == 1) { if (restart()) { break; } } displaystatus(); alldone = continueclipping(); } while (alldone == 0); resetstatus(); goodbye(); } while (close() == 0); return 0; }
/*--------------------------------------------------------------------------------------------------------------------------*/ int main(void) { int userChoice; clearScreen(); welcome(); menu(); while ((userChoice = validate(0, 3)) != 3) // while userChoice is not 3 { if (userChoice == 0) // welcome message is displayed { welcome(); } else if (userChoice == 1) // user is promted again for input with validate while new game isnt implemented { newGame(); } else if (userChoice == 2) // user is promted again for input with validate while load isnt implemented { load(); } } goodbye(); return 0; }
// show floating point and bignumber corners void showcorners(char *s) { int dec = 20; char msg[100], msg1[100], msg3[100]; bntostr(msg, dec, bnxmin); sprintf(msg1, "bnxmin=%s\nxxmin= %.20f\n\n", msg, xxmin); strcpy(msg3, s); strcat(msg3, "\n"); strcat(msg3, msg1); bntostr(msg, dec, bnxmax); sprintf(msg1, "bnxmax=%s\nxxmax= %.20f\n\n", msg, xxmax); strcat(msg3, msg1); bntostr(msg, dec, bnymin); sprintf(msg1, "bnymin=%s\nyymin= %.20f\n\n", msg, yymin); strcat(msg3, msg1); bntostr(msg, dec, bnymax); sprintf(msg1, "bnymax=%s\nyymax= %.20f\n\n", msg, yymax); strcat(msg3, msg1); bntostr(msg, dec, bnx3rd); sprintf(msg1, "bnx3rd=%s\nxx3rd= %.20f\n\n", msg, xx3rd); strcat(msg3, msg1); bntostr(msg, dec, bny3rd); sprintf(msg1, "bny3rd=%s\nyy3rd= %.20f\n\n", msg, yy3rd); strcat(msg3, msg1); if (stopmsg(STOPMSG_NONE, msg3) == -1) goodbye(); }
int kmain() { initializeBuffer(); cursor = 0; /* Borra la pantalla. */ clearScreen(); /* CARGA DE IDT */ setup_IDT_content(); /* Carga de IDTR */ setup_IDTR(); _Cli(); _mascaraPIC1(0xFC); /*Habilito timer tick, teclado*/ _mascaraPIC2(0xFF); /*Las interrupciones del segundo PIC quedan deshabilitadas*/ _Sti(); showSplashScreen(); shell(); _Cli(); goodbye(); _Sti(); return 0; }
void showcornersbf(char *s) { int dec = decimals; char msg[100], msg1[100], msg3[600]; if (dec > 20) dec = 20; bftostr(msg, dec, bfxmin); sprintf(msg1, "bfxmin=%s\nxxmin= %.20f decimals %d bflength %d\n\n", msg, xxmin, decimals, bflength); strcpy(msg3, s); strcat(msg3, "\n"); strcat(msg3, msg1); bftostr(msg, dec, bfxmax); sprintf(msg1, "bfxmax=%s\nxxmax= %.20f\n\n", msg, xxmax); strcat(msg3, msg1); bftostr(msg, dec, bfymin); sprintf(msg1, "bfymin=%s\nyymin= %.20f\n\n", msg, yymin); strcat(msg3, msg1); bftostr(msg, dec, bfymax); sprintf(msg1, "bfymax=%s\nyymax= %.20f\n\n", msg, yymax); strcat(msg3, msg1); bftostr(msg, dec, bfx3rd); sprintf(msg1, "bfx3rd=%s\nxx3rd= %.20f\n\n", msg, xx3rd); strcat(msg3, msg1); bftostr(msg, dec, bfy3rd); sprintf(msg1, "bfy3rd=%s\nyy3rd= %.20f\n\n", msg, yy3rd); strcat(msg3, msg1); if (stopmsg(STOPMSG_NONE, msg3) == -1) goodbye(); }
void tests_usb_hardcore(void) { int i, lng; char buffer[NX_USB_PACKET_SIZE]; hello(); nx_systick_wait_ms(6000); nx_usb_read((U8 *)(&buffer), NX_USB_PACKET_SIZE); for (i = 0 ; i < 1800 ; i++) { if ( (lng = nx_usb_data_read()) > 0) { if (streq(buffer, "halt")) { break; } nx_usb_read((U8 *)(&buffer), NX_USB_PACKET_SIZE); } nx_usb_write((U8 *)"TEST", 5); } goodbye(); }
int main() { screen next_screen = HOME; populate_values(); snprintf(msg, MSG_LEN, "-"); n_keys = 0; while (next_screen != EXIT) { switch (next_screen) { case HOME: next_screen = home_screen(); break; case ABOUT: next_screen = about_screen(); break; case RUN: next_screen = run_screen(); break; case RUNNING: next_screen = running_screen(); break; case EXIT: break; } } snprintf(msg, MSG_LEN, " Saindo da aplicação"); goodbye(); return 0; }
void tests_ht_gyro(void) { U32 sensor = 2; hello(); nx_display_clear(); nx_display_cursor_set_pos(0, 0); nx_display_string(" Test of ht_gyro\n\n"); nx_display_string("Press OK calc 0\n"); nx_display_string("The Gyro must\nstand still\n"); while(nx_avr_get_button() != BUTTON_OK) nx_systick_wait_ms(10); nx_display_string("Calculating 0\n"); ht_gyro_init(sensor); U32 zero = ht_gyro_calculate_average_zero(sensor); nx_display_string("Zero: "); nx_display_uint(zero); nx_display_end_line(); nx_systick_wait_ms(1000); /* Give the user time to release the OK-button */ U32 rotation; while(nx_avr_get_button() != BUTTON_OK) { nx_display_cursor_set_pos(0, 7); nx_display_string(" "); rotation = ht_gyro_get_value(sensor); nx_display_cursor_set_pos(0, 7); nx_display_uint( rotation ); nx_display_string(" "); nx_display_int( (S32)rotation - zero ); nx_systick_wait_ms(100); } ht_gyro_close(sensor); goodbye(); }
void tests_defrag(void) { hello(); //fs_test_defrag_simple(); //fs_test_defrag_empty(); //fs_test_defrag_for_file(); fs_test_defrag_best_overall(); goodbye(); }
// ---------------------------------------------------------------------- void Counter::slotInc() { emit counterChanged(++m_nValue); if (m_nValue == 5) { emit goodbye(); } }
void tests_ht_accel(void) { #ifdef TEST_PORT4_I2C U32 sensor = 3; #else U32 sensor = 2; #endif hello(); nx_display_clear(); nx_display_cursor_set_pos(0, 0); nx_display_string("Test of ht_accel\n\n"); //nx_i2c_init(); nx_display_string("Press OK to stop\n"); ht_accel_init(sensor); if( ! ht_accel_detect(sensor) ) { nx_display_string("No accel!\n"); goodbye(); return; } ht_accel_info(sensor); ht_accel_values values; while(nx_avr_get_button() != BUTTON_OK) { nx_display_cursor_set_pos(3, 5); if ( ! ht_accel_read_values(sensor, &values) ) { nx_display_string("Error reading!"); break; } nx_display_string(" "); nx_display_cursor_set_pos(3, 5); nx_display_int( values.x ); nx_display_cursor_set_pos(3, 6); nx_display_string(" "); nx_display_cursor_set_pos(3, 6); nx_display_int( values.y ); nx_display_cursor_set_pos(3, 7); nx_display_string(" "); nx_display_cursor_set_pos(3, 7); nx_display_int( values.z ); nx_systick_wait_ms(100); } ht_accel_close(sensor); goodbye(); }
// compare a double and bignumber void comparevaluesbf(char *s, LDBL x, bf_t bfx) { int dec = 40; char msg[300], msg1[300]; bftostr_e(msg, dec, bfx); sprintf(msg1, "%s\nbignum=%s\ndouble=%.20Lf\n\n", s, msg, x); if (stopmsg(STOPMSG_NONE, msg1) == -1) goodbye(); }
void DisplayHandle(U16 handle) { char buf[MSGLEN]; sprintf(buf, "Handle %u, type %s, size %li", handle, memstr[handletable[handle].Nowhere.stored_at], handletable[handle].Nowhere.size); if (stopmsg(STOPMSG_CANCEL | STOPMSG_NO_BUZZER, (char *)buf) == -1) goodbye(); // bailout if ESC, it's messy, but should work }
void show_two_bf(char *s1, bf_t t1, char *s2, bf_t t2, int digits) { char msg1[200], msg2[200], msg3[400]; bftostr_e(msg1, digits, t1); bftostr_e(msg2, digits, t2); sprintf(msg3, "\n%s->%s\n%s->%s", s1, msg1, s2, msg2); if (stopmsg(STOPMSG_NONE, msg3) == -1) goodbye(); }
void tests_bt2(void) { /*int i; */ hello(); /* Configuring the BT */ nx_bt_init(); nx_display_clear(); nx_display_string("Setting friendly name ..."); nx_display_end_line(); nx_bt_set_friendly_name("tulipe"); nx_display_string("Setting as discoverable ..."); nx_display_end_line(); nx_bt_set_discoverable(TRUE); /* Listing known devices */ tests_bt_list_known_devices(); /* Scanning & adding */ tests_bt_scan_and_add(); /* Listing known devices */ tests_bt_list_known_devices(); /* Scanning & removing */ tests_bt_scan_and_remove(); /* Listing known devices */ tests_bt_list_known_devices(); /* for (i = 0 ; i < 10 ; i++) { nx_display_clear(); nx_bt_debug(); nx_systick_wait_ms(1000); } */ goodbye(); }
void NetworkManager::Disconnect(Connection target) { // send goodbye std::shared_ptr<GoodbyeEvent> goodbye(new GoodbyeEvent("Disconnected")); goodbye->ClearRecipients(); goodbye->AddRecipient(mConnectionsManager.GetConnectionID(target)); // do not queue the event but send it directly, as we will remove the connection now _SendEvent(goodbye); mConnectionsManager.RemoveConnection(target); }
//******************************************************************** void show_var_bf(char *s, bf_t n) { char msg[200]; strcpy(msg, s); strcat(msg, " "); bftostr_e(msg+strlen(s), 40, n); msg[79] = 0; if (stopmsg(STOPMSG_NONE, msg) == -1) goodbye(); }
void show_three_bf(char *s1, bf_t t1, char *s2, bf_t t2, char *s3, bf_t t3, int digits) { char msg1[200], msg2[200], msg3[200], msg4[600]; bftostr_e(msg1, digits, t1); bftostr_e(msg2, digits, t2); bftostr_e(msg3, digits, t3); sprintf(msg4, "\n%s->%s\n%s->%s\n%s->%s", s1, msg1, s2, msg2, s3, msg3); if (stopmsg(STOPMSG_NONE, msg4) == -1) goodbye(); }
void hay_disconnect(void) { /* first hang up the modem*/ #ifdef DEBUG printf("\rdisconnecting modem....\n\r"); #endif ioctl(FD, TIOCCDTR, 0); sleep(1); ioctl(FD, TIOCSDTR, 0); goodbye(); }
void *threadGoodbye() { time_t t; srand((unsigned) time(&t)); int randTime = rand() % 100; // get random time between 0 and 100 for (int i = 0; i < randTime; i++) { // do nothing } goodbye(); // print "Goodbye" return NULL; }
// show globals void showbfglobals(char *s) { char msg[300]; sprintf(msg, "%s\n\ bnstep=%d bnlength=%d intlength=%d rlength=%d padding=%d\n\ shiftfactor=%d decimals=%d bflength=%d rbflength=%d \n\ bfdecimals=%d ", s, bnstep, bnlength, intlength, rlength, padding, shiftfactor, decimals, bflength, rbflength, bfdecimals); if (stopmsg(STOPMSG_NONE, msg) == -1) goodbye(); }
void showcornersdbl(char *s) { char msg[400]; sprintf(msg, "%s\n" "xxmin= %.20f xxmax= %.20f\n" "yymin= %.20f yymax= %.20f\n" "xx3rd= %.20f yy3rd= %.20f\n" "delxx= %.20Lf delyy= %.20Lf\n" "delx2= %.20Lf dely2= %.20Lf", s, xxmin, xxmax, yymin, yymax, xx3rd, yy3rd, delxx, delyy, delxx2, delyy2); if (stopmsg(STOPMSG_NONE, msg) == -1) goodbye(); }