Completed RTC driver refactoring

This commit is contained in:
Emanuele Trabattoni
2025-06-23 14:29:42 +02:00
parent 19197aa022
commit 9530aab1c1
2 changed files with 173 additions and 248 deletions

View File

@@ -112,27 +112,27 @@ namespace drivers
} datetime_t;
public:
PCF85063(I2C &i2c, const uint8_t address, const uint8_t ctrl1, const uint8_t ctrl2);
PCF85063(I2C &i2c, const uint8_t address, const uint8_t ctrl1 = RTC_CTRL_1_DEFAULT, const uint8_t ctrl2 = RTC_CTRL_2_DEFAULT);
const bool reset(void);
const bool setTime(datetime_t time);
const bool setDate(datetime_t date);
const bool setDatetime(datetime_t datetime);
const bool setTime(const datetime_t time);
const bool setDate(const datetime_t date);
const bool setDatetime(const datetime_t datetime);
const bool readDate(datetime_t &datetime);
const bool readTime(datetime_t &datetime);
const bool readDatetime(datetime_t &datetime);
const bool enableAlarm(const bool enable);
const bool setAlarm(datetime_t time);
const bool setAlarm(const datetime_t time);
const bool readAlarm(datetime_t &time);
const bool getAlarmFlafs(uint8_t& flags);
const bool getAlarmFlag(uint8_t &flags);
private:
const std::string datetime2str(datetime_t &time);
const uint8_t decToBcd(int val);
const int bcdToDec(uint8_t val);
const std::string datetime2str(datetime_t &datetime);
const uint8_t decToBcd(const int val);
const int bcdToDec(const uint8_t val);
};
}