From 7287c76e60c1baa3d3a33e4f8806c85b52fec1db Mon Sep 17 00:00:00 2001 From: Gabriel Wang Date: Wed, 27 Nov 2024 12:08:12 +0000 Subject: [PATCH] add an API to configure the PI mode --- ARM.Arm-2D.pdsc | 2 +- Helper/Include/arm_2d_helper_list.h | 19 +++++++++++++++++++ Helper/Source/arm_2d_helper_list.c | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/ARM.Arm-2D.pdsc b/ARM.Arm-2D.pdsc index 3ac22a80..c830d614 100644 --- a/ARM.Arm-2D.pdsc +++ b/ARM.Arm-2D.pdsc @@ -318,7 +318,7 @@ - + Helper services for LCD adaptor(s), e.g. Generic Partial Framebuffer, Scene Player etc. diff --git a/Helper/Include/arm_2d_helper_list.h b/Helper/Include/arm_2d_helper_list.h index 66bbf8d8..59ff20f2 100644 --- a/Helper/Include/arm_2d_helper_list.h +++ b/Helper/Include/arm_2d_helper_list.h @@ -440,6 +440,25 @@ extern ARM_NONNULL(1) arm_2d_tile_t *__arm_2d_list_core_get_inner_tile(__arm_2d_list_core_t *ptThis); +/*! + * \brief enable or disable the PI mode for the indicator + * + * \param[in] ptThis the target list core object + * \param[in] bEnable a boolean value to enable or disable the PI mode + * \param[in] ptNewCFG an optional new PI configuration + * \note If the PI mode has never been enabled before, when the first time of calling + * this function, the ptNewCFG must point to a valid configuration structure + * + * \return true the PI mode was previously enabled + * \return false the PI mode was previously disabled + */ +extern +ARM_NONNULL(1) +bool __arm_2d_list_core_indicator_pi_mode_config( + __arm_2d_list_core_t *ptThis, + bool bEnable, + arm_2d_helper_pi_slider_cfg_t *ptNewCFG); + /*! * \brief show a given list core * \param[in] ptThis the target list core object diff --git a/Helper/Source/arm_2d_helper_list.c b/Helper/Source/arm_2d_helper_list.c index fc7280c3..d5d35139 100644 --- a/Helper/Source/arm_2d_helper_list.c +++ b/Helper/Source/arm_2d_helper_list.c @@ -774,6 +774,31 @@ bool __arm_2d_list_core_is_list_scrolling(__arm_2d_list_core_t *ptThis) return this.Runtime.bScrolling; } +ARM_NONNULL(1) +bool __arm_2d_list_core_indicator_pi_mode_config( + __arm_2d_list_core_t *ptThis, + bool bEnable, + arm_2d_helper_pi_slider_cfg_t *ptNewCFG) +{ + assert(NULL != ptThis); + bool bPrevious = this.tCFG.bUsePISliderForSelectionIndicator; + + if (!bEnable) { + this.tCFG.bUsePISliderForSelectionIndicator = false; + } else if (NULL != ptNewCFG) { + + this.tCFG.bUsePISliderForSelectionIndicator = true; + + if (NULL != ptNewCFG) { + /* we cannot trust this pointer, because the address could be a temporary one*/ + this.tCFG.ptPISliderCFG = ptNewCFG; + + arm_2d_helper_pi_slider_init(&this.Runtime.tPISlider, ptNewCFG, this.nOffset); + } + } + + return bPrevious; +} ARM_NONNULL(1,2) arm_2d_list_item_t *__arm_2d_list_core_get_item(