mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-30 02:40:24 +08:00
[components][drivers] update : Move clear_count() function from ops->control() to ops->clear_count()
This commit is contained in:
parent
e5dc60e3cf
commit
2b9a9e0163
@ -38,6 +38,7 @@ struct rt_encoder_ops
|
||||
{
|
||||
rt_err_t (*init)(struct rt_encoder_device *encoder);
|
||||
rt_int32_t (*get_count)(struct rt_encoder_device *encoder);
|
||||
rt_err_t (*clear_count)(struct rt_encoder_device *encoder);
|
||||
rt_err_t (*control)(struct rt_encoder_device *encoder, rt_uint32_t cmd, void *args);
|
||||
};
|
||||
|
||||
|
@ -77,12 +77,14 @@ static rt_err_t rt_encoder_control(struct rt_device *dev, int cmd, void *args)
|
||||
encoder = (struct rt_encoder_device *)dev;
|
||||
switch (cmd)
|
||||
{
|
||||
case ENCODER_CMD_CLEAR_COUNT:
|
||||
result = encoder->ops->clear_count(encoder);
|
||||
break;
|
||||
case ENCODER_CMD_GET_TYPE:
|
||||
*(enum rt_encoder_type *)args = encoder->type;
|
||||
break;
|
||||
case ENCODER_CMD_ENABLE:
|
||||
case ENCODER_CMD_DISABLE:
|
||||
case ENCODER_CMD_CLEAR_COUNT:
|
||||
result = encoder->ops->control(encoder, cmd, args);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user