[components][rtc] Add microsecond resolution support with RTC framework V2.0

This commit is contained in:
iysheng 2021-07-05 14:00:37 +08:00
parent e62943abd2
commit 2bd7e04827
2 changed files with 8 additions and 0 deletions

View File

@ -27,6 +27,8 @@ struct rt_rtc_ops
rt_err_t (*set_secs)(void *arg);
rt_err_t (*get_alarm)(void *arg);
rt_err_t (*set_alarm)(void *arg);
rt_err_t (*get_usecs)(void *arg);
rt_err_t (*set_usecs)(void *arg);
};
typedef struct rt_rtc_device

View File

@ -61,6 +61,12 @@ static rt_err_t rt_rtc_core_control(struct rt_device *dev,
case RT_DEVICE_CTRL_RTC_SET_TIME:
ret = TRY_DO_RTC_FUNC(rtc_core, set_secs, args);
break;
case RT_DEVICE_CTRL_RTC_GET_TIME_US:
ret = TRY_DO_RTC_FUNC(rtc_core, get_usecs, args);
break;
case RT_DEVICE_CTRL_RTC_SET_TIME_US:
ret = TRY_DO_RTC_FUNC(rtc_core, set_usecs, args);
break;
case RT_DEVICE_CTRL_RTC_GET_ALARM:
ret = TRY_DO_RTC_FUNC(rtc_core, get_alarm, args);
break;