/* Gets the lowest energy mode that the system is allowed to be set to. 
This function uses the low energy mode block counters to determine the lowest possible that the system is allowed to be set to. */
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void)
/* Gets the lowest energy mode that the system is allowed to be set to. 
This function uses the low energy mode block counters to determine the lowest possible that the system is allowed to be set to. */
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void)
{
  SLEEP_EnergyMode_t tmpLowestEM = sleepEM1;
  if (0U == sleepBlockCnt[sleepEM2 - 2U])
  {
    tmpLowestEM = sleepEM2;
    if (0U == sleepBlockCnt[sleepEM3 - 2U])
    {
      tmpLowestEM = sleepEM3;
    }
  }
  if (SLEEP_LOWEST_ENERGY_MODE_DEFAULT < tmpLowestEM)
  {
    tmpLowestEM = SLEEP_LOWEST_ENERGY_MODE_DEFAULT;
  }
  return tmpLowestEM;
}