mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[components][drivers] change name: encoder -> pulse_encoder
This commit is contained in:
@@ -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__ */
|
||||
@@ -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__ */
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user