This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] quot;button.c"驱动程序 button_LONGPRESSING 状态

Guru**** 3001220 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1051445/button-c-driver-button_longpressing-state

button.c 驱动程序中的代码看起来很奇怪。

"默认"情况之前没有休息时间。 因此、看起来状态 button_LONGPRESSING 始终是使用 button_pressed 写入的。

此外,obj->buttonStateVariables.state = button_LONGPRESSING 使用两次,但无论如何它是 writeren。

            case Button_RELEASING:
            case Button_RELEASING_LONG:
            case Button_RELEASING_DBLPRESSED:
            /*
            * We're releasing, but isn't released after debounce.
            * Start count down again if interest in long-press
            */
            if(obj->buttonEventMask &
               (Button_EV_LONGPRESSED | Button_EV_LONGCLICKED))
            {
                obj->buttonStateVariables.state = Button_LONGPRESSING;
                ClockP_setTimeout(obj->clockHandle, obj->longPressDuration - obj->debounceDuration);
                ClockP_start(obj->clockHandle);
                obj->buttonStateVariables.state = Button_LONGPRESSING;
            }
            else
            {
                obj->buttonStateVariables.state = Button_PRESSED;
            }

            /*
             * Any other case, mark the button as pressed.
             * Typically we should not come here
             */
            default:
                 obj->buttonStateVariables.state = Button_PRESSED;
                 break;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Alex、您好!

    您使用的是什么处理器?

    此致、

    ~Leonard   

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    CC1352R1

    simplelink_cc13x2_26x2_SDK_5_20_00_52

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex:  

    案例 button_LONGPRESSING 似乎有一条 break 语句。 您提到的这种情况发生在松开按下按钮时。  

    此致、

    Siddanth

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果您要检测长按、也可以参阅 sunmaysky.blogspot.com/.../how-to-detect-buttont-hold-in-cc26x2.html

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢、SDK "button.c"驱动程序可用于长时间按压。

    但我注意到这些情况:

               案例按钮_释放:
               案例按钮_释放_长:
               案例按钮_释放_DBLPRESSED:

    在驱动程序中不起作用、因为存在错误。

    您是否看到了上述代码? 它来自"Button.c"(最新的 SDK)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    情况

               案例按钮_释放:
               案例按钮_释放_长:
               案例按钮_释放_DBLPRESSED:

    没有"break"语句。

    它看起来像是 SDK 5.20.00.52中的一个错误

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex:  
    是的、似乎缺少 break 语句。 我将为修复创建一个 TT。 感谢您提出问题。  

    此致、

    Siddanth