Skip to content

Choose 12 Hrs or 24 Hrs representation #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/RTCZero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RTCZero::RTCZero()
_configured = false;
}

void RTCZero::begin(bool resetTime)
void RTCZero::begin(bool twelveHrsformat,bool resetTime)
{
uint16_t tmp_reg = 0;

Expand Down Expand Up @@ -72,6 +72,10 @@ void RTCZero::begin(bool resetTime)

//According to the datasheet RTC_MODE2_CTRL_CLKREP = 0 for 24h
tmp_reg &= ~RTC_MODE2_CTRL_CLKREP; // 24h time representation
if(twelveHrsformat)
{
tmp_reg |= RTC_MODE2_CTRL_CLKREP; // 12h time representation
}

RTC->MODE2.READREQ.reg &= ~RTC_READREQ_RCONT; // disable continuously mode

Expand Down
2 changes: 1 addition & 1 deletion src/RTCZero.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RTCZero {
};

RTCZero();
void begin(bool resetTime = false);
void begin(bool twelveHrsformat = false,bool resetTime = false);

void enableAlarm(Alarm_Match match);
void disableAlarm();
Expand Down