RTC based on the DS1307 chip connected via I2C and the Wire library. More...
#include <RTClib.h>
Public Member Functions
| |
bool | begin (TwoWire *wireInstance=&Wire) |
Start I2C for the DS1307 and test succesful connection. More... | |
void |
adjust
(const DateTime &dt)
|
Set the date and time in the DS1307.
More...
| |
uint8_t | isrunning (void) |
Is the DS1307 running? Check the Clock Halt bit in register 0.
More...
| |
DateTime | now () |
Get current date and time from DS1307.
More...
| |
Ds1307SqwPinMode | readSqwPinMode() |
Read current mode of SQW pin.
More...
| |
void | writeSqwPinMode( Ds1307SqwPinMode mode) |
Change the SQW pin mode.
More...
| |
uint8_t | readnvram (uint8_t address) |
Shortcut to read one byte from NVRAM.
More...
| |
void | readnvram (uint8_t *buf, uint8_t size, uint8_t address) |
Read data from the DS1307's NVRAM.
More...
| |
void | writenvram (uint8_t address, uint8_t data) |
Shortcut to write one byte to NVRAM.
More...
| |
void | writenvram (uint8_t address, const uint8_t *buf, uint8_t size) |
Write data to the DS1307 NVRAM.
More...
| |
RTC based on the DS1307 chip connected via I2C and the Wire library.
bool RTC_DS1307::begin | ( | TwoWire * |
wireInstance
=
&Wire
| ) |
Start I2C for the DS1307 and test succesful connection.
ParameterswireInstance | pointer to the I2C bus |
void RTC_DS1307::adjust | ( | const DateTime & | dt | ) |
Set date and time in DS1307.
Parametersdt | DateTime object containing the desired date/time |
uint8_t RTC_DS1307::isrunning | ( | void | ) |
Is the DS1307 running? Check the Clock Halt bit in register 0.
DateTime RTC_DS1307::now | ( | ) |
Get the current date and time from the DS1307.
Ds1307SqwPinMode RTC_DS1307::readSqwPinMode | ( | ) |
Read the current mode of the SQW pin.
void RTC_DS1307::writeSqwPinMode | ( | Ds1307SqwPinMode | mode | ) |
Change the SQW pin mode.
Parametersmode | The mode to use |
uint8_t RTC_DS1307::readnvram | ( | uint8_t | address | ) |
Shortcut to read one byte from NVRAM.
Parametersaddress | NVRAM address, 0 to 55 |
void RTC_DS1307::readnvram | ( | uint8_t * | buf , |
uint8_t | size , | ||
uint8_t | address | ||
) |
Read data from the DS1307's NVRAM.
Parametersbuf | Pointer to a buffer to store the data - make sure it's large enough to hold size bytes |
size | Number of bytes to read |
address | Starting NVRAM address, from 0 to 55 |
void RTC_DS1307::writenvram | ( | uint8_t | address , |
uint8_t | data | ||
) |
Shortcut to write one byte to NVRAM.
Parametersaddress | NVRAM address, 0 to 55 |
data | One byte to write |
void RTC_DS1307::writenvram | ( | uint8_t | address , |
const uint8_t * | buf , | ||
uint8_t | size | ||
) |
Write data to the DS1307 NVRAM.
Parametersaddress | Starting NVRAM address, from 0 to 55 |
buf | Pointer to buffer containing the data to write |
size | Number of bytes in buf to write to NVRAM |