Skip to content

Commit

Permalink
move PIMode to __simple_lsit_t
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Dec 1, 2024
1 parent cf627d3 commit 2dd8a24
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 33 deletions.
21 changes: 17 additions & 4 deletions Helper/Source/arm_2d_helper_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@

/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ PROTOTYPES ====================================*/

static
arm_2d_err_t __arm_2d_list_core_move_selection( __arm_2d_list_core_t *ptThis,
int16_t iSteps,
int32_t nFinishInMs);
/*============================ LOCAL VARIABLES ===============================*/
static const arm_2d_helper_pi_slider_cfg_t c_tDefaultPICFG = {
.fProportion = 0.030f,
.fIntegration = 0.0115f,
.nInterval = 5,
};

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

__STATIC_INLINE
Expand Down Expand Up @@ -134,9 +140,16 @@ arm_2d_err_t __arm_2d_list_core_init( __arm_2d_list_core_t *ptThis,

/* PI slider selection indicator */
if (this.tCFG.bUsePISliderForSelectionIndicator) {
arm_2d_helper_pi_slider_init( &this.Runtime.tPISlider,
this.tCFG.ptPISliderCFG,
0);
if (NULL == this.tCFG.ptPISliderCFG) {
arm_2d_helper_pi_slider_init( &this.Runtime.tPISlider,
(arm_2d_helper_pi_slider_cfg_t *)&c_tDefaultPICFG,
0);

} else {
arm_2d_helper_pi_slider_init( &this.Runtime.tPISlider,
this.tCFG.ptPISliderCFG,
0);
}
}

this.bListSizeChanged = true;
Expand Down
2 changes: 1 addition & 1 deletion examples/common/controls/__simple_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ arm_2d_err_t __simple_list_init(__simple_list_t *ptThis,
.bDisableRingMode = ptCFG->bDisableRingMode,

.ptPISliderCFG = ptCFG->ptPISliderCFG,
.bUsePISliderForSelectionIndicator = (ptCFG->ptPISliderCFG != NULL),
.bUsePISliderForSelectionIndicator = ptCFG->bUsePIMode,
};

/* you can override the default implementations */
Expand Down
3 changes: 2 additions & 1 deletion examples/common/controls/__simple_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ typedef struct __simple_list_cfg_t {
uint8_t bIgnoreBackground : 1;
uint8_t bUseDirtyRegion : 1;
uint8_t bDisableRingMode : 1;
uint8_t bUsePIMode : 1;
uint8_t bUseMonochromeMode : 1;
uint8_t bShowScrollingBar : 1;
uint8_t bPlaceScrollingBarOnTopOrLeft : 1;
uint8_t : 2;
uint8_t : 1;

/*! \note 0 means always-on. The unit is 100ms */
uint8_t chScrollingBarAutoDisappearTimeX100Ms;
Expand Down
21 changes: 0 additions & 21 deletions examples/common/controls/text_tracking_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ static
IMPL_PFB_ON_DRAW(__arm_2d_text_tracking_list_draw_background);

/*============================ LOCAL VARIABLES ===============================*/
static const arm_2d_helper_pi_slider_cfg_t c_tDefaultPICFG = {
.fProportion = 0.030f,
.fIntegration = 0.0115f,
.nInterval = 5,
};

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

#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
Expand Down Expand Up @@ -119,21 +113,6 @@ arm_2d_err_t __text_tracking_list_init(
&__arm_2d_text_tracking_list_draw_background);
}

/* config the PI mode */
if (this.tSettings.bUsePIMode
&& (NULL == ptCFG->use_as__text_list_cfg_t.use_as____simple_list_cfg_t.ptPISliderCFG)) {
__arm_2d_list_core_indicator_pi_mode_config(
&this.use_as__text_list_t.use_as____simple_list_t.use_as____arm_2d_list_core_t,
this.tSettings.bUsePIMode,
(arm_2d_helper_pi_slider_cfg_t *)&c_tDefaultPICFG
);
} else {
__arm_2d_list_core_indicator_pi_mode_config(
&this.use_as__text_list_t.use_as____simple_list_t.use_as____arm_2d_list_core_t,
this.tSettings.bUsePIMode,
NULL
);
}

if (0 == ( ARM_2D_ALIGN_LEFT
& ptCFG->use_as__text_list_cfg_t
Expand Down
5 changes: 1 addition & 4 deletions examples/common/controls/text_tracking_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ typedef char * __disp_string_t ;

typedef struct text_tracking_list_setting_t {

uint8_t bUsePIMode : 1;

/*! \note Auto Size mode only works with text left alignment */
uint8_t bIndicatorAutoSize : 1;
uint8_t : 6;
Expand All @@ -85,11 +83,10 @@ typedef struct text_tracking_list_cfg_t {
/* please ensure the anonymous structure is identical to tSettings */
text_tracking_list_setting_t tSettings;
struct {
uint8_t bUsePIMode : 1;

/*! \note Auto Size mode only works with text left alignment */
uint8_t bIndicatorAutoSize : 1;
uint8_t : 6;
uint8_t : 7;

union {
uint8_t chValue;
Expand Down
3 changes: 2 additions & 1 deletion examples/demos/monochrome/arm_2d_scene_mono_icon_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void __on_scene_mono_icon_menu_frame_start(arm_2d_scene_t *ptScene)
if (arm_2d_helper_is_time_out(1000, &this.lTimestamp[1])) {

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


Expand Down Expand Up @@ -448,6 +448,7 @@ user_scene_mono_icon_menu_t *__arm_2d_scene_mono_icon_menu_init( arm_2d_scene_
.chScrollingBarAutoDisappearTimeX100Ms = 10,
.ScrollingBar.tColour = GLCD_COLOR_WHITE,
.bPlaceScrollingBarOnTopOrLeft = true,
//.bUsePIMode = true,

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

Expand Down
4 changes: 3 additions & 1 deletion examples/demos/monochrome/arm_2d_scene_mono_tracking_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ user_scene_mono_tracking_list_t *__arm_2d_scene_mono_tracking_list_init(

text_tracking_list_cfg_t tCFG = {
//.tSettings = {
.bUsePIMode = true,

.bIndicatorAutoSize = true,
.IndicatorColour.tValue = GLCD_COLOR_WHITE,

Expand All @@ -345,6 +345,8 @@ user_scene_mono_tracking_list_t *__arm_2d_scene_mono_tracking_list_init(
.bShowScrollingBar = true,
.chScrollingBarAutoDisappearTimeX100Ms = 10,
.ScrollingBar.tColour = GLCD_COLOR_WHITE,
.bUsePIMode = true,


//.bIgnoreBackground = true,

Expand Down

0 comments on commit 2dd8a24

Please sign in to comment.