void listing_cmd (void) { int view_type, use_msformat; char *user, *status; WPanel *p; int display_type; display_type = get_display_type (MENU_PANEL_IDX); if (display_type == view_listing) p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; else p = 0; view_type = display_box (p, &user, &status, &use_msformat, MENU_PANEL_IDX); if (view_type == -1) return; switch_to_listing (MENU_PANEL_IDX); p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; configure_panel_listing (p, view_type, use_msformat, user, status); }
void gnome_listing_cmd (GtkWidget *widget, WPanel *panel) { int view_type, use_msformat; char *user, *status; view_type = display_box (panel, &user, &status, &use_msformat, get_current_index ()); if (view_type == -1) return; configure_panel_listing (panel, view_type, use_msformat, user, status); }
static void display_perf(uint32_t x, uint32_t y, bool b_clear, uint32_t perf_kBps, uint16_t string_color) { display_box(x, y, 50, 18, WHITE, BLACK); if( !b_clear ) { sprintf(string, "%5ld", perf_kBps); et024006_PrintString(string, (const unsigned char *)&FONT8x8, x+5, y+6, string_color, -1); } else { et024006_PrintString("KByte/s", (const unsigned char *)&FONT8x8, x+55, y+6, BLACK, -1); } }
void change_listing_cmd (void) { int list_type; int use_msformat; char *user, *status; WPanel *p = NULL; if (get_display_type (MENU_PANEL_IDX) == view_listing) p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; list_type = display_box (p, &user, &status, &use_msformat, MENU_PANEL_IDX); if (list_type != -1) { switch_to_listing (MENU_PANEL_IDX); p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; configure_panel_listing (p, list_type, use_msformat, user, status); } }
//! //! @brief This function displays the a bargraph indicating the state of the audio buffers and //! the PPM deviation between the incoming USB audio sampling frequency and the output DAC sampling frequency. //! static void mmi_activity_display( bool init, uint32_t fifo_cnt ) { static char tmp[20]; static int32_t ppm; #define TIMER_MMI 1000 // Unit is in ms. static t_cpu_time mmi_timer; static uint32_t old_fcpu_hz = 0; static uint32_t mmi_activity_state=0; static uint32_t i; if( init ) { // Display PPM window et024006_PrintString("PPM", (const unsigned char *)&FONT8x8, 22, 70+4, BLUE, -1); display_box(50, 70, 40, 16, WHITE, BLACK); et024006_PrintString("HID", (const unsigned char *)&FONT8x8, 122, 70+4, BLUE, -1); display_box(150, 70, 40, 16, WHITE, BLACK); et024006_PrintString("CPU", (const unsigned char *)&FONT8x8, 222, 70+4, BLUE, -1); display_box(250, 70, 40, 16, WHITE, BLACK); et024006_PrintString("Buffers", (const unsigned char *)&FONT8x8, 0, 50+4, BLUE, -1); display_box(50, 50, 195, 16, WHITE, BLACK); cpu_set_timeout( cpu_ms_2_cy(TIMER_MMI, FCPU_HZ), &mmi_timer ); goto mmi_end; } if( !cpu_is_timeout(&mmi_timer) ) goto mmi_end; switch( mmi_activity_state ) { case 0: i = 0; mmi_activity_state = 1; // no break here case 1: if( i>=USB_STREAM_BUFFER_NUMBER ) { mmi_activity_state = 10; break; } if( i<fifo_cnt ) et024006_DrawFilledRect(50+3 + i*(10+2), 50+3, 10, 10, BLUE_LEV(15) ); else et024006_DrawFilledRect(50+3 + i*(10+2), 50+3, 10, 10, WHITE ); i++; break; case 10: ppm = usb_stream_ppm_get(); sprintf( tmp, "%4ld", ppm ); et024006_PrintString(tmp, (const unsigned char *)&FONT8x8, 50+4, 70+4, BLUE, WHITE); mmi_activity_state = 20; break; case 20: if( old_fcpu_hz==FCPU_HZ ) { mmi_activity_state = 30; break; } else mmi_activity_state = 21; // No break here case 21: old_fcpu_hz=FCPU_HZ; sprintf( tmp, "%ld", (uint32_t)FCPU_HZ/1000000); et024006_PrintString(tmp, (const unsigned char *)&FONT8x8, 250+4, 70+4, BLUE, WHITE); mmi_activity_state = 30; break; #if (defined __GNUC__) case 30: sprintf( tmp, "%ld", get_heap_total_used_size() ); et024006_PrintString(tmp, (const unsigned char *)&FONT8x8, 230, START_Y_DEMO_TEXT+13*FONT_HEIGHT, BLUE, WHITE); mmi_activity_state = 31; break; case 31: sprintf( tmp, "%ld", get_heap_curr_used_size() ); et024006_PrintString(tmp, (const unsigned char *)&FONT8x8, 230, START_Y_DEMO_TEXT+14*FONT_HEIGHT, BLUE, WHITE); // No break here #elif (defined __ICCAVR32__) case 30: sprintf( tmp, "%ld", get_heap_free_size() ); et024006_PrintString(tmp, (const unsigned char *)&FONT8x8, 230, START_Y_DEMO_TEXT+14*FONT_HEIGHT, BLUE, WHITE); // No break here #endif default: // Rearm timer cpu_set_timeout( cpu_ms_2_cy(TIMER_MMI, FCPU_HZ), &mmi_timer ); mmi_activity_state = 0; break; } mmi_end: return; }
//! //! @brief Entry point of the MMI task management //! void mmi_task(void) { uint32_t i; switch( mmi_state ) { case MMI_TOP_MENU_START: // Draw the background AVR32 logo. et024006_PutPixmap(avr32_logo, 320, 0, 0, 0, 0, 320, 240); // Display welcome string. et024006_PrintString("EVK1104 Demo", (const unsigned char *)&FONT8x8, 110, 220, BLACK, -1); mmi_state = MMI_TOP_MENU; break; case MMI_TOP_MENU: if( Is_usb_vbus_high() ) { mmi_state = MMI_MASS_STORAGE_START; } break; case MMI_MASS_STORAGE_START: // Draw the background AVR32 logo. et024006_PutPixmap(avr32_logo, 320, 0, 0, 0, 0, 320, 240); // Display USB key logo. et024006_DrawFilledRect(220-1, 20-1, 80+2, 42+2, BLACK ); et024006_PutPixmap(ms_key_logo, 80, 0, 0, 220, 20, 80, 42); // Display title. et024006_PrintString("U-Disk", (const unsigned char *)&FONT6x8, 240, 65, BLACK, -1); // Display Activity window. display_box(80, 180, 156, 16, WHITE, BLACK); // Display performances box. display_perf(120, 201, true, 0, 0); ms_old_cnt_read = ms_cnt_read =0; ms_old_cnt_write = ms_cnt_write =0; mmi_state = MMI_MASS_STORAGE; ms_cnt_screen = 0; for( i=0 ; i<MS_N_PROGRESS_BAR ; i++ ) { ms_progress_bar_level[i] = 1; ms_progress_bar_type[i] = BLACK; } mmi_ms_display(); cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_UPDATE, pm_freq_param.cpu_f), &ms_activity_timer); cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_CLEAR, pm_freq_param.cpu_f), &ms_clear_timer); break; case MMI_MASS_STORAGE: // Manage progress-bar shading. // if( cpu_is_timeout(&ms_clear_timer) ) { cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_CLEAR, pm_freq_param.cpu_f), &ms_clear_timer); mmi_ms_display(); } // Manage progress-bar box moving. // if( cpu_is_timeout(&ms_activity_timer) ) { cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_UPDATE, pm_freq_param.cpu_f), &ms_activity_timer); if( ms_old_cnt_write != ms_cnt_write ) { ms_cnt_screen = (unsigned char)(ms_cnt_screen-1)%MS_N_PROGRESS_BAR; ms_progress_bar_type[ms_cnt_screen] = RED; // Compute performances // perf_write = (U64)(ms_cnt_write - ms_old_cnt_write)*SD_MMC_SECTOR_SIZE/TIMER_MS_PROGRESS_BAR_UPDATE; display_perf(120, 201, false, perf_write, RED); ms_old_cnt_write = ms_cnt_write; ms_progress_bar_level[ms_cnt_screen] = (perf_write>10000) ? 31 : (perf_write> 7500) ? 29 : (perf_write> 5000) ? 27 : 25 ; } else if( ms_old_cnt_read != ms_cnt_read ) { ms_cnt_screen = (unsigned char)(ms_cnt_screen+1)%MS_N_PROGRESS_BAR; ms_progress_bar_type[ms_cnt_screen] = BLUE; // Compute performances // perf_read = (U64)(ms_cnt_read - ms_old_cnt_read)*SD_MMC_SECTOR_SIZE/TIMER_MS_PROGRESS_BAR_UPDATE; display_perf(120, 201, false, perf_read, BLUE); ms_old_cnt_read = ms_cnt_read; ms_progress_bar_level[ms_cnt_screen] = (perf_read>10000) ? 31 : (perf_read> 7500) ? 29 : (perf_read> 5000) ? 27 : 25 ; } else { display_perf(120, 201, true, 0, 0); } } // Detect USB unplug. // if( Is_usb_vbus_low() ) { mmi_state = MMI_TOP_MENU_START; } break; default: break; } }