Skip to content

Commit 2bd7e04

Browse files
committed
[components][rtc] Add microsecond resolution support with RTC framework V2.0
1 parent e62943a commit 2bd7e04

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

components/drivers/include/drivers/rtc_core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ struct rt_rtc_ops
2727
rt_err_t (*set_secs)(void *arg);
2828
rt_err_t (*get_alarm)(void *arg);
2929
rt_err_t (*set_alarm)(void *arg);
30+
rt_err_t (*get_usecs)(void *arg);
31+
rt_err_t (*set_usecs)(void *arg);
3032
};
3133

3234
typedef struct rt_rtc_device

components/drivers/rtc/rtc_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ static rt_err_t rt_rtc_core_control(struct rt_device *dev,
6161
case RT_DEVICE_CTRL_RTC_SET_TIME:
6262
ret = TRY_DO_RTC_FUNC(rtc_core, set_secs, args);
6363
break;
64+
case RT_DEVICE_CTRL_RTC_GET_TIME_US:
65+
ret = TRY_DO_RTC_FUNC(rtc_core, get_usecs, args);
66+
break;
67+
case RT_DEVICE_CTRL_RTC_SET_TIME_US:
68+
ret = TRY_DO_RTC_FUNC(rtc_core, set_usecs, args);
69+
break;
6470
case RT_DEVICE_CTRL_RTC_GET_ALARM:
6571
ret = TRY_DO_RTC_FUNC(rtc_core, get_alarm, args);
6672
break;

0 commit comments

Comments
 (0)