Skip to content

Commit cac4209

Browse files
committed
GUI: fix hardfault of 410_502 demo
Change-Id: I0ddd0737a14be89c07978bfc380a857480c66244
1 parent 48b7997 commit cac4209

47 files changed

Lines changed: 162 additions & 997 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

example/application/screen_410_502/app_3d_applist.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,7 @@ static void applist_app(gui_view_t *view);
4343
* Variables
4444
*============================================================================*/
4545
/* View Management */
46-
static gui_view_t *current_view = NULL;
47-
48-
49-
static gui_view_descriptor_t const descriptor =
50-
{
51-
/* change Here for current view */
52-
.name = (const char *)CURRENT_VIEW_NAME,
53-
.pView = &current_view,
54-
.on_switch_in = applist_app,
55-
};
46+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, applist_app, NULL);
5647

5748
/* 3D Applications List */
5849
static gui_lite3d_t *app_3d_list[APP_NUM]; // Static array
@@ -83,15 +74,6 @@ static float click_on_shift_z = 0.0f;
8374
/*============================================================================*
8475
* Private Functions
8576
*============================================================================*/
86-
static int gui_view_descriptor_register_init(void)
87-
{
88-
gui_view_descriptor_register(&descriptor);
89-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
90-
return 0;
91-
}
92-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
93-
94-
9577
static void update_applist_animation(void *param)
9678
{
9779
(void)param;

example/application/screen_410_502/app_3d_butterfly.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,7 @@ static void butterfly_app(gui_view_t *view);
3333
* Variables
3434
*============================================================================*/
3535
/* View Management */
36-
static gui_view_t *current_view = NULL;
37-
38-
39-
static gui_view_descriptor_t const descriptor =
40-
{
41-
/* change Here for current view */
42-
.name = (const char *)CURRENT_VIEW_NAME,
43-
.pView = &current_view,
44-
.on_switch_in = butterfly_app,
45-
};
36+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, butterfly_app, NULL);
4637

4738
/* Animation Variables */
4839
static float wing_angle = 0.0f;
@@ -64,15 +55,6 @@ static float flight_progress = 1.0f;
6455
/*============================================================================*
6556
* Private Functions
6657
*============================================================================*/
67-
static int gui_view_descriptor_register_init(void)
68-
{
69-
gui_view_descriptor_register(&descriptor);
70-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
71-
return 0;
72-
}
73-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
74-
75-
7658
static void update_animation(void *param)
7759
{
7860
touch_info_t *tp = tp_get_info();

example/application/screen_410_502/app_3d_butterfly_particles.c

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,7 @@ static void free_particles_resources(gui_view_t *view);
5858
* Variables
5959
*============================================================================*/
6060
/* View Management */
61-
static gui_view_t *current_view = NULL;
62-
63-
static gui_view_descriptor_t const descriptor =
64-
{
65-
/* change Here for current view */
66-
.name = (const char *)CURRENT_VIEW_NAME,
67-
.pView = &current_view,
68-
.on_switch_in = butterfly_particle_app,
69-
.on_switch_out = free_particles_resources,
70-
};
61+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, butterfly_particle_app, free_particles_resources);
7162

7263
/* Butterfly Design */
7364
gui_img_t *butterfly_wing1 = NULL;
@@ -109,15 +100,6 @@ static char date_text_content[10];
109100
/*============================================================================*
110101
* Private Functions
111102
*============================================================================*/
112-
static int gui_view_descriptor_register_init(void)
113-
{
114-
gui_view_descriptor_register(&descriptor);
115-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
116-
return 0;
117-
}
118-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
119-
120-
121103
static int x_to_screen_w(float butterfly_x)
122104
{
123105
float a = 30.0f; //left fish's max x (most left)
@@ -483,23 +465,23 @@ static void time_update_cb(void *p)
483465

484466
extern struct tm *timeinfo;
485467
#endif
486-
GUI_WIDGET_POINTER_BY_NAME_ROOT(text, "date_text", current_view);
468+
GUI_WIDGET_POINTER_BY_NAME_ROOT(text, "date_text", gui_view_get_current());
487469
sprintf(date_text_content, "%s %d", day[timeinfo->tm_wday], timeinfo->tm_mday);
488470
gui_text_content_set((gui_text_t *)text, date_text_content, strlen(date_text_content));
489471

490-
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_hour_decimal, "watch_hour_decimal", current_view);
472+
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_hour_decimal, "watch_hour_decimal", gui_view_get_current());
491473
gui_img_set_src((gui_img_t *)img_hour_decimal, text_num_array[timeinfo->tm_hour / 10],
492474
((gui_img_t *)img_hour_decimal)->storage_type);
493475

494-
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_hour_single, "watch_hour_single", current_view);
476+
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_hour_single, "watch_hour_single", gui_view_get_current());
495477
gui_img_set_src((gui_img_t *)img_hour_single, text_num_array[timeinfo->tm_hour % 10],
496478
((gui_img_t *)img_hour_single)->storage_type);
497479

498-
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_minute_decimal, "watch_minute_decimal", current_view);
480+
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_minute_decimal, "watch_minute_decimal", gui_view_get_current());
499481
gui_img_set_src((gui_img_t *)img_minute_decimal,
500482
text_num_array[timeinfo->tm_min / 10], ((gui_img_t *)img_minute_decimal)->storage_type);
501483

502-
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_minute_single, "watch_minute_single", current_view);
484+
GUI_WIDGET_POINTER_BY_NAME_ROOT(img_minute_single, "watch_minute_single", gui_view_get_current());
503485
gui_img_set_src((gui_img_t *)img_minute_single, text_num_array[timeinfo->tm_min % 10],
504486
((gui_img_t *)img_minute_single)->storage_type);
505487
}

example/application/screen_410_502/app_3d_butterflys.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,7 @@ static void update_butterfly_wing_bg(gui_lite3d_t *lite3d_butterfly, gui_win_t *
6060
* Variables
6161
*============================================================================*/
6262
/* View Management */
63-
static gui_view_t *current_view = NULL;
64-
65-
static const gui_view_descriptor_t descriptor =
66-
{
67-
/* change Here for current view */
68-
.name = (const char *)CURRENT_VIEW_NAME,
69-
.pView = &current_view,
70-
71-
.on_switch_in = app_ui_butterflys_design,
72-
.on_switch_out = free_particles_resources,
73-
74-
.keep = false,
75-
};
63+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, app_ui_butterflys_design, free_particles_resources);
7664

7765
/* Particle Window */
7866
static gui_win_t *butterfly_win[BUTTERFLY_COUNT] = {NULL};
@@ -91,18 +79,9 @@ static uint32_t last_particle_spawn = 0;
9179
/*============================================================================*
9280
* Private Functions
9381
*============================================================================*/
94-
static int gui_view_descriptor_register_init(void)
95-
{
96-
gui_view_descriptor_register(&descriptor);
97-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
98-
return 0;
99-
}
100-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
101-
102-
10382
static void return_to_menu(void)
10483
{
105-
gui_view_switch_direct(current_view, "menu_view", SWITCH_OUT_ANIMATION_FADE,
84+
gui_view_switch_direct(gui_view_get_current(), "menu_view", SWITCH_OUT_ANIMATION_FADE,
10685
SWITCH_IN_ANIMATION_FADE);
10786
}
10887

example/application/screen_410_502/app_3d_digital_clock.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,7 @@ static void digital_clock_app(gui_view_t *view);
3131
* Variables
3232
*============================================================================*/
3333
/* View Management */
34-
static gui_view_t *current_view = NULL;
35-
36-
37-
static gui_view_descriptor_t const descriptor =
38-
{
39-
/* change Here for current view */
40-
.name = (const char *)CURRENT_VIEW_NAME,
41-
.pView = &current_view,
42-
.on_switch_in = digital_clock_app,
43-
};
34+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, digital_clock_app, NULL);
4435

4536
/* 3D Digital Clock */
4637
static uint8_t *clock_fig_bin[10] = {0};
@@ -63,15 +54,6 @@ static float last_time = 0.0f;
6354
/*============================================================================*
6455
* Private Functions
6556
*============================================================================*/
66-
static int gui_view_descriptor_register_init(void)
67-
{
68-
gui_view_descriptor_register(&descriptor);
69-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
70-
return 0;
71-
}
72-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
73-
74-
7557
static void update_digital_clock_animation(void *param)
7658
{
7759
gui_lite3d_t *this = (gui_lite3d_t *)param;

example/application/screen_410_502/app_3d_disc.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,7 @@ static void disc_app(gui_view_t *view);
3636
* Variables
3737
*============================================================================*/
3838
/* View Management */
39-
static gui_view_t *current_view = NULL;
40-
41-
42-
static gui_view_descriptor_t const descriptor =
43-
{
44-
/* change Here for current view */
45-
.name = (const char *)CURRENT_VIEW_NAME,
46-
.pView = &current_view,
47-
.on_switch_in = disc_app,
48-
};
39+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, disc_app, NULL);
4940

5041
/* Animation Variables */
5142
static float rot_x_angle = 0.0f;
@@ -61,15 +52,6 @@ static bool is_playing = false;
6152
/*============================================================================*
6253
* Private Functions
6354
*============================================================================*/
64-
static int gui_view_descriptor_register_init(void)
65-
{
66-
gui_view_descriptor_register(&descriptor);
67-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
68-
return 0;
69-
}
70-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
71-
72-
7355
static void update_disc_animation(void *param)
7456
{
7557
(void)param;

example/application/screen_410_502/app_3d_earth.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,7 @@ static void earth_app(gui_view_t *view);
3232
* Variables
3333
*============================================================================*/
3434
/* View Management */
35-
static gui_view_t *current_view = NULL;
36-
37-
static gui_view_descriptor_t const descriptor =
38-
{
39-
/* change Here for current view */
40-
.name = (const char *)CURRENT_VIEW_NAME,
41-
.pView = &current_view,
42-
.on_switch_in = earth_app,
43-
};
35+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, earth_app, NULL);
4436

4537
/* Animation Variables */
4638
static float rot_x_angle = 0.0f;
@@ -49,15 +41,6 @@ static float rot_y_angle = 0.0f;
4941
/*============================================================================*
5042
* Private Functions
5143
*============================================================================*/
52-
static int gui_view_descriptor_register_init(void)
53-
{
54-
gui_view_descriptor_register(&descriptor);
55-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
56-
return 0;
57-
}
58-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
59-
60-
6144

6245
static void update_earth_animation(void *param)
6346
{

example/application/screen_410_502/app_3d_face.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,14 @@ static void face_app(gui_view_t *view);
3333
* Variables
3434
*============================================================================*/
3535
/* View Management */
36-
static gui_view_t *current_view = NULL;
37-
38-
static gui_view_descriptor_t const descriptor =
39-
{
40-
/* change Here for current view */
41-
.name = (const char *)CURRENT_VIEW_NAME,
42-
.pView = &current_view,
43-
.on_switch_in = face_app,
44-
};
36+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, face_app, NULL);
4537

4638
/* Animation Variables */
4739
static float rot_angle = 5.0f;
4840

4941
/*============================================================================*
5042
* Private Functions
5143
*============================================================================*/
52-
static int gui_view_descriptor_register_init(void)
53-
{
54-
gui_view_descriptor_register(&descriptor);
55-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
56-
return 0;
57-
}
58-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
59-
60-
6144

6245
static void update_face_animation(void *param)
6346
{

example/application/screen_410_502/app_3d_flag.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,14 @@ static void flag_app(gui_view_t *view);
3232
* Variables
3333
*============================================================================*/
3434
/* View Management */
35-
static gui_view_t *current_view = NULL;
36-
37-
static gui_view_descriptor_t const descriptor =
38-
{
39-
/* change Here for current view */
40-
.name = (const char *)CURRENT_VIEW_NAME,
41-
.pView = &current_view,
42-
.on_switch_in = flag_app,
43-
};
35+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, flag_app, NULL);
4436

4537
/* Animation Variables */
4638
static float rot_angle = 0.0f;
4739

4840
/*============================================================================*
4941
* Private Functions
5042
*============================================================================*/
51-
static int gui_view_descriptor_register_init(void)
52-
{
53-
gui_view_descriptor_register(&descriptor);
54-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
55-
return 0;
56-
}
57-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
58-
59-
6043
static void update_flag_animation(void *param)
6144
{
6245
(void)param;

example/application/screen_410_502/app_3d_koiClock.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,7 @@ static void app_ui_koiclock_design(gui_view_t *view);
5151
* Variables
5252
*============================================================================*/
5353

54-
static gui_view_t *current_view = NULL;
55-
56-
static const gui_view_descriptor_t descriptor =
57-
{
58-
/* change Here for current view */
59-
.name = (const char *)CURRENT_VIEW_NAME,
60-
.pView = &current_view,
61-
62-
.on_switch_in = app_ui_koiclock_design,
63-
.on_switch_out = NULL,
64-
65-
.keep = false,
66-
};
54+
GUI_VIEW_INSTANCE(CURRENT_VIEW_NAME, false, app_ui_koiclock_design, NULL);
6755

6856
/* Fish Position*/
6957
static Fish_Pos fish_pos[FISH_COUNT];
@@ -82,15 +70,6 @@ static float wave_opa = 255.0f;
8270
/*============================================================================*
8371
* Private Functions
8472
*============================================================================*/
85-
static int gui_view_descriptor_register_init(void)
86-
{
87-
gui_view_descriptor_register(&descriptor);
88-
gui_log("File: %s, Function: %s\n", __FILE__, __func__);
89-
return 0;
90-
}
91-
static GUI_INIT_VIEW_DESCRIPTOR_REGISTER(gui_view_descriptor_register_init);
92-
93-
9473
static void fish_pos_init(void)
9574
{
9675
const float initial_angles[FISH_COUNT] = {0, 45, 240};

0 commit comments

Comments
 (0)