//-----------------------------------------------------------------------------
///
/// \brief  Class for WKUP
///
/// \date   20241029
/// \author Maximilian Seesslen <development@seesslen.net>
///
//-----------------------------------------------------------------------------


//---Includes------------------------------------------------------------------


#if defined STM32L1 | defined STM32G0 | defined STM32G4 | defined STM32L4
// mpu_armv7.h uses an "|=" operation on a volatile register, which is not
// allowed any more. So "-Wvolatile" has to be ignored.Testet with GCC 12.2.0
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvolatile"
#endif
#include <HALWrapper/stm32_pwr.h>
#if defined STM32L1 | defined STM32G0 | defined STM32G4 | defined STM32L4
#pragma GCC diagnostic pop
#endif

#include <biwak/wkup.hpp>


//---Implementation------------------------------------------------------------


CWkup::CWkup(EGpioPeripheral peripheral, EGpioPin pin, const SExtiConfig &configData, int wakeupPin)
   :CInput( peripheral, pin, configData, gpioModeInputInterrupt ) // PullDown )
   ,m_wakeupPin( wakeupPin )
{
   enableWakeup();
}


void CWkup::enableWakeup()
{
   HAL_PWR_EnableWakeUpPin( m_wakeupPin );
}


void CWkup::disableWakeup()
{
   HAL_PWR_DisableWakeUpPin( m_wakeupPin );
}


//---fin-----------------------------------------------------------------------
