Jump to main content

##

# 3.9.10 mcUtils_ButtonResponse

## C

    /* Button response Function */
    void mcUtils_ButtonResponse(button_response_t * buttonResData, void (* buttonJob)(void))

## Summary

Button response Function.

## Description

The function processes button input data and executes a specific function when the button is pressed. This function implements a simple state machine to detect button presses and introduce a debounce delay.

## Precondition

None.

## Parameters

Param | Description
--- | ---
buttonResData | Pointer to a structure that holds the button response data, including the current state, input value, and counter.
buttonJob | Function pointer to the function that will be executed when the button press is detected.

## Returns

None

## Example

    // Define the button response data structure
    button_response_t mcAppI_StartStopButton_gds;

    mcAppI_MotorStartStop(void){
    /* Perform Motor Start-Stop operation */
    }

    /* Button response Function */
     mcUtils_ButtonResponse(&mcAppI_StartStopButton_gds, &mcAppI_MotorStartStop);

## Remarks

None.