Skip to content

Commit 4d9c07e

Browse files
committed
Make current count value and counter load registers volatile
1 parent b872431 commit 4d9c07e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libraries/CurieRTC/src/CurieRTC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
unsigned long now()
3131
{
32-
return *(int*)RTC_CCVR;
32+
return *RTC_CCVR;
3333
}
3434

3535
struct tm* nowTm() {
@@ -82,7 +82,7 @@ int second()
8282

8383
void setTime(unsigned long t)
8484
{
85-
*(int*)RTC_CLR = t;
85+
*RTC_CLR = t;
8686
}
8787

8888
void setTime(int hour, int minute, int second, int day, int month, int year)

libraries/CurieRTC/src/CurieRTC.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#ifndef CurieRTC_h
66
#define CurieRTC_h
77

8-
#define RTC_CCVR 0xb0000400 // Current Counter Value Register
8+
#define RTC_CCVR (volatile int*)0xb0000400 // Current Counter Value Register
99
#define RTC_CMR 0xb0000404 // Counter Match Register
10-
#define RTC_CLR 0xb0000408 // Counter Load Register
10+
#define RTC_CLR (volatile int*)0xb0000408 // Counter Load Register
1111
#define RTC_CCR 0xb000040C // Counter Control Register
1212
#define RTC_STAT 0xb0000410 // Interrupt Status Register
1313
#define RTC_RSTAT 0xb0000414 // Interrupt Raw Status Register

0 commit comments

Comments
 (0)