Hi @akhilranga,
For Use Case 1, you can look into this example: Example: S32K148 GPIO Interrupt - NXP Community, pressing SW4 invoke interrupt and Interrupt handler toggles Green LED. If you need some specific time after the interruption, an implementation of the LPIT is possible: S32K SDK Example - Function call on configurable period using LPIT timer. - NXP Community.
However, I haven't seen an example for the S32K which implements the time for a button pressed. There are some examples implemented for the KW45EVB (kw45b41zevk_temperature_collector_freertos), which implement the fsl_component_button driver, including the different types of button events, measured by time thresholds with SW timer in FreeRTOS:
/*! @brief The event type of button */
typedef enum _button_event
{
kBUTTON_EventOneClick = 0x01U, /*!< One click with short time, the duration of key down and key up is less than
#BUTTON_SHORT_PRESS_THRESHOLD. */
kBUTTON_EventDoubleClick, /*!< Double click with short time, the duration of key down and key up is less than
#BUTTON_SHORT_PRESS_THRESHOLD. And the duration of the two button actions does not
exceed #BUTTON_DOUBLE_CLICK_THRESHOLD. */
kBUTTON_EventShortPress, /*!< Press with short time, the duration of key down and key up is no less than
#BUTTON_SHORT_PRESS_THRESHOLD and less than #BUTTON_LONG_PRESS_THRESHOLD. */
kBUTTON_EventLongPress, /*!< Press with long time, the duration of key down and key up is no less than
#BUTTON_LONG_PRESS_THRESHOLD. */
kBUTTON_EventError, /*!< Error event if the button actions cannot be identified. */
} button_event_t;
This, however, is implemented in the KW45EVB and MCUXpresso, just for you information in case you find it useful. You can implement parts of this example into the first ones I shared.
Best regards,
Julián