set ntp parameters via config file
This commit is contained in:
@@ -18,9 +18,6 @@ namespace drivers
|
||||
const uint8_t def_conf2 = RTC_CTRL_2_DEFAULT | RTC_CTRL_2_MI; // enable 1 minute interrupt
|
||||
success &= m_i2c.write(m_address, RTC_CTRL_2_ADDR, {def_conf2});
|
||||
}
|
||||
// set clock correction pulses
|
||||
const uint8_t correction = 0xE7; // fast mode -25 correction pulses, because clock is beyond
|
||||
success &= m_i2c.write(m_address, RTC_OFFSET_ADDR, {correction});
|
||||
if (!success)
|
||||
LOG_ERROR("RTC Init Failure");
|
||||
}
|
||||
@@ -163,18 +160,19 @@ namespace drivers
|
||||
|
||||
const bool PCF85063::setOffset(const uint8_t ofst)
|
||||
{
|
||||
LOG_INFO("RTC set offset [", printHex(ofst).c_str(), "]");
|
||||
LOG_DEBUG("RTC set offset [", printHex(ofst).c_str(), "]");
|
||||
return m_i2c.write(m_address, RTC_OFFSET_ADDR, {ofst});
|
||||
}
|
||||
|
||||
|
||||
const uint8_t PCF85063::getOffset()
|
||||
{
|
||||
std::vector<uint8_t> buf;
|
||||
if (m_i2c.read(m_address, RTC_OFFSET_ADDR, 1, buf)) {
|
||||
LOG_INFO("RTC get offset [", printHex(buf.front()).c_str(), "]");
|
||||
return buf.front();
|
||||
if (m_i2c.read(m_address, RTC_OFFSET_ADDR, 1, buf))
|
||||
{
|
||||
LOG_DEBUG("RTC get offset [", printHex(buf.front()).c_str(), "]");
|
||||
return buf.front();
|
||||
}
|
||||
return {};
|
||||
return UINT8_MAX;
|
||||
}
|
||||
|
||||
const std::string PCF85063::getTimeStr()
|
||||
|
||||
Reference in New Issue
Block a user