Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf88f9fd

Browse files
committed
more fake RTC code ...adafruit#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
1 parent4a5c52f commitf88f9fd

File tree

1 file changed

+12
-8
lines changed
  • ports/nrf/common-hal/rtc

1 file changed

+12
-8
lines changed

‎ports/nrf/common-hal/rtc/RTC.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,25 @@
3232
#include"shared-bindings/rtc/__init__.h"
3333
#include"supervisor/shared/translate.h"
3434

35+
#include"nrfx_rtc.h"
36+
37+
staticuint32_t_rtc_seconds=0;
38+
39+
voidrtc_handler(nrfx_rtc_int_type_tint_type) {
40+
41+
}
42+
3543
voidrtc_init(void) {
3644
}
3745

3846
voidcommon_hal_rtc_get_time(timeutils_struct_time_t*tm) {
39-
tm->tm_year=2000;
40-
tm->tm_mon=1;
41-
tm->tm_mday=2;
42-
tm->tm_hour=3;
43-
tm->tm_min=4;
44-
tm->tm_sec=5;
45-
tm->tm_wday=6;
46-
tm->tm_yday=2;
47+
timeutils_seconds_since_2000_to_struct_time(_rtc_seconds,tm);
4748
}
4849

4950
voidcommon_hal_rtc_set_time(timeutils_struct_time_t*tm) {
51+
_rtc_seconds=timeutils_seconds_since_2000(
52+
tm->tm_year,tm->tm_mon,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec
53+
);
5054
}
5155

5256
// A positive value speeds up the clock by removing clock cycles.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp