arduino_sensor/LowPower.cpp
void	LowPowerClass::powerStandby(period_t period, adc_t adc, bod_t bod)
{
	if (adc == ADC_OFF)	ADCSRA &= ~(1 << ADEN);
	
	if (period != SLEEP_FOREVER)
	{
		wdt_enable(period);
		WDTCSR |= (1 << WDIE);	
	}
	
	if (bod == BOD_OFF)	
	{
		#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168P__)
			lowPowerBodOff(SLEEP_MODE_STANDBY);
		#else
			lowPowerBodOn(SLEEP_MODE_STANDBY);
		#endif
	}
	else
	{
		lowPowerBodOn(SLEEP_MODE_STANDBY);
	}
	
	if (adc == ADC_OFF) ADCSRA |= (1 << ADEN);
}
/*******************************************************************************
* Name: powerStandby
* Description: Putting microcontroller into power standby state. 
*
* Argument  	Description
* =========  	===========
* 1. period   Duration of low power mode. Use SLEEP_FOREVER to use other wake
*				up resource:
*				(a) SLEEP_15MS - 15 ms sleep
*				(b) SLEEP_30MS - 30 ms sleep
*				(c) SLEEP_60MS - 60 ms sleep
*				(d) SLEEP_120MS - 120 ms sleep
*				(e) SLEEP_250MS - 250 ms sleep
*				(f) SLEEP_500MS - 500 ms sleep
*				(g) SLEEP_1S - 1 s sleep
*				(h) SLEEP_2S - 2 s sleep
*				(i) SLEEP_4S - 4 s sleep
*				(j) SLEEP_8S - 8 s sleep
*				(k) SLEEP_FOREVER - Sleep without waking up through WDT
*
* 2. adc		ADC module disable control. Turning off the ADC module is
*				basically removing the purpose of this low power mode.
*				(a) ADC_OFF - Turn off ADC module
*				(b) ADC_ON - Leave ADC module in its default state
*
* 3. bod		Brown Out Detector (BOD) module disable control:
*				(a) BOD_OFF - Turn off BOD module
*				(b) BOD_ON - Leave BOD module in its default state
*
*******************************************************************************/
powerStandby
Description: Putting microcontroller into power standby state.

Argument       Description

1. period   Duration of low power mode.

2. adc         ADC module disable control. Turning off the ADC module is
basically removing the purpose of this low power mode.
(a) ADC_OFF - Turn off ADC module
(b) ADC_ON - Leave ADC module in its default state

3. bod         Brown Out Detector (BOD) module disable control:
(a) BOD_OFF - Turn off BOD module
(b) BOD_ON - Leave BOD module in its default state
powerStandby Description : Putting microcontroller into power standby state . Argument Description 1 . period Duration of low power mode . 2 . adc ADC module disable control . Turning off the ADC module is basically removing the purpose of this low power mode . ( a ) ADC_OFF - Turn off ADC module ( b ) ADC_ON - Leave ADC module in its default state 3 . bod Brown Out Detector ( BOD ) module disable control : ( a ) BOD_OFF - Turn off BOD module ( b ) BOD_ON - Leave BOD module in its default state
void	LowPowerClass::powerStandby(period_t period, adc_t adc, bod_t bod)
{
	if (adc == ADC_OFF)	ADCSRA &= ~(1 << ADEN);
	if (period != SLEEP_FOREVER)
	{
		wdt_enable(period);
		WDTCSR |= (1 << WDIE);	
	}
	if (bod == BOD_OFF)	
	{
		#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168P__)
			lowPowerBodOff(SLEEP_MODE_STANDBY);
		#else
			lowPowerBodOn(SLEEP_MODE_STANDBY);
		#endif
	}
	else
	{
		lowPowerBodOn(SLEEP_MODE_STANDBY);
	}
	if (adc == ADC_OFF) ADCSRA |= (1 << ADEN);
}
void LowPowerClass :: powerStandby ( period_t period , adc_t adc , bod_t bod ) { if ( adc == ADC_OFF ) ADCSRA &= ~ ( 1 << ADEN ) ; if ( period != SLEEP_FOREVER ) { wdt_enable ( period ) ; WDTCSR |= ( 1 << WDIE ) ; } if ( bod == BOD_OFF ) { #if defined ( __AVR_ATmega328P__ ) || defined ( __AVR_ATmega168P__ ) lowPowerBodOff ( SLEEP_MODE_STANDBY ) ; #else lowPowerBodOn ( SLEEP_MODE_STANDBY ) ; #endif } else { lowPowerBodOn ( SLEEP_MODE_STANDBY ) ; } if ( adc == ADC_OFF ) ADCSRA |= ( 1 << ADEN ) ; }
Name: powerStandby
Description: Putting microcontroller into power standby state.
Name : powerStandby Description : Putting microcontroller into power standby state .