From 5d645e7900cb8aef1b18ac3f5037d645469288a7 Mon Sep 17 00:00:00 2001 From: hewq Date: Thu, 2 Oct 2025 20:00:57 +0800 Subject: [PATCH 1/2] warning fix: object type --- src/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/object.c b/src/object.c index f924f37bc9..2b8158e40f 100644 --- a/src/object.c +++ b/src/object.c @@ -723,7 +723,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) }; /* parameter check */ - if (name == RT_NULL || rt_object_get_information(type) == RT_NULL) + if (name == RT_NULL || rt_object_get_information((enum rt_object_class_type)type) == RT_NULL) return RT_NULL; /* which is invoke in interrupt status */ -- Gitee From 4bf3ecde534de037e3ae04d0ae38df5e22efe8ce Mon Sep 17 00:00:00 2001 From: hewq Date: Thu, 2 Oct 2025 20:05:20 +0800 Subject: [PATCH 2/2] add interface for get hwtimer count. --- components/drivers/hwtimer/hwtimer.c | 8 ++++++++ components/drivers/include/drivers/hwtimer.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c index 1b2792558d..156ec24677 100644 --- a/components/drivers/hwtimer/hwtimer.c +++ b/components/drivers/hwtimer/hwtimer.c @@ -318,6 +318,14 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args) rt_hw_interrupt_enable(level); } break; + case HWTIMER_CTRL_COUNT_GET: + { + if (timer->ops->count_get != RT_NULL) { + rt_int32_t cnt = timer->ops->count_get(timer); + *(rt_uint32_t *)args = cnt; + } + } + break; default: { if (timer->ops->control != RT_NULL) diff --git a/components/drivers/include/drivers/hwtimer.h b/components/drivers/include/drivers/hwtimer.h index 6f11ff2c54..d4623b401e 100644 --- a/components/drivers/include/drivers/hwtimer.h +++ b/components/drivers/include/drivers/hwtimer.h @@ -21,7 +21,8 @@ typedef enum HWTIMER_CTRL_FREQ_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x01, /* set the count frequency */ HWTIMER_CTRL_STOP = RT_DEVICE_CTRL_BASE(Timer) + 0x02, /* stop timer */ HWTIMER_CTRL_INFO_GET = RT_DEVICE_CTRL_BASE(Timer) + 0x03, /* get a timer feature information */ - HWTIMER_CTRL_MODE_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x04 /* Setting the timing mode(oneshot/period) */ + HWTIMER_CTRL_MODE_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x04, /* Setting the timing mode(oneshot/period) */ + HWTIMER_CTRL_COUNT_GET = RT_DEVICE_CTRL_BASE(Timer) + 0x05 /* get hwtimer count */ } rt_hwtimer_ctrl_t; /* Timing Mode */ -- Gitee