Esempio n. 1
0
/* begin() - inits I2C bus and used pins
 *
 * It enables internal pull-up resistor for the RTC interrupt pin, so as this pin is set to HIGH when init
 * It inits I2C bus for communicating with RTC
 * It reads from RTC time,date and alarms, setting the corresponding variables
 *
 * Returns nothing
 */ 
void WaspRTC::begin()
{
  // Powers RTC UP
  setMode(RTC_ON, RTC_NORMAL_MODE);
  // Inits I2C bus
  if( !Wire.I2C_ON ) Wire.begin();

  // initialize the variables used to store the data
  // from the RTC
  clearAlarmFlag();
  resetVars();
  readRTC(RTC_ALARM2_ADDRESS);
}
Esempio n. 2
0
/*
 * ON (void) - It opens I2C bus and powers the RTC
 *
 *  
 *  It enables internal pull-up resistor for the RTC interrupt pin, so as this
 *  pin is set to HIGH when init
 *  It inits I2C bus for communicating with RTC
 *  It reads from RTC time,date and alarms, setting the corresponding variables
 */
void WaspRTC::ON(void)
{
	// Powers RTC UP
	setMode(RTC_ON, RTC_NORMAL_MODE);
	
	// Inits I2C bus
	if( !Wire.I2C_ON ) Wire.begin();
 
	// clear the alarm flags
	clearAlarmFlag();
	// initialize the variables used to store the data from the RTC
	resetVars();
  
	// read all registers related to the Time and Date and Alarms 
	readRTC(RTC_ALARM2_ADDRESS);
}