Skip to content

Commit

Permalink
fix bare-metal template
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Dec 4, 2024
1 parent cd2e2eb commit 621b173
Show file tree
Hide file tree
Showing 48 changed files with 7,372 additions and 432 deletions.
1 change: 1 addition & 0 deletions examples/[template][bare-metal]/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "arm_2d_scene_fan.h"
#include "arm_2d_scene_bubble_charging.h"
#include "arm_2d_scene_animate_background.h"
#include "arm_2d_scene_knob.h"

#include "arm_2d_demos.h"

Expand Down

Large diffs are not rendered by default.

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 @@ -63,13 +63,13 @@ extern "C" {
// <i> Note that enabling this feature will add the support for a special colour type: ARM_2D_CHANNEL_8in32
// <i> This feature is disabled by default to save code size
#ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 1
# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 0
#endif

// <q>Enable ccca8888(ARGB8888) implicit conversion
// <i> This feature is disabled by default to save code size
#ifndef __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__
# define __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 1
# define __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 0
#endif

// <q>Improve the Quality of IIR Blur
Expand Down 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 Expand Up @@ -180,7 +181,7 @@ extern "C" {
// <32=> 32Bits
// <i> The colour depth of your LCD
// <i> Default: 16
# define __GLCD_CFG_COLOUR_DEPTH__ 16
# define __GLCD_CFG_COLOUR_DEPTH__ 8
#endif

// <o> The size of the LCD printf text buffer <16-65535>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ IMPL_PFB_ON_DRAW(__pfb_draw_handler)
ARM_2D_PARAM(ptTile);

arm_2d_canvas(ptTile, __top_container) {


#if __DISP0_CFG_COLOR_SOLUTION__ != 1 /* as long as it is not monochrome */
arm_2d_align_centre(__top_container, 100, 100) {
draw_round_corner_box( ptTile,
&__centre_region,
GLCD_COLOR_BLACK,
64,
bIsNewFrame);
}
#endif

busy_wheel2_show(ptTile, bIsNewFrame);
}
Expand Down Expand Up @@ -338,7 +340,7 @@ IMPL_PFB_ON_DRAW(__disp_adapter0_draw_navigation)
#else
arm_lcd_printf(
"LCD:%2"PRIu32"ms",
(uint_fast64_t)arm_2d_helper_convert_ticks_to_ms(DISP0_ADAPTER.Benchmark.wLCDLatency) );
(uint32_t)arm_2d_helper_convert_ticks_to_ms(DISP0_ADAPTER.Benchmark.wLCDLatency) );
#endif
}

Expand Down Expand Up @@ -912,9 +914,14 @@ void disp_adapter0_init(void)
static arm_2d_scene_t s_tScenes[] = {
[0] = {

#if __DISP0_CFG_COLOR_SOLUTION__ == 1
/* the canvas colour */
.tCanvas = {GLCD_COLOR_BLACK},
#else
/* the canvas colour */
.tCanvas = {GLCD_COLOR_WHITE},

#endif

.fnScene = &__pfb_draw_handler,
//.ptDirtyRegion = (arm_2d_region_list_item_t *)s_tDirtyRegions,
.fnOnFrameStart = &__on_frame_start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,21 @@ extern "C" {
// <h>Screen and Framebuffer
// =======================

// <o> Select the screen colour solution
// <0=> None
// <1=> Monochrome
// <i> When specifying a colour solution, the __DISP0_CFG_COLOUR_DEPTH__ and other corresponding options will be configured (overriden) accordingly.
#ifndef __DISP0_CFG_COLOR_SOLUTION__
# define __DISP0_CFG_COLOR_SOLUTION__ 0
#endif

// <o> Select the screen colour depth
// <8=> 8 Bits
// <16=> 16Bits
// <32=> 32Bits
// <i> The colour depth of your screen
#ifndef __DISP0_CFG_COLOUR_DEPTH__
# define __DISP0_CFG_COLOUR_DEPTH__ 16
# define __DISP0_CFG_COLOUR_DEPTH__ 8
#endif

// <o>Width of the screen <8-32767>
Expand Down Expand Up @@ -250,6 +258,12 @@ extern "C" {

// <<< end of configuration section >>>

#if __DISP0_CFG_COLOR_SOLUTION__ == 1
/* the colour solution for monochrome screen */
# undef __DISP0_CFG_COLOUR_DEPTH__
# define __DISP0_CFG_COLOUR_DEPTH__ 8
#endif

#ifndef __DISP0_COLOUR_FORMAT__
# if __DISP0_CFG_COLOUR_DEPTH__ == 8
# define __DISP0_COLOUR_FORMAT__ ARM_2D_COLOUR_GRAY8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,12 @@ static void __on_scene_atom_frame_complete(arm_2d_scene_t *ptScene)
user_scene_atom_t *ptThis = (user_scene_atom_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#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);
}
#endif
}

static void __before_scene_atom_switching_out(arm_2d_scene_t *ptScene)
Expand Down Expand Up @@ -246,7 +248,7 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_atom_handler)
/* draw atom core */
arm_2d_align_centre(__top_canvas, tAtomCoreSize) {

arm_2d_layout(__centre_region, true) {
arm_2d_layout(__centre_region, DEFAULT, true) {

__item_line_dock_vertical(c_tileWhiteDotMiddleA4Mask.tRegion.tSize.iHeight * 2) {

Expand All @@ -258,7 +260,7 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_atom_handler)
tDirtyRegion.tSize.iHeight += tCharSize.iHeight;

/* update dirty region */
arm_2d_helper_dirty_region_update_item(&this.use_as__arm_2d_scene_t.tDirtyRegionHelper.tDefaultItem,
arm_2d_helper_dirty_region_update_item( &this.use_as__arm_2d_scene_t.tDirtyRegionHelper.tDefaultItem,
(arm_2d_tile_t *)ptTile,
&__top_canvas,
&tDirtyRegion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
# pragma clang diagnostic ignored "-Wgnu-statement-expression"
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
# pragma clang diagnostic ignored "-Wunused-function"
# pragma clang diagnostic ignored "-Wmissing-declarations"
# pragma clang diagnostic ignored "-Wsign-compare"
# pragma clang diagnostic ignored "-Wunreachable-code-break"
# pragma clang diagnostic ignored "-Wmissing-declarations"
#elif __IS_COMPILER_ARM_COMPILER_5__
# pragma diag_suppress 64,177
#elif __IS_COMPILER_IAR__
Expand Down Expand Up @@ -211,11 +209,13 @@ static void __on_scene_audiomark_frame_complete(arm_2d_scene_t *ptScene)
{
user_scene_audiomark_t *ptThis = (user_scene_audiomark_t *)ptScene;
ARM_2D_UNUSED(ptThis);


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

static void __before_scene_audiomark_switching_out(arm_2d_scene_t *ptScene)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ extern "C" {
# pragma clang diagnostic ignored "-Wunknown-warning-option"
# pragma clang diagnostic ignored "-Wreserved-identifier"
# pragma clang diagnostic ignored "-Wmissing-declarations"
# pragma clang diagnostic ignored "-Wpadded"
# pragma clang diagnostic ignored "-Wembedded-directive"
# pragma clang diagnostic ignored "-Wpadded"
#elif __IS_COMPILER_ARM_COMPILER_5__
#elif __IS_COMPILER_GCC__
# pragma GCC diagnostic push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ static void __on_scene_basics_frame_complete(arm_2d_scene_t *ptScene)
{
user_scene_basics_t *ptThis = (user_scene_basics_t *)ptScene;
ARM_2D_UNUSED(ptThis);


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

static void __before_scene_basics_switching_out(arm_2d_scene_t *ptScene)
Expand Down Expand Up @@ -189,7 +191,7 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_basics_handler)
#endif

arm_2d_align_centre(__top_canvas, 240, 120 ) {
arm_2d_layout(__centre_region, true) {
arm_2d_layout(__centre_region, DEFAULT, true) {

__item_line_dock_vertical(c_tileCMSISLogoA4Mask.tRegion.tSize.iHeight, 0, 0, 0, 5) {
draw_round_corner_box( ptTile,
Expand Down Expand Up @@ -240,7 +242,7 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_basics_handler)
arm_2d_fill_colour_with_4pts_alpha_gradient_mask_and_opacity(
ptTile,
&__centre_region,
&c_tileCMSISLogoMask2,
&c_tileCMSISLogoMask,
(__arm_2d_color_t){GLCD_COLOR_BLUE},
255,
(arm_2d_alpha_samples_4pts_t) {
Expand Down Expand Up @@ -302,7 +304,6 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_basics_handler)
arm_lcd_printf("%d", n);
}
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ extern "C" {
# pragma clang diagnostic ignored "-Wreserved-identifier"
# pragma clang diagnostic ignored "-Wmissing-declarations"
# pragma clang diagnostic ignored "-Wpadded"
#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
# pragma diag_suppress 1296,174,64,177,1
#elif __IS_COMPILER_ARM_COMPILER_5__
#elif __IS_COMPILER_GCC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions, static)
ADD_LAST_REGION_TO_LIST(s_tDirtyRegions,
0
),



END_IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions)


/*============================ IMPLEMENTATION ================================*/

static void __on_scene_compass_load(arm_2d_scene_t *ptScene)
Expand Down Expand Up @@ -245,8 +243,11 @@ static void __on_scene_compass_frame_start(arm_2d_scene_t *ptScene)
iCurrentAngle -= 3600;
}

#if 0
arm_2d_dirty_region_item_ignore_set(&s_tDirtyRegions[COMPASS_DIRTY_REGION_TEXT],
(iCurrentAngle == this.iDisplayAngle));
#endif

this.iDisplayAngle = iCurrentAngle;

meter_pointer_on_frame_start(&this.tCompass, this.iTargetAngle, 1.0f);
Expand All @@ -260,10 +261,12 @@ static void __on_scene_compass_frame_complete(arm_2d_scene_t *ptScene)

meter_pointer_on_frame_complete(&this.tCompass);

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

static void __before_scene_compass_switching_out(arm_2d_scene_t *ptScene)
Expand Down Expand Up @@ -295,7 +298,6 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_compass_handler)

arm_2d_align_centre(__top_canvas, c_tileCompass.tRegion.tSize) {
meter_pointer_show(&this.tCompass, ptTile, &__centre_region, NULL, 255);

}

/* draw 3 digits numbers */
Expand Down Expand Up @@ -342,6 +344,7 @@ user_scene_compass_t *__arm_2d_scene_compass_init( arm_2d_scene_player_t *ptDis

s_tDirtyRegions[dimof(s_tDirtyRegions)-1].ptNext = NULL;

#if 0
/* get the screen region */
arm_2d_region_t tScreen
= arm_2d_helper_pfb_get_display_area(
Expand Down Expand Up @@ -394,6 +397,7 @@ user_scene_compass_t *__arm_2d_scene_compass_init( arm_2d_scene_player_t *ptDis
}

}
#endif

if (NULL == ptThis) {
ptThis = (user_scene_compass_t *)
Expand Down Expand Up @@ -423,7 +427,7 @@ user_scene_compass_t *__arm_2d_scene_compass_init( arm_2d_scene_player_t *ptDis
//.fnAfterSwitch = &__after_scene_compass_switching,

/* if you want to use predefined dirty region list, please uncomment the following code */
.ptDirtyRegion = (arm_2d_region_list_item_t *)s_tDirtyRegions,
//.ptDirtyRegion = (arm_2d_region_list_item_t *)s_tDirtyRegions,


//.fnOnBGStart = &__on_scene_compass_background_start,
Expand All @@ -433,7 +437,7 @@ user_scene_compass_t *__arm_2d_scene_compass_init( arm_2d_scene_player_t *ptDis
.fnOnFrameCPL = &__on_scene_compass_frame_complete,
.fnDepose = &__on_scene_compass_depose,

.bUseDirtyRegionHelper = false,
.bUseDirtyRegionHelper = true,
},
.bUserAllocated = bUserAllocated,
};
Expand Down Expand Up @@ -472,6 +476,8 @@ user_scene_compass_t *__arm_2d_scene_compass_init( arm_2d_scene_player_t *ptDis
};

meter_pointer_init(&this.tCompass, &tCFG);

this.iTargetAngle = 1800;
} while(0);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ static void __on_scene_console_window_frame_complete(arm_2d_scene_t *ptScene)
user_scene_console_window_t *ptThis = (user_scene_console_window_t *)ptScene;
ARM_2D_UNUSED(ptThis);

#if 0
if (arm_2d_helper_is_time_out(10000, &this.lTimestamp[0])) {
arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer);
}

#endif
}

static void __before_scene_console_window_switching_out(arm_2d_scene_t *ptScene)
Expand Down
Loading

0 comments on commit 621b173

Please sign in to comment.