mirror of
https://github.com/adafruit/RTClib.git
synced 2026-07-27 19:56:05 +00:00
refactored begin() methods to default *wireInstance to &Wire as requested by @ladyada
This commit is contained in:
+4
-12
@@ -809,9 +809,7 @@ static uint8_t bin2bcd(uint8_t val) { return val + 6 * (val / 10); }
|
||||
@return True if Wire can find DS1307 or false otherwise.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean RTC_DS1307::begin(){
|
||||
return begin(&Wire);
|
||||
}
|
||||
|
||||
boolean RTC_DS1307::begin(TwoWire *wireInstance) {
|
||||
RTCWireBus = wireInstance;
|
||||
RTCWireBus->begin();
|
||||
@@ -1056,9 +1054,7 @@ DateTime RTC_Micros::now() {
|
||||
@return True if Wire can find PCF8523 or false otherwise.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean RTC_PCF8523::begin(){
|
||||
return begin(&Wire);
|
||||
}
|
||||
|
||||
boolean RTC_PCF8523::begin(TwoWire *wireInstance) {
|
||||
RTCWireBus = wireInstance;
|
||||
RTCWireBus->begin();
|
||||
@@ -1388,9 +1384,7 @@ void RTC_PCF8523::calibrate(Pcf8523OffsetMode mode, int8_t offset) {
|
||||
@return True if Wire can find PCF8563 or false otherwise.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean RTC_PCF8563::begin(){
|
||||
return begin(&Wire);
|
||||
}
|
||||
|
||||
boolean RTC_PCF8563::begin(TwoWire *wireInstance) {
|
||||
RTCWireBus = wireInstance;
|
||||
RTCWireBus->begin();
|
||||
@@ -1546,9 +1540,7 @@ static uint8_t dowToDS3231(uint8_t d) { return d == 0 ? 7 : d; }
|
||||
@return True if Wire can find DS3231 or false otherwise.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean RTC_DS3231::begin(){
|
||||
return begin(&Wire);
|
||||
}
|
||||
|
||||
boolean RTC_DS3231::begin(TwoWire *wireInstance) {
|
||||
RTCWireBus = wireInstance;
|
||||
RTCWireBus->begin();
|
||||
|
||||
+4
-12
@@ -275,8 +275,7 @@ enum Ds1307SqwPinMode {
|
||||
/**************************************************************************/
|
||||
class RTC_DS1307 {
|
||||
public:
|
||||
boolean begin();
|
||||
boolean begin(TwoWire *wireInstance);
|
||||
boolean begin(TwoWire *wireInstance = &Wire);
|
||||
static void adjust(const DateTime &dt);
|
||||
uint8_t isrunning(void);
|
||||
static DateTime now();
|
||||
@@ -286,7 +285,6 @@ public:
|
||||
void readnvram(uint8_t *buf, uint8_t size, uint8_t address);
|
||||
void writenvram(uint8_t address, uint8_t data);
|
||||
void writenvram(uint8_t address, uint8_t *buf, uint8_t size);
|
||||
|
||||
};
|
||||
|
||||
/** DS3231 SQW pin mode settings */
|
||||
@@ -329,8 +327,7 @@ enum Ds3231Alarm2Mode {
|
||||
/**************************************************************************/
|
||||
class RTC_DS3231 {
|
||||
public:
|
||||
boolean begin();
|
||||
boolean begin(TwoWire *wireInstance);
|
||||
boolean begin(TwoWire *wireInstance = &Wire);
|
||||
static void adjust(const DateTime &dt);
|
||||
bool lostPower(void);
|
||||
static DateTime now();
|
||||
@@ -345,7 +342,6 @@ public:
|
||||
void disable32K(void);
|
||||
bool isEnabled32K(void);
|
||||
static float getTemperature(); // in Celsius degree
|
||||
|
||||
};
|
||||
|
||||
/** PCF8523 INT/SQW pin mode settings */
|
||||
@@ -396,8 +392,7 @@ enum Pcf8523OffsetMode {
|
||||
/**************************************************************************/
|
||||
class RTC_PCF8523 {
|
||||
public:
|
||||
boolean begin();
|
||||
boolean begin(TwoWire *wireInstance);
|
||||
boolean begin(TwoWire *wireInstance = &Wire);
|
||||
void adjust(const DateTime &dt);
|
||||
boolean lostPower(void);
|
||||
boolean initialized(void);
|
||||
@@ -415,7 +410,6 @@ public:
|
||||
void disableCountdownTimer(void);
|
||||
void deconfigureAllTimers(void);
|
||||
void calibrate(Pcf8523OffsetMode mode, int8_t offset);
|
||||
|
||||
};
|
||||
|
||||
/** PCF8563 CLKOUT pin mode settings */
|
||||
@@ -435,8 +429,7 @@ enum Pcf8563SqwPinMode {
|
||||
|
||||
class RTC_PCF8563 {
|
||||
public:
|
||||
boolean begin();
|
||||
boolean begin(TwoWire *wireInstance);
|
||||
boolean begin(TwoWire *wireInstance = &Wire);
|
||||
boolean lostPower(void);
|
||||
void adjust(const DateTime &dt);
|
||||
static DateTime now();
|
||||
@@ -445,7 +438,6 @@ public:
|
||||
uint8_t isrunning();
|
||||
Pcf8563SqwPinMode readSqwPinMode();
|
||||
void writeSqwPinMode(Pcf8563SqwPinMode mode);
|
||||
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user