diff options
| author | tangweikang <[email protected]> | 2019-08-30 15:38:05 +0800 |
|---|---|---|
| committer | tangweikang <[email protected]> | 2019-08-30 15:58:52 +0800 |
| commit | b76d3dac8a92b36993169e5d38a6960b3210af04 (patch) | |
| tree | a9a75b445304ce4dd542a0c64db84dc7b5927c94 /components/drivers/include | |
| parent | 05b1dff0946c846926b4159b52b3e45156a5f7fc (diff) | |
[components][drivers] change name: encoder -> pulse_encoder
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/encoder.h | 58 | ||||
| -rw-r--r-- | components/drivers/include/drivers/pulse_encoder.h | 58 | ||||
| -rw-r--r-- | components/drivers/include/rtdevice.h | 4 |
3 files changed, 60 insertions, 60 deletions
diff --git a/components/drivers/include/drivers/encoder.h b/components/drivers/include/drivers/encoder.h deleted file mode 100644 index f338f9e845..0000000000 --- a/components/drivers/include/drivers/encoder.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-08-08 balanceTWK the first version - */ - -#ifndef __ENCODER_H__ -#define __ENCODER_H__ - -#include <rtthread.h> -#include <rtdevice.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* encoder control command */ -#define ENCODER_CMD_GET_TYPE (128 + 0) /* get a encoder type information */ -#define ENCODER_CMD_ENABLE (128 + 1) /* enable encoder */ -#define ENCODER_CMD_DISABLE (128 + 2) /* disable encoder */ -#define ENCODER_CMD_CLEAR_COUNT (128 + 3) /* clear encoder count */ - -/* encoder type */ -enum rt_encoder_type -{ - UNKNOWN_ENCODER_TYPE = 0x00, /* Unknown encoder type */ - SINGLE_PHASE_ENCODER, /* single phase encoder */ - AB_PHASE_ENCODER /* two phase encoder */ -}; - -struct rt_encoder_device; - -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); -}; - -struct rt_encoder_device -{ - struct rt_device parent; - const struct rt_encoder_ops *ops; - enum rt_encoder_type type; -}; - -rt_err_t rt_device_encoder_register(struct rt_encoder_device *encoder, const char *name, void *user_data); - -#ifdef __cplusplus -} -#endif - -#endif /* __ENCODER_H__ */ diff --git a/components/drivers/include/drivers/pulse_encoder.h b/components/drivers/include/drivers/pulse_encoder.h new file mode 100644 index 0000000000..0c7df04cd6 --- /dev/null +++ b/components/drivers/include/drivers/pulse_encoder.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-08-08 balanceTWK the first version + */ + +#ifndef __PULSE_ENCODER_H__ +#define __PULSE_ENCODER_H__ + +#include <rtthread.h> +#include <rtdevice.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* pulse_encoder control command */ +#define PULSE_ENCODER_CMD_GET_TYPE (128 + 0) /* get a pulse_encoder type information */ +#define PULSE_ENCODER_CMD_ENABLE (128 + 1) /* enable pulse_encoder */ +#define PULSE_ENCODER_CMD_DISABLE (128 + 2) /* disable pulse_encoder */ +#define PULSE_ENCODER_CMD_CLEAR_COUNT (128 + 3) /* clear pulse_encoder count */ + +/* pulse_encoder type */ +enum rt_pulse_encoder_type +{ + UNKNOWN_PULSE_ENCODER_TYPE = 0x00, /* Unknown pulse_encoder type */ + SINGLE_PHASE_PULSE_ENCODER, /* single phase pulse_encoder */ + AB_PHASE_PULSE_ENCODER /* two phase pulse_encoder */ +}; + +struct rt_pulse_encoder_device; + +struct rt_pulse_encoder_ops +{ + rt_err_t (*init)(struct rt_pulse_encoder_device *pulse_encoder); + rt_int32_t (*get_count)(struct rt_pulse_encoder_device *pulse_encoder); + rt_err_t (*clear_count)(struct rt_pulse_encoder_device *pulse_encoder); + rt_err_t (*control)(struct rt_pulse_encoder_device *pulse_encoder, rt_uint32_t cmd, void *args); +}; + +struct rt_pulse_encoder_device +{ + struct rt_device parent; + const struct rt_pulse_encoder_ops *ops; + enum rt_pulse_encoder_type type; +}; + +rt_err_t rt_device_pulse_encoder_register(struct rt_pulse_encoder_device *pulse_encoder, const char *name, void *user_data); + +#ifdef __cplusplus +} +#endif + +#endif /* __PULSE_ENCODER_H__ */ diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index bb302ac2af..623c085430 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -126,8 +126,8 @@ extern "C" { #include "drivers/crypto.h" #endif -#ifdef RT_USING_ENCODER -#include "drivers/encoder.h" +#ifdef RT_USING_PULSE_ENCODER +#include "drivers/pulse_encoder.h" #endif #ifdef RT_USING_INPUT_CAPTURE |
