|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2006-2023, RT-Thread Development Team |
| 2 | + * Copyright (c) 2006-2024 RT-Thread Development Team |
3 | 3 | *
|
4 | 4 | * SPDX-License-Identifier: Apache-2.0
|
5 | 5 | *
|
@@ -226,8 +226,11 @@ static int rt_soft_rtc_init(void)
|
226 | 226 | {
|
227 | 227 | return 0;
|
228 | 228 | }
|
229 |
| - /* make sure only one 'sw_rtc' device */ |
230 |
| - RT_ASSERT(!rt_device_find("sw_rtc")); |
| 229 | + /* make sure only one 'rtc' device */ |
| 230 | +#if defined(RT_USING_SOFT_RTC) && defined(RT_USING_RTC) |
| 231 | +#warning "Please note: Currently only one RTC device is allowed in the system, and the name is "rtc"." |
| 232 | +#endif |
| 233 | + RT_ASSERT(!rt_device_find("rtc")); |
231 | 234 |
|
232 | 235 | #ifdef RT_USING_ALARM
|
233 | 236 | rt_timer_init(&alarm_time,
|
@@ -258,7 +261,7 @@ static int rt_soft_rtc_init(void)
|
258 | 261 | /* no private */
|
259 | 262 | soft_rtc_dev.user_data = RT_NULL;
|
260 | 263 |
|
261 |
| - rt_device_register(&soft_rtc_dev, "sw_rtc", RT_DEVICE_FLAG_RDWR); |
| 264 | + rt_device_register(&soft_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR); |
262 | 265 |
|
263 | 266 | source_device = &soft_rtc_dev;
|
264 | 267 |
|
@@ -294,7 +297,7 @@ static void rtc_sync_work_func(struct rt_work *work, void *work_data)
|
294 | 297 | rt_err_t rt_soft_rtc_set_source(const char *name)
|
295 | 298 | {
|
296 | 299 | RT_ASSERT(name != RT_NULL);
|
297 |
| - RT_ASSERT(rt_device_find(name)); // make sure source is exist |
| 300 | + RT_ASSERT(rt_device_find(name)); /* make sure source is exist*/ |
298 | 301 |
|
299 | 302 | source_device = rt_device_find(name);
|
300 | 303 | rt_work_init(&rtc_sync_work, rtc_sync_work_func, RT_NULL);
|
|
0 commit comments