Lines Matching refs:buttonState

114 static void BUTTON_NotificationUpdate(button_state_t *buttonState, button_event_t event)  in BUTTON_NotificationUpdate()  argument
116 buttonState->state.pressed = (uint8_t)kStatus_BUTTON_PressIdle; in BUTTON_NotificationUpdate()
117 buttonState->state.msg = (uint8_t)event; in BUTTON_NotificationUpdate()
122 s_buttonList.commonTaskMsg.callbackParam = buttonState; in BUTTON_NotificationUpdate()
135 button_state_t *buttonState = (button_state_t *)param; in BUTTON_Event() local
140 (void)HAL_GpioGetInput(buttonState->gpioHandle, &pinState); in BUTTON_Event()
142 if (((uint8_t)kStatus_BUTTON_PressIdle == buttonState->state.pressed) || in BUTTON_Event()
143 ((uint8_t)kStatus_BUTTON_PressDoubleStart == buttonState->state.pressed)) in BUTTON_Event()
145 if (buttonState->pinStateDefault != pinState) in BUTTON_Event()
147 buttonState->state.pressed++; in BUTTON_Event()
148 buttonState->pushPeriodCount = s_buttonList.periodCount; in BUTTON_Event()
156 if (((uint8_t)kStatus_BUTTON_Pressed) == (buttonState->state.pressed)) in BUTTON_Event()
164 if (buttonState->pinStateDefault == pinState) in BUTTON_Event()
166 …if ((BUTTON_DOUBLE_CLICK_THRESHOLD + buttonState->pushPeriodCountLast) >= buttonState->pushPeriodC… in BUTTON_Event()
168 … if ((s_buttonList.periodCount - buttonState->pushPeriodCount) < BUTTON_SHORT_PRESS_THRESHOLD) in BUTTON_Event()
171 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventDoubleClick); in BUTTON_Event()
176 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventError); in BUTTON_Event()
181 … if ((s_buttonList.periodCount - buttonState->pushPeriodCount) < BUTTON_SHORT_PRESS_THRESHOLD) in BUTTON_Event()
183 buttonState->pushPeriodCountLast = s_buttonList.periodCount; in BUTTON_Event()
184 buttonState->state.pressed = (uint8_t)kStatus_BUTTON_PressDoubleStart; in BUTTON_Event()
187 … else if ((s_buttonList.periodCount - buttonState->pushPeriodCount) < BUTTON_LONG_PRESS_THRESHOLD) in BUTTON_Event()
189 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventShortPress); in BUTTON_Event()
195 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventLongPress); in BUTTON_Event()
200 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventError); in BUTTON_Event()
224 button_state_t *buttonState = s_buttonList.button; in BUTTON_Task() local
228 while (NULL != buttonState) in BUTTON_Task()
230 if (0U != buttonState->state.msg) in BUTTON_Task()
234 msg.event = (button_event_t)buttonState->state.msg; in BUTTON_Task()
235 (void)buttonState->callback(buttonState, &msg, buttonState->callbackParam); in BUTTON_Task()
236 buttonState->state.msg = 0U; in BUTTON_Task()
246 buttonState = buttonState->next; in BUTTON_Task()
263 button_state_t *buttonState;
271 buttonState = s_buttonList.button;
272 while (NULL != buttonState)
280 if ((uint8_t)kStatus_BUTTON_PressDoubleStart == buttonState->state.pressed)
282 … if ((BUTTON_DOUBLE_CLICK_THRESHOLD + buttonState->pushPeriodCountLast) < s_buttonList.periodCount)
284 BUTTON_NotificationUpdate(buttonState, kBUTTON_EventOneClick);
285 buttonState->pushPeriodCountLast = 0U;
288 buttonState = buttonState->next;
341 button_state_t *buttonState;
348 buttonState = (button_state_t *)buttonHandle;
375 buttonState->next = s_buttonList.button;
377 s_buttonList.button = buttonState;
384 (void)memcpy(&buttonState->pinStateDefault, &buttonConfig->gpio.pinStateDefault, 3U);
385 …gpioStatus = HAL_GpioInit(buttonState->gpioHandle, (hal_gpio_pin_config_t *)((void *)buttonConfig)…
389 gpioStatus = HAL_GpioSetTriggerMode(buttonState->gpioHandle, kHAL_GpioInterruptEitherEdge);
398 button_state_t *buttonState;
401 buttonState = (button_state_t *)buttonHandle;
403 buttonState->callback = callback;
404 buttonState->callbackParam = callbackParam;
406 (void)HAL_GpioInstallCallback(buttonState->gpioHandle, BUTTON_Event, buttonState);
413 button_state_t *buttonState;
419 buttonState = (button_state_t *)buttonHandle;
423 if (buttonStatePre != buttonState)
425 while ((NULL != buttonStatePre) && (buttonStatePre->next != buttonState))
431 buttonStatePre->next = buttonState->next;
436 s_buttonList.button = buttonState->next;
455 (void)HAL_GpioDeinit(buttonState->gpioHandle);
462 button_state_t *buttonState;
466 buttonState = (button_state_t *)buttonHandle;
468 (void)HAL_GpioGetInput(buttonState->gpioHandle, pinState);
475 button_state_t *buttonState;
480 buttonState = (button_state_t *)buttonHandle;
482 status = HAL_GpioWakeUpSetting(buttonState->gpioHandle, enable);
493 button_state_t *buttonState;
502 buttonState = (button_state_t *)buttonHandle;
506 buttonState = s_buttonList.button;
509 while (NULL != buttonState)
511 status = HAL_GpioEnterLowpower(buttonState->gpioHandle);
521 buttonState = buttonState->next;
529 button_state_t *buttonState;
538 buttonState = (button_state_t *)buttonHandle;
542 buttonState = s_buttonList.button;
545 while (NULL != buttonState)
547 status = HAL_GpioExitLowpower(buttonState->gpioHandle);
552 BUTTON_Event(buttonState);
559 buttonState = buttonState->next;