[components][drivers] update : Move clear_count() function from ops->control() to ops->clear_count()

This commit is contained in:
tangweikang 2019-08-12 13:47:03 +08:00
parent e5dc60e3cf
commit 2b9a9e0163
2 changed files with 4 additions and 1 deletions

View File

@ -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);
};

View File

@ -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: