1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
| void oled_show_init() { rt_err_t ret = RT_ERROR;
config_t config = get_config(); idle_mode_show_logo_flag = config.logo_show;
gui_init();
gui_bitmap_init(&logo_bitmap, &logo_bitmap_att); gui_bitmap_set_localtion(&logo_bitmap, 0, 0); gui_bitmap_set_size(&logo_bitmap, 0, 64); gui_bitmap_set_bitmap(&logo_bitmap, (uint8_t *)LOGO_BMP_ADDRESS, 128, 64); gui_screen_layer_add_obj(&logo_bitmap, 0);
gui_cube_init(&cube_anim, &cube_anim_att); gui_cube_set_localtion(&cube_anim, 0, 0); gui_cube_set_size(&cube_anim, 0, 64); gui_screen_layer_add_obj(&cube_anim, 0);
gui_anim_init(&idle_mode_anim); gui_anim_add(&idle_mode_anim); gui_anim_set_start(&idle_mode_anim, 0); gui_anim_set_end(&idle_mode_anim, 64); gui_anim_set_time(&idle_mode_anim, 500); gui_anim_set_path_cb(&idle_mode_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&idle_mode_anim, &logo_bitmap, gui_anim_set_obj_x1_x2_cb); gui_anim_start(&idle_mode_anim, 0);
idle_mode_show_logo(idle_mode_show_logo_flag);
gui_label_init(&cpu_label, &cpu_label_att); gui_label_set_localtion(&cpu_label, 0, -13); gui_label_set_size(&cpu_label, 128, 12); gui_label_set_font(&cpu_label, &font1608); gui_label_set_text_offset(&cpu_label, 1, 0); gui_label_set_text_by_string(&cpu_label, "CPU -.-% --\x83\x84"); gui_screen_layer_add_obj(&cpu_label, 1);
gui_anim_init(&cpu_label_anim); gui_anim_add(&cpu_label_anim); gui_anim_set_start(&cpu_label_anim, -13); gui_anim_set_end(&cpu_label_anim, 0); gui_anim_set_time(&cpu_label_anim, 500); gui_anim_set_path_cb(&cpu_label_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&cpu_label_anim, &cpu_label, gui_label_set_y);
gui_osc_init(&cpu_osc, &cpu_osc_att); gui_osc_set_localtion(&cpu_osc, -65, 14); gui_osc_set_size(&cpu_osc, 65, 37); gui_osc_add_points(&cpu_osc, cpu_osc_points, 33); gui_osc_points_init(&cpu_osc); gui_osc_set_div(&cpu_osc, 2); gui_screen_layer_add_obj(&cpu_osc, 1);
gui_anim_init(&cpu_osc_anim); gui_anim_add(&cpu_osc_anim); gui_anim_set_start(&cpu_osc_anim, -65); gui_anim_set_end(&cpu_osc_anim, 0); gui_anim_set_time(&cpu_osc_anim, 500); gui_anim_set_path_cb(&cpu_osc_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&cpu_osc_anim, &cpu_osc, gui_obj_set_x);
gui_label_init(&mem_label, &mem_label_att); gui_label_set_localtion(&mem_label, 65, 18); gui_label_set_size(&mem_label, 63, 16); gui_label_set_font(&mem_label, &font1608); gui_label_set_text_offset(&mem_label, 19, 0); gui_label_set_text_by_string(&mem_label, "MEM");
gui_label_init(&mem_act_label, &mem_act_label_att); gui_label_set_localtion(&mem_act_label, 65, 37); gui_label_set_size(&mem_act_label, 28, 12); gui_label_set_font(&mem_act_label, &font1206); gui_label_set_text_offset(&mem_act_label, 2, 0); gui_label_set_text_by_string(&mem_act_label, " --%");
gui_label_init(&mem_used_label, &mem_used_label_att); gui_label_set_localtion(&mem_used_label, 94, 37); gui_label_set_size(&mem_used_label, 32, 12); gui_label_set_font(&mem_used_label, &font1206); gui_label_set_text_offset(&mem_used_label, 0, 0); gui_label_set_text_by_string(&mem_used_label, " -.-G");
gui_label_init(&gpu_label, &gpu_label_att); gui_label_set_localtion(&gpu_label, 65 + 63, 18); gui_label_set_size(&gpu_label, 63, 16); gui_label_set_font(&gpu_label, &font1608); gui_label_set_text_offset(&gpu_label, 19, 0); gui_label_set_text_by_string(&gpu_label, "GPU");
gui_label_init(&gpu_act_label, &gpu_act_label_att); gui_label_set_localtion(&gpu_act_label, 65 + 63, 37); gui_label_set_size(&gpu_act_label, 28, 12); gui_label_set_font(&gpu_act_label, &font1206); gui_label_set_text_offset(&gpu_act_label, 2, 0); gui_label_set_text_by_string(&gpu_act_label, " --%");
gui_label_init(&gpu_temp_label, &gpu_temp_label_att); gui_label_set_localtion(&gpu_temp_label, 94 + 63, 37); gui_label_set_size(&gpu_temp_label, 32, 12); gui_label_set_font(&gpu_temp_label, &font1206); gui_label_set_text_offset(&gpu_temp_label, 4, 0); gui_label_set_text_by_string(&gpu_temp_label, " --\x83\x84");
gui_container_init(&mem_gpu_cont, &mem_gpu_cont_att); gui_container_set_localtion(&mem_gpu_cont, 64, 14); gui_container_set_size(&mem_gpu_cont, 64, 37); gui_container_set_edge_style(&mem_gpu_cont, 1); gui_container_add_obj(&mem_gpu_cont, &mem_label); gui_container_add_obj(&mem_gpu_cont, &mem_act_label); gui_container_add_obj(&mem_gpu_cont, &mem_used_label); gui_container_add_obj(&mem_gpu_cont, &gpu_label); gui_container_add_obj(&mem_gpu_cont, &gpu_act_label); gui_container_add_obj(&mem_gpu_cont, &gpu_temp_label); gui_container_set_localtion(&mem_gpu_cont, 128, 14); gui_screen_layer_add_obj(&mem_gpu_cont, 1);
gui_anim_init(&mem_gpu_cont_anim); gui_anim_add(&mem_gpu_cont_anim); gui_anim_set_start(&mem_gpu_cont_anim, 128); gui_anim_set_end(&mem_gpu_cont_anim, 64); gui_anim_set_time(&mem_gpu_cont_anim, 500); gui_anim_set_path_cb(&mem_gpu_cont_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&mem_gpu_cont_anim, &mem_gpu_cont, gui_container_set_x);
gui_anim_init(&mem_gpu_cont_switch_anim); gui_anim_add(&mem_gpu_cont_switch_anim); gui_anim_set_start(&mem_gpu_cont_switch_anim, 0); gui_anim_set_end(&mem_gpu_cont_switch_anim, -63); gui_anim_set_time(&mem_gpu_cont_switch_anim, 400); gui_anim_set_control_obj(&mem_gpu_cont_switch_anim, &mem_gpu_cont, gui_anim_set_mem_gpu_label_offset); gui_anim_set_path_cb(&mem_gpu_cont_switch_anim, gui_anim_path_ease_in_out); gui_anim_set_paly_back_mode(&mem_gpu_cont_switch_anim, 3000, 1); gui_anim_set_loop_mode(&mem_gpu_cont_switch_anim, 1); gui_anim_start(&mem_gpu_cont_switch_anim, 3000);
gui_label_init(&nic_label, &nic_label_att); gui_label_set_localtion(&nic_label, 0, 51); gui_label_set_size(&nic_label, 12, 12); gui_label_set_font(&nic_label, &font1206); gui_label_set_text_offset(&nic_label, 0, 1); gui_label_set_text_by_string(&nic_label, "\x85\x86");
gui_label_init(&nic_download_label, &nic_download_att); gui_label_set_localtion(&nic_download_label, 15, 51); gui_label_set_size(&nic_download_label, 55, 16); gui_label_set_font(&nic_download_label, &font1206); gui_label_set_text_offset(&nic_download_label, 0, 3); gui_label_set_text_by_string(&nic_download_label, " -.-K/s");
gui_label_init(&nic_upload_label, &nic_upload_att); gui_label_set_localtion(&nic_upload_label, 72, 51); gui_label_set_size(&nic_upload_label, 64, 16); gui_label_set_font(&nic_upload_label, &font1206); gui_label_set_text_offset(&nic_upload_label, 0, 3); gui_label_set_text_by_string(&nic_upload_label, " -.-K/s");
gui_container_init(&nic_cont, &nic_cont_att); gui_container_set_localtion(&nic_cont, 0, 51); gui_container_set_size(&nic_cont, 128, 12); gui_container_add_obj(&nic_cont, &nic_label); gui_container_add_obj(&nic_cont, &nic_download_label); gui_container_add_obj(&nic_cont, &nic_upload_label); gui_container_set_localtion(&nic_cont, 0, 64); gui_screen_layer_add_obj(&nic_cont, 1);
gui_anim_init(&nic_cont_anim); gui_anim_add(&nic_cont_anim); gui_anim_set_start(&nic_cont_anim, 75); gui_anim_set_end(&nic_cont_anim, 51); gui_anim_set_time(&nic_cont_anim, 500); gui_anim_set_path_cb(&nic_cont_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&nic_cont_anim, &nic_cont, gui_container_set_y);
gui_spectrum_init(&spectrum, &spectrum_att); gui_spectrum_set_localtion(&spectrum, 0, 0); gui_spectrum_set_size(&spectrum, 0, 64); gui_screen_layer_add_obj(&spectrum, 2);
gui_anim_init(&spectrum_anim); gui_anim_add(&spectrum_anim); gui_anim_set_start(&spectrum_anim, 128); gui_anim_set_end(&spectrum_anim, 0); gui_anim_set_time(&spectrum_anim, 500); gui_anim_set_path_cb(&spectrum_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&spectrum_anim, &spectrum, gui_anim_set_obj_x1_x2_cb);
gui_bitmap_init(&gif_frame1_bitmap, &gif_frame1_bitmap_att); gui_bitmap_set_localtion(&gif_frame1_bitmap, 0, 0); gui_bitmap_set_size(&gif_frame1_bitmap, 0, 64); gui_bitmap_set_bitmap(&gif_frame1_bitmap, gif_frame1_buffer, 128, 64); gui_screen_layer_add_obj(&gif_frame1_bitmap, 3);
gui_bitmap_init(&gif_frame2_bitmap, &gif_frame2_bitmap_att); gui_bitmap_set_localtion(&gif_frame2_bitmap, 0, 0); gui_bitmap_set_size(&gif_frame2_bitmap, 0, 64); gui_bitmap_set_bitmap(&gif_frame2_bitmap, gif_frame2_buffer, 128, 64); gui_obj_set_hide(&gif_frame2_bitmap, 1); gui_screen_layer_add_obj(&gif_frame2_bitmap, 3);
gui_anim_init(&gif_page_anim); gui_anim_add(&gif_page_anim); gui_anim_set_start(&gif_page_anim, 64); gui_anim_set_time(&gif_page_anim, 500); gui_anim_set_path_cb(&gif_page_anim, gui_anim_path_ease_in_out); gui_anim_set_control_obj(&gif_page_anim, NULL, gui_anim_set_gif_page_x1_x2_cb);
ret = rt_thread_init(&oled_draw_thread, "oled_draw", oled_draw_entry, RT_NULL, &oled_draw_thread_stack[0], sizeof(oled_draw_thread_stack), 4, 20); if (ret == RT_EOK) rt_thread_startup(&oled_draw_thread); }
|