// Handles different menu selection // // leftRightIndex: index for determining menus // upDownIndex, currDollars, currCents: needed for calling print_menu void select_menu(int *leftRightIndex, int upDownIndex, int currDollars, int currCents) { if (*leftRightIndex == 0) { print_welcome(); } else if (*leftRightIndex == 1) { print_menu(upDownIndex, currDollars, currCents); } else { clear_display(); delay(1000); //1ms LED_toggle(); display_string("Order Confirmed!"); display_string(" "); delay(1000000); //1sec display_string("Preparing Now..."); delay(3000000); //3sec clear_display(); delay(1000); //1ms display_string("Order Ready!"); LED_toggle(); delay(3000000); //3sec *leftRightIndex = 0; clear_display(); delay(1000); //1ms print_welcome(); } }
int main(void){ _delay_ms(1000); /* Initialize OLED Display */ init_OLED(); reset_display(); while(1){ /*Draw image on Screen*/ for(int i=0;i<128*8;i++) // show 128* 64 Logo SendChar(pgm_read_byte(logo2+i)); sendcommand(0x2f); /*Scroll on*/ _delay_ms(4000); sendcommand(0x2e); /*Scroll off*/ clear_display(); /* Draw text from font */ sendStrXY(" VISIT US AT ",0,0); sendStrXY(" WWW. ",2,0); sendStrXY(" ELEMENTZONLINE ",4,0); sendStrXY(" .COM ",6,0); _delay_ms(8000); clear_display(); } return 0; }
static void text_loglevel_change() { /* Only reset the display if we're switching between nice display * and displaying debugging output */ if (console_loglevel >= SUSPEND_ERROR) { if (lastloglevel < SUSPEND_ERROR) clear_display(); show_cursor(); if (lastloglevel > -1) printf("\nSwitched to console loglevel %d.\n", console_loglevel); if (lastloglevel > -1 && lastloglevel < SUSPEND_ERROR) { printf("\n** %s\n", lastheader); } } else if (lastloglevel >= SUSPEND_ERROR || lastloglevel == -1) { clear_display(); hide_cursor(); /* Get the nice display or last action [re]drawn */ text_prepare_status(1, 0, SUSPEND_UI_MSG, NULL); } lastloglevel = console_loglevel; }
void draw_thread(void *arg) { struct vfd_ioctl_data *data; struct vfd_ioctl_data draw_data; unsigned char buf[17]; int count = 0; int pos = 0; data = (struct vfd_ioctl_data *)arg; draw_data.length = data->length; memset(draw_data.data, 0, sizeof(draw_data.data)); memcpy(draw_data.data,data->data,data->length); thread_stop = 0; count = utf8_len(&draw_data.data[0], draw_data.length); if(count > mode_digit) { while(pos < draw_data.length) { if(kthread_should_stop()) { thread_stop = 1; return; } clear_display(); memset(buf,0, sizeof(buf)); int countb = utf8_count(&draw_data.data[pos], draw_data.length - pos, 8); memcpy(buf, &draw_data.data[pos], countb); YWPANEL_VFD_ShowString(buf); msleep(200); if (draw_data.data[pos] > 128) { pos += 2; } else { pos += 1; } } } if(count > 0) { clear_display(); memset(buf,0, sizeof(buf)); int countb = utf8_count(&draw_data.data[0], draw_data.length, 8); memcpy(buf, draw_data.data, countb); YWPANEL_VFD_ShowString(buf); } else VFD_clr(); thread_stop = 1; }
int multi_view_mode(char previous) { sensor_changer(&sensor_selector, &previous); lcd_display_top_row("Mult"); lcd_display_bottom_row(); //use sweep_num to see what stage of 'turning' the object is at char a = read_keypad(33); if (a == 'A'&& previous != a) { SYSTICK_IntCmd(DISABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 0; } else if (a == 'B'&& previous != a) { SYSTICK_IntCmd(DISABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 1; } else if (a == 'C'&& previous != a) { servoreset(); SYSTICK_IntCmd(ENABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 2; } else if (a == 'D'&& previous != a) { servoreset(); SYSTICK_IntCmd(ENABLE); char a = read_keypad(33); previous = keypad_check(a, previous); return 3; } else { keypad_change_servo_speed(&turnspeed, a, &previous); keypad_change_servo_start_pos(&servo_start, a, &previous); keypad_change_servo_stop_pos(&servo_stop, a, &previous); keypad_change_sample_rate(&samplerate, a, &previous); keypad_activate_interrupt(a, &previous); average_calculator(us_dist_arr, ir_dist_arr, array_counter, &us_avg, &ir_avg); previous = keypad_check(a, previous); //distanceircalc(); //RTC_AlarmIntConfig((LPC_RTC_TypeDef *) LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE); //RTC_SetAlarmTime((LPC_RTC_TypeDef *) LPC_RTC, RTC_TIMETYPE_SECOND, 1); return 3; } }
void display_init(uint8_t brightness) { // outputs DATA_DDR |= _BV(DATA_BIT); CLOCK_DDR |= _BV(CLOCK_BIT); LATCH_DDR |= _BV(LATCH_BIT); BLANK_DDR |= _BV(BLANK_BIT); // inputs SIGNATURE_DDR &= ~(_BV(SIGNATURE_BIT_0)); SIGNATURE_DDR &= ~(_BV(SIGNATURE_BIT_1)); SIGNATURE_DDR &= ~(_BV(SIGNATURE_BIT_2)); // enable pullups for shield bits SIGNATURE_PORT |= _BV(SIGNATURE_BIT_0); SIGNATURE_PORT |= _BV(SIGNATURE_BIT_1); SIGNATURE_PORT |= _BV(SIGNATURE_BIT_2); LATCH_ENABLE; clear_display(); detect_shield(); // Inititalize timer for multiplexing TCCR0B |= (1<<CS01); // Set Prescaler to clk/8 : 1 click = 1us. CS21=1 TIMSK0 |= (1<<TOIE0); // Enable Overflow Interrupt Enable TCNT0 = 0; // Initialize counter set_brightness(brightness); }
void sonar() //initialize sonar pins and triggering sonar { overflow = 0; PORTC|=(1<<PC0); _delay_us(50); PORTC&=~(1<<PC0); while(!(PINC&(1<<PC1))); TCNT2 = 0; while ((PINC&(1<<PC1))&&TCNT2<245); print_integer(overflow); counter = overflow*256 + TCNT2; time = counter*(1024/16); clear_display(); print_integer(counter); _delay_ms(200); }
int main(void) { initialize( 1, 1 ); enable_display( 1, 0, 0 ); clear_display(); return_cursor(); set_mode( 0, 1 ); write_symbol(' '); write_symbol(' '); write_symbol(' '); write_symbol(' '); write_symbol(' '); write_symbol('4'); write_symbol('a'); write_symbol('4'); write_symbol('i'); write_symbol('k'); while(1); }
void i2c_oled::reset_display(void) { displayOff(); clear_display(); displayOn(); }
static bool search_init(const char* file){ rb->memset(search_string, 0, sizeof(search_string)); if (!rb->kbd_input(search_string,sizeof search_string)){ clear_display(); rb->splash(0, "Searching..."); fd = rb->open(file, O_RDONLY); if (fd < 0) return false; fdw = rb->creat(resultfile); if (fdw < 0) { #ifdef HAVE_LCD_BITMAP rb->splash(HZ, "Failed to create result file!"); #else rb->splash(HZ, "File creation failed"); #endif rb->close(fd); return false; } file_size = rb->lseek(fd, 0, SEEK_END); return true; } return false ; }
/** \brief Show help file * * Read 'help.txt' and display it via 'less'. * Local 'help.txt' in actual directory overrides default file * in PKG_DATA_DIR */ int show_help(void) { int rc; char filename[] = "help.txt"; char *helpfile; char *cmdstr; if (g_access(filename, R_OK) == 0) { helpfile = g_strdup(filename); } else { helpfile = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S, filename, NULL); if (g_access(helpfile, R_OK) != 0) { g_free(helpfile); return -1; } } cmdstr = g_strdup_printf("less %s", helpfile); endwin(); rc=system("clear"); rc=system(cmdstr); rc=system("clear"); g_free(helpfile); g_free(cmdstr); set_term(mainscreen); clear_display(); return 0; }
void display_init() { // Setting up ports. SYSCTL_RCGC2_R |= SYSCTL_DC4_GPIOB; // Enable GPIOB //maybe delay2 here delay2(10000); SYSCTL_RCGC2_R |= SYSCTL_DC4_GPIOD; // Enable GPIOD delay2(10000); GPIO_PORTB_DIR_R |= 0x7f; GPIO_PORTD_DIR_R |= 0xe0; GPIO_PORTB_AFSEL_R &= 0xffffff80; GPIO_PORTD_AFSEL_R &= 0xffffff1f; GPIO_PORTB_DEN_R |= 0x7f; // Enable port B GPIO_PORTD_DEN_R |= 0xe0; // Enable port D // Function set commands separated by delay2s, as per cycle //delay2(100); //SysCtldelay2(5*SysCtlClockGet()/(3*1000)); //5msec delay2(5000); //5msec function_set(0, 0); //SysCtldelay2(5*SysCtlClockGet()/(3*1000)); //5msec //delay2(10); delay2(5000); //5msec function_set(0, 0); //SysCtldelay2(2*SysCtlClockGet()/(3*10000)); //200usec delay2(200); //200usec //delay2(10); function_set(0, 0); function_set(1, 0); //two lines display_off(); clear_display(); entry_mode_set(1,0); }
void display_multiplex(void) { clear_display(); if (display_on) { switch (shield) { #ifdef iv6_support case SHIELD_IV6: write_vfd_iv6(multiplex_counter, calculate_segments_7(data[multiplex_counter])); break; #endif #ifdef iv17_support case SHIELD_IV17: write_vfd_iv17(multiplex_counter, calculate_segments_16(data[multiplex_counter])); break; #endif case SHIELD_IV18: if (multiplex_counter == 8) write_vfd_iv18(8, g_iv18seg0); else write_vfd_iv18(multiplex_counter, calculate_segments_7(data[7-multiplex_counter])); break; #ifdef iv17_6digit_support case SHIELD_IV17_6D: write_vfd_iv17_6d(multiplex_counter, calculate_segments_16(data[multiplex_counter])); break; #endif default: break; } } multiplex_counter++; if (multiplex_counter == mpx_limit) multiplex_counter = 0; STROBE_HIGH; // Pulse Strobe to update Latch data STROBE_LOW; }
int main (void) { long i; init_timer(&data[6], &data[0]); init_power(); play_system_sound(0x4003, 1); clear_display(); for (i = -5; i <= 5; i++) { set_lcd_number(LCD_SIGNED, i % 5, LCD_DECIMAL_0); refresh_display(); wait_release(); wait_press(); } for (i = -5; i <= 5; i++) { set_lcd_number(LCD_SIGNED, i % -5, LCD_DECIMAL_0); refresh_display(); wait_release(); wait_press(); } shutdown_timer(); return 0; }
int main (void) { char playing; while (1) { init_timer(&data[6], &data[0]); init_power(); set_lcd_segment(0x3020); refresh_display(); play_system_sound(0x4003, 1); wait_release(); wait_press(); play_system_sound(0x4003, 0); do { get_sound_playing_flag(0x700c, &playing); } while (playing); clear_display(); refresh_display(); shutdown_timer(); shutdown_power(); } return 0; }
//Displays current alarm time //Brightness level is an amount of time the LEDs will be in - 200us is pretty dim but visible. //Amount of time during display is around : [ BRIGHT_LEVEL(us) * 5 + 10ms ] * 10 //Roughly 11ms * 10 = 110ms //Time on is in (ms) void display_alarm_time(uint16_t time_on) { uint16_t bright_level = 50; //time_on /= 11; //Take the time_on and adjust it for the time it takes to run the display loop below for(uint16_t j = 0 ; j < time_on ; j++) { //Display normal hh:mm time if(hours_alarm > 9) { display_number(hours_alarm / 10, 1); //Post to digit 1 delay_us(bright_level); } display_number(hours_alarm % 10, 2); //Post to digit 2 delay_us(bright_level); display_number(minutes_alarm / 10, 3); //Post to digit 3 delay_us(bright_level); display_number(minutes_alarm % 10, 4); //Post to digit 4 delay_us(bright_level); //During debug, display mm:ss /*display_number(minutes_alarm / 10, 1); delay_us(bright_level); display_number(minutes_alarm % 10, 2); delay_us(bright_level); display_number(seconds_alarm / 10, 3); delay_us(bright_level); display_number(seconds_alarm % 10, 4); delay_us(bright_level); display_number(10, 5); //Display colon delay_us(bright_level);*/ //Flash colon for each second if(flip == 1) { display_number(10, 5); //Post to digit COL delay_us(bright_level); } //Check whether it is AM or PM and turn on dot if(ampm_alarm == AM) { display_number(12, 6); //Turn on dot on apostrophe delay_us(bright_level); } clear_display(); delay_ms(1); } }
int setweight(int weight) { // write weight to netkeyer extern int keyerport; int retval; char buff[4]; if (keyerport == NET_KEYER && weight > -51 && weight < 51) { sprintf(buff, "%d", weight); retval = netkeyer(K_WEIGHT, buff); if (retval < 0) { mvprintw(24, 0, "keyer not active ?"); sleep(1); clear_display(); } } return (0); }
void delete_qso(void) { int x; struct stat statbuf; int lfile; char logline[100]; char call[15], bandmode[6]; mvprintw(13, 29, "OK to delete last qso (y/n)?"); x = key_get(); if ((x == 'y') || (x == 'Y')) { if ((lfile = open(logfile, O_RDWR)) < 0) { TLF_LOG_WARN("I can not find the logfile..."); } else { fstat(lfile, &statbuf); if (statbuf.st_size >= LOGLINELEN) { if (qtcdirection > 0) { // read band, mode and call from last QSO line lseek(lfile, ((int)statbuf.st_size - LOGLINELEN), SEEK_SET); IGNORE(read(lfile, logline, LOGLINELEN - 1));; g_strlcpy(bandmode, logline, 6); g_strlcpy(call, logline + 29, 15); g_strchomp(call); // delete QTC's for that combination of band, mode and call delete_last_qtcs(call, bandmode); } IGNORE(ftruncate(lfile, statbuf.st_size - LOGLINELEN)); } fsync(lfile); close(lfile); if (qsos[nr_qsos][0] != ';') { band_score[bandinx]--; qsonum--; qsonr_to_str(); } nr_qsos--; qsos[nr_qsos][0] = '\0'; } scroll_log(); } attron(COLOR_PAIR(C_LOG) | A_STANDOUT); mvprintw(13, 29, " "); printcall(); clear_display(); }
/* Description: Forecast state + Calculation of forecast State from Diagram: S07 */ state do_DISP_FC() { int averagePressure = 0; for (int i=0; i<5; i++) averagePressure += pressureData[i]; averagePressure /= 5; //TODO: should all this be floats?ich if (pressureData[3] > averagePressure && pressureData[4] > averagePressure) { GotoLCD_Location(1,1); Send_String("Forecast: Good"); GotoLCD_Location(1,2); Send_String("Weather Expected"); howistheweather = 1; } else { GotoLCD_Location(1,1); Send_String("Forecast: Bad"); GotoLCD_Location(1,2); Send_String("Weather Expected"); howistheweather = 0; } if (isforecast ==0) { clear_display(); return DISP_TEMP; } else return DISP_FC; }
void setup_display(void) { pinMode(DATA, OUTPUT); pinMode(CLOCK, OUTPUT); pinMode(LATCH, OUTPUT); clear_display(); swap_displays(); }
void next_help_page() { int i; page = ++page % HELP_PAGES; clear_display(); for (i = 0; i < 4; i++) put_string_display(HELP_TEXT[page][i], 0, i); }
// display multiplexing routine for IV6 shield: run once every 2ms void display_multiplex_iv6(void) { clear_display(); switch (multiplex_counter) { case 0: write_vfd_iv6(0, calculate_segments_7(display_on ? data[0] : ' ')); break; case 1: write_vfd_iv6(1, calculate_segments_7(display_on ? data[1] : ' ')); break; case 2: write_vfd_iv6(2, calculate_segments_7(display_on ? data[2] : ' ')); break; case 3: write_vfd_iv6(3, calculate_segments_7(display_on ? data[3] : ' ')); break; case 4: write_vfd_iv6(4, calculate_segments_7(display_on ? data[4] : ' ')); break; case 5: write_vfd_iv6(5, calculate_segments_7(display_on ? data[5] : ' ')); break; } multiplex_counter++; if (multiplex_counter == 6) multiplex_counter = 0; }
int tape_measure_mode(char previous) { sensor_changer(&sensor_selector, &previous); count = 18; lcd_display_top_row("Tape"); lcd_display_bottom_row(); char a = read_keypad(33); if (a == 'A'&& previous != a) { SYSTICK_IntCmd(DISABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 0; } else if (a == 'B'&& previous != a) { SYSTICK_IntCmd(DISABLE); char a = read_keypad(33); previous = keypad_check(a, previous); return 1; } else if (a == 'C'&& previous != a) { servoreset(); SYSTICK_IntCmd(ENABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 2; } else if (a == 'D'&& previous != a) { servoreset(); SYSTICK_IntCmd(ENABLE); clear_display(59); char a = read_keypad(33); previous = keypad_check(a, previous); return 3; } else { //distanceircalc(); //RTC_AlarmIntConfig((LPC_RTC_TypeDef *) LPC_RTC, RTC_TIMETYPE_SECOND, DISABLE); PWM_MatchUpdate((LPC_PWM_TypeDef *) LPC_PWM1,2,18,PWM_MATCH_UPDATE_NOW); keypad_change_sample_rate(&samplerate, a, &previous); average_calculator(us_dist_arr, ir_dist_arr, array_counter, &us_avg, &ir_avg); previous = keypad_check(a, previous); return 1; } }
void pause_menu(const char *s) { clear_display(); put_string_display(s, 0, 0); while (!(get_button(0) || get_button(1))) delay(20); while (get_button(0) || get_button(1)) ; }
/* * This function takes very specific values for x, y, and color. * The x and y can range from 0 to 7. * The color can be 0x40 (RED), 0x80 (GREEN), or 0xc0 (AMBER) * This function doesn't check for valid values, but just uses bit-masking * to take care of it. */ void display_dot( char x, char y, char color ) { clear_display(); color &= AMBER; // mask color PORTB &= ~color; // turn off the colors we don't want. char dot = 1 << y; PORTE = x & 0x07; // mask column PORTC = dot; }
void warning() { for( int i = 0; i < 5; ++i ){ PORTB = RED; PORTC = 0xa5; _delay_ms(120); clear_display(); _delay_ms(60); } }
void clock_poll(void) { switch (state) { case S_STANDBY: clear_display(); if (sw_a_read()) { ticks = TICK_COUNT; show_time(); state = S_TIME; countdown = TIME_TIMEOUT; } else if (sw_b_read()) { show_voltage(); state = S_BATT_DEBOUNCE; countdown = BATT_TIMEOUT; } break; case S_TIME: if (countdown == 0) state = S_STANDBY; break; case S_BATT_DEBOUNCE: if (!sw_b_read()) state = S_BATT; break; case S_BATT: if (sw_b_read()) { usb_toggle(); show_voltage(); state = S_BATT_DEBOUNCE; countdown = BATT_TIMEOUT; } if (countdown == 0) state = S_STANDBY; break; } if (state != S_STANDBY || chg_read()) { refresh_running = 1; PRR &= ~_BV(PRTIM0); /* start refresh timer */ } else { refresh_running = 0; } /* battery charging indicator */ if (state == S_STANDBY && chg_read()) { switch (time % 5) { case 4: digits[3] = LCD_DOT; case 3: digits[2] = LCD_DOT; case 2: digits[1] = LCD_DOT; case 1: digits[0] = LCD_DOT; } } }
void initialize() { ON = 1; BLON = 0; clear_display(); set_entry(); function_set(); display_on(); }
/* Description: End of Setup, Store changed data to RTC and display end message State from Diagram: S13 */ state do_DISP_SETUP_MSG() { GotoLCD_Location(1,1); Send_String("Time&Date Set!"); ds1307_setdate(time[0],time[1],time[2],time[3],time[4],0); _delay_ms(10000); clear_display(); issetup=0; return DISP_TEMP; }
void start_menu() { int i; clear_display(); center_text(TITLE, 0); for (i = 0; i < TITLE_ROWS; i++) put_string_display(TITLE_TEXT[i], 5, i+1); start_menu_selection = 0; put_string_display("*", 3, 1); }