RTC Driver OK
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
#include <cstring>
|
||||
#include <endian.h>
|
||||
|
||||
#define DEBUGLOG_DEFAULT_LOG_LEVEL_TRACE
|
||||
|
||||
//#define DEBUGLOG_DEFAULT_LOG_LEVEL_TRACE
|
||||
#include "utils.h"
|
||||
|
||||
namespace drivers
|
||||
@@ -306,7 +305,7 @@ namespace drivers
|
||||
*it=highByte(beV);
|
||||
*(++it)=lowByte(beV);
|
||||
});
|
||||
|
||||
|
||||
if (!write(multiRequest(device, func, reg, num, requestData)))
|
||||
{
|
||||
LOG_ERROR("Failed send writeMultiInteger command");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "WS_PCF85063.h"
|
||||
#include "PCF85063_Driver.h"
|
||||
#include <ctime>
|
||||
|
||||
namespace drivers
|
||||
@@ -157,6 +157,12 @@ namespace drivers
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string PCF85063::getTimeStr() {
|
||||
datetime_t dt;
|
||||
readDatetime(dt);
|
||||
return datetime2str(dt);
|
||||
}
|
||||
|
||||
const std::string PCF85063::datetime2str(datetime_t &datetime)
|
||||
{
|
||||
tm dtime;
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace drivers
|
||||
I2C &m_i2c;
|
||||
uint8_t m_address;
|
||||
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
uint16_t year;
|
||||
@@ -129,6 +130,8 @@ namespace drivers
|
||||
const bool readAlarm(datetime_t &time);
|
||||
const bool getAlarmFlag(uint8_t &flags);
|
||||
|
||||
const std::string getTimeStr();
|
||||
|
||||
private:
|
||||
const std::string datetime2str(datetime_t &datetime);
|
||||
const uint8_t decToBcd(const int val);
|
||||
|
||||
Reference in New Issue
Block a user