/************************************************************************** * * Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file GPIO.c * * @author (last) Vinayakam Mani * @date (last) 29-Aug-2024 * * @author (original) Vinayakam Mani * @date (original) 29-Aug-2024 * ***************************************************************************/ #include "gio.h" #include "mibspi.h" #include "GPIO.h" /** * @addtogroup GPIO * @{ */ // ********** private definitions ********** #define WD_PET_GIO_PORT_PIN 1U ///< Watchdog pet GPIO pin number. #define WD_EXP_GIO_PORT_PIN 0U ///< Watchdog expired GPIO pin number. #define GET_WD_EXP() ( PIN_SIGNAL_STATE_T )( gioGetBit( gioPORTB, WD_EXP_GIO_PORT_PIN ) ) ///< Get watchdog expired pin state macro. #define TGL_WD_PET() gioToggleBit( gioPORTB, WD_PET_GIO_PORT_PIN ) ///< Macro to toggle watchdog pet signal state. #define SET_WD_PET() gioSetBit( gioPORTB, WD_PET_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) ///< Macro to set watchdog pet signal state high. #define CLR_WD_PET() gioSetBit( gioPORTB, WD_PET_GIO_PORT_PIN, PIN_SIGNAL_LOW ) ///< Macro to set watchdog pet signal state low. /*********************************************************************//** * @brief * The toggleWatchdogPetSignal function toggles the watchdog pet output * signal on its GPIO pin. * @details \b Inputs: none * @details \b Outputs: Watchdog pet output signal toggled * @return none *************************************************************************/ void toggleWatchdogPetSignal( void ) { TGL_WD_PET(); } /*********************************************************************//** * @brief * The setWatchdogPetSignal function sets the watchdog pet output * signal on its GPIO pin to HIGH. * @details \b Inputs: none * @details \b Outputs: Watchdog pet output signal set high * @return none *************************************************************************/ void setWatchdogPetSignal( void ) { SET_WD_PET(); } /*********************************************************************//** * @brief * The clrWatchdogPetSignal function sets the watchdog pet output * signal on its GPIO pin to LOW. * @details \b Inputs: none * @details \b Outputs: Watchdog pet output signal set low * @return none *************************************************************************/ void clrWatchdogPetSignal( void ) { CLR_WD_PET(); } /*********************************************************************//** * @brief * The getWatchdogExpired function determines the current signal level * on the watchdog expired pin. * @details \b Inputs: Signal on watchdog expired pin. * @details \b Outputs: none * @return level (LOW or HIGH) *************************************************************************/ PIN_SIGNAL_STATE_T getWatchdogExpired( void ) { PIN_SIGNAL_STATE_T level = GET_WD_EXP(); return level; } /**@}*/