Skip to content

Commit 3b885de

Browse files
author
Clang Robot
committed
Committing clang-format changes
1 parent 94b7870 commit 3b885de

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/features/rtc/rtc.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
void RTC::setTime(uint8_t rtcHour, uint8_t rtcMinute, uint8_t rtcSecond, bool isPM)
3030
{
31-
if (_12hMode && rtcHour > 12) // user passed 24h value
31+
if (_12hMode && rtcHour > 12) // user passed 24h value
3232
{
3333
_isPM = true;
3434
rtcHour = rtcHour - 12;
@@ -46,7 +46,7 @@ void RTC::setTime(uint8_t rtcHour, uint8_t rtcMinute, uint8_t rtcSecond, bool is
4646
uint8_t hourBcd = decToBcd(rtcHour);
4747
if (_12hMode && isPM)
4848
hourBcd |= (1 << 5);
49-
49+
5050
Wire.beginTransmission(I2C_ADDR);
5151
Wire.write(RTC_RAM_by);
5252
Wire.write(RTC_SET); // Write in RAM to know that RTC is set
@@ -116,14 +116,14 @@ uint32_t RTC::getEpoch()
116116
updateTime();
117117
struct tm _t;
118118

119-
_t.tm_sec = Second;
120-
_t.tm_min = Minute;
119+
_t.tm_sec = Second;
120+
_t.tm_min = Minute;
121121
_t.tm_hour = _12hMode ? (Hour % 12) + (_isPM ? 12 : 0) : Hour; // convert to 0-23
122122
_t.tm_mday = Day;
123123
_t.tm_wday = Weekday;
124-
_t.tm_mon = Month - 1;
124+
_t.tm_mon = Month - 1;
125125
_t.tm_year = Year - 1900;
126-
126+
127127
return (uint32_t)(mktime(&_t));
128128
}
129129

@@ -650,7 +650,7 @@ bool RTC::changeTimeFormat()
650650
_12hMode = !_12hMode;
651651

652652
if (_12hMode)
653-
reg |= (1 << 3); // set 12_24 bit
653+
reg |= (1 << 3); // set 12_24 bit
654654
else
655655
reg &= ~(1 << 3); // clear 12_24 bit
656656

@@ -775,33 +775,33 @@ void RTC::setClockOffset(bool mode, int offsetValue)
775775

776776
/**
777777
* @brief Reads raw time/date registers from RTC via I2C into member variables
778-
*/
778+
*/
779779
void RTC::updateTime()
780780
{
781781
Wire.beginTransmission(I2C_ADDR);
782782
Wire.write(RTC_SECOND_ADDR);
783783
Wire.endTransmission();
784784
Wire.requestFrom(I2C_ADDR, 7);
785785

786-
Second = bcdToDec(Wire.read() & 0x7F);
787-
Minute = bcdToDec(Wire.read() & 0x7F);
786+
Second = bcdToDec(Wire.read() & 0x7F);
787+
Minute = bcdToDec(Wire.read() & 0x7F);
788788

789789
uint8_t hourReg = Wire.read();
790790
if (_12hMode)
791791
{
792792
// bit 5 defines the time format
793-
_isPM = (hourReg >> 5) & 0x01;
793+
_isPM = (hourReg >> 5) & 0x01;
794794
Hour = bcdToDec(hourReg & 0x1F);
795795
}
796796
else
797797
{
798798
Hour = bcdToDec(hourReg & 0x3F);
799799
}
800800

801-
Day = bcdToDec(Wire.read() & 0x3F);
801+
Day = bcdToDec(Wire.read() & 0x3F);
802802
Weekday = bcdToDec(Wire.read() & 0x07);
803-
Month = bcdToDec(Wire.read() & 0x1F);
804-
Year = bcdToDec(Wire.read()) + 2000;
803+
Month = bcdToDec(Wire.read() & 0x1F);
804+
Year = bcdToDec(Wire.read()) + 2000;
805805
}
806806

807807
/**

src/features/rtc/rtc.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
#define I2C_ADDR 0x51
2424

2525
// registar overview - crtl & status reg
26-
#define RTC_CTRL_1 0x00
26+
#define RTC_CTRL_1 0x00
2727
#define RTC_CTRL_1_DEFAULT 0x58
28-
#define RTC_CTRL_2 0x01
29-
#define RTC_OFFSET 0x02
30-
#define RTC_RAM_by 0x03
28+
#define RTC_CTRL_2 0x01
29+
#define RTC_OFFSET 0x02
30+
#define RTC_RAM_by 0x03
3131

32-
#define RTC_SET 0xAA
32+
#define RTC_SET 0xAA
3333
// registar overview - time & data reg
3434
#define RTC_SECOND_ADDR 0x04
3535
#define RTC_MINUTE_ADDR 0x05

0 commit comments

Comments
 (0)