Skip to content

Commit

Permalink
minor update [template][pico][oled]
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Dec 19, 2024
1 parent fa219c9 commit 326bf40
Show file tree
Hide file tree
Showing 15 changed files with 687 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3245,7 +3245,7 @@

<Group>
<GroupName>::Utilities</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
Expand Down
4 changes: 3 additions & 1 deletion examples/[template][pico][oled]/RTE/Acceleration/arm_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void __arm_2d_log_printf(int32_t nIndentLevel,
s_wLineNumber++;

/* start a new line */
__ARM_2D_PORT_PRINTF__("\r\n[%010" PRIu32 "]\t", s_wLineNumber);
__ARM_2D_PORT_PRINTF__("[%010" PRIu32 "]\t", s_wLineNumber);

for (int32_t n = 0; n < nIndentLevel; n++) {
__ARM_2D_PORT_PRINTF__("\t");
Expand Down Expand Up @@ -276,6 +276,8 @@ void __arm_2d_log_printf(int32_t nIndentLevel,
} else {
__ARM_2D_PORT_PRINTF__("[Insufficient memory for logging]%s", pchFormatString);
}

__ARM_2D_PORT_PRINTF__("\r\n");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ extern "C" {
| ARM_2D_LOG_CHN_DIRTY_REGION_OPTIMISATION \
| ARM_2D_LOG_CHN_STATISTICS \
| ARM_2D_LOG_CHN_CONTROLS \
| ARM_2D_LOG_CHN_GUI_STACK \
| ARM_2D_LOG_CHN_APP)
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void __on_scene_mono_clock_frame_complete(arm_2d_scene_t *ptScene)
user_scene_mono_clock_t *ptThis = (user_scene_mono_clock_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 1
#if 0
/* switch to next scene after 5s */
if (arm_2d_helper_is_time_out(5000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ static void __on_scene_mono_histogram_frame_complete(arm_2d_scene_t *ptScene)
user_scene_mono_histogram_t *ptThis = (user_scene_mono_histogram_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 1
#if 0
/* switch to next scene after 5s */
if (arm_2d_helper_is_time_out(13000, &this.lTimestamp[0])) {
if (arm_2d_helper_is_time_out(5000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,13 @@ static void __on_scene_mono_icon_menu_frame_start(arm_2d_scene_t *ptScene)
user_scene_mono_icon_menu_t *ptThis = (user_scene_mono_icon_menu_t *)ptScene;
ARM_2D_UNUSED(ptThis);

if (arm_2d_helper_is_time_out(1000, &this.lTimestamp[1])) {
if (arm_2d_helper_is_time_out(1000, &this.lTimestamp[0])) {

/* move list */
icon_list_move_selection(&this.tList, 1, 100);
icon_list_move_selection(&this.tList, 1, 200);
this.bRedrawLabel = true;
}


arm_2d_helper_dirty_region_item_suspend_update(
&this.tDirtyRegionItems[1],
!__arm_2d_list_core_is_list_moving(
&this.tList.use_as____simple_list_t.use_as____arm_2d_list_core_t));


icon_list_on_frame_start(&this.tList);

}
Expand All @@ -243,12 +237,6 @@ static void __on_scene_mono_icon_menu_frame_complete(arm_2d_scene_t *ptScene)
user_scene_mono_icon_menu_t *ptThis = (user_scene_mono_icon_menu_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 1
/* switch to next scene after 12s */
if (arm_2d_helper_is_time_out(12000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
}
#endif
}

static void __before_scene_mono_icon_menu_switching_out(arm_2d_scene_t *ptScene)
Expand All @@ -273,61 +261,11 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_mono_icon_menu_handler)
arm_2d_canvas(ptTile, __top_canvas) {


arm_2d_dock_vertical(__top_canvas, 56, 8) {

arm_2d_layout(__vertical_region) {

/* draw selection indicator */
__item_line_dock_vertical(3) {

uint16_t hwListCount = icon_list_get_list_item_count(&this.tList);
uint16_t hwSelectedID = icon_list_get_selected_item_id(&this.tList);

arm_2d_dock_vertical(__item_region, 1, 24, 24) {
arm_2d_fill_colour(ptTile, &__vertical_region, GLCD_COLOR_WHITE);

arm_2d_dock_vertical(__top_canvas, 64, 8) {

/* draw selection indicator */
do {
int16_t iBarWidth = __vertical_region.tSize.iWidth;
q16_t q16Step = div_n_q16(reinterpret_q16_s16(iBarWidth), hwListCount);
arm_2d_layout(__vertical_region, BOTTOM_UP) {

int16_t iIndicatorWidth = reinterpret_s16_q16(q16Step);
iIndicatorWidth = MAX(2, iIndicatorWidth);

arm_2d_region_t tIndicatorRegion = {
.tSize = {
.iHeight = 3,
.iWidth = iIndicatorWidth,
},
.tLocation = {
.iY = __vertical_region.tLocation.iY - 1,
.iX = __vertical_region.tLocation.iX
+ reinterpret_s16_q16(mul_n_q16(q16Step, hwSelectedID)),
},
};

arm_2d_fill_colour(ptTile, &tIndicatorRegion, GLCD_COLOR_WHITE);


/* update dirty region */
arm_2d_helper_dirty_region_update_item( &this.tDirtyRegionItems[1],
(arm_2d_tile_t *)ptTile,
&__item_region,
&tIndicatorRegion);

} while(0);
}
}

__item_line_dock_vertical(32, 0, 0, 4, 0) {
while(arm_fsm_rt_cpl != icon_list_show( &this.tList,
ptTile,
&__item_region,
bIsNewFrame));
}

__item_line_dock_vertical(10, 0, 0, 4, 0) {
__item_line_dock_vertical(10, 0, 0, 0, 4) {

do {
if (__arm_2d_list_core_is_list_moving(
Expand All @@ -351,15 +289,32 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_mono_icon_menu_handler)
icon_list_get_selected_item_id(&this.tList)]);


/* update dirty region */
arm_2d_helper_dirty_region_update_item(
&this.tDirtyRegionItems[0],
(arm_2d_tile_t *)ptTile,
&__item_region,
arm_lcd_text_get_last_display_region());

if (this.bRedrawLabel) {
this.bRedrawLabel = false;

/* update dirty region */
arm_2d_helper_dirty_region_update_item(
&this.tDirtyRegionItems[0],
(arm_2d_tile_t *)ptTile,
&__item_region,
arm_lcd_text_get_last_display_region());
}
} while(0);
}

__item_line_dock_vertical(0, 0, 4, 0) {

while(arm_fsm_rt_cpl != icon_list_show( &this.tList,
ptTile,
&__item_region,
bIsNewFrame));

arm_2d_align_centre(__item_region, 32, 32) {
arm_2d_filter_reverse_colour(ptTile, &__centre_region);
}
}


}
}

Expand Down Expand Up @@ -397,21 +352,10 @@ arm_fsm_rt_t __arm_2d_icon_list_draw_list_core_item(

arm_2d_align_centre(__item_canvas, ptileIcon->tRegion.tSize) {

if (ptParam->bIsSelected) {
arm_2d_fill_colour(ptTile, &__item_canvas, GLCD_COLOR_WHITE);
//draw_round_corner_box(ptTile, &__item_canvas, GLCD_COLOR_WHITE, 255, bIsNewFrame);
//arm_2d_draw_box(ptTile, &__item_canvas, 1, GLCD_COLOR_WHITE, 255);

arm_2d_fill_colour_with_a1_mask(ptTile,
&__centre_region,
ptileIcon,
(__arm_2d_color_t){GLCD_COLOR_BLACK});
} else {
arm_2d_fill_colour_with_a1_mask(ptTile,
&__centre_region,
ptileIcon,
(__arm_2d_color_t){GLCD_COLOR_WHITE});
}
arm_2d_fill_colour_with_a1_mask(ptTile,
&__centre_region,
ptileIcon,
(__arm_2d_color_t){GLCD_COLOR_WHITE});

}

Expand Down Expand Up @@ -488,7 +432,14 @@ user_scene_mono_icon_menu_t *__arm_2d_scene_mono_icon_menu_init( arm_2d_scene_

.tFontColour = GLCD_COLOR_WHITE,
.tBackgroundColour = GLCD_COLOR_BLACK,
.bIgnoreBackground = true,
//.bIgnoreBackground = true,

.bUseMonochromeMode = true,
.bShowScrollingBar = true,
.chScrollingBarAutoDisappearTimeX100Ms = 10,
.ScrollingBar.tColour = GLCD_COLOR_WHITE,
.bPlaceScrollingBarOnTopOrLeft = true,
//.bUsePIMode = true,

//.bDisableRingMode = true, /* you can disable the list ring mode here */

Expand All @@ -505,9 +456,6 @@ user_scene_mono_icon_menu_t *__arm_2d_scene_mono_icon_menu_init( arm_2d_scene_
.tTextAlignment = ARM_2D_ALIGN_MIDDLE_LEFT,
.fnOnDrawListItem = &__arm_2d_icon_list_draw_list_core_item,

/* draw list cover */
//.fnOnDrawListCover = &__arm_2d_list_draw_cover,

.bUseDirtyRegion = true,
.ptTargetScene = &this.use_as__arm_2d_scene_t,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ struct user_scene_mono_icon_menu_t {

ARM_PRIVATE(
/* place your private member here, following two are examples */
int64_t lTimestamp[2];
bool bUserAllocated;
int64_t lTimestamp[1];
uint8_t bUserAllocated : 1;
uint8_t bRedrawLabel : 1;

icon_list_t tList;
arm_2d_helper_dirty_region_item_t tDirtyRegionItems[2];
arm_2d_helper_dirty_region_item_t tDirtyRegionItems[1];
)
/* place your public member here */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void __on_scene_mono_list_frame_complete(arm_2d_scene_t *ptScene)
user_scene_mono_list_t *ptThis = (user_scene_mono_list_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 1
#if 0
/* switch to next scene after 7s */
if (arm_2d_helper_is_time_out(7000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static void __on_scene_mono_loading_frame_complete(arm_2d_scene_t *ptScene)
user_scene_mono_loading_t *ptThis = (user_scene_mono_loading_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 1
#if 0
/* switch to next scene after 13s */
if (arm_2d_helper_is_time_out(13000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
Expand Down
Loading

0 comments on commit 326bf40

Please sign in to comment.