RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
pulse_encoder.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2023, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2019-08-08 balanceTWK the first version
9 */
10
11#ifndef __PULSE_ENCODER_H__
12#define __PULSE_ENCODER_H__
13
14#include <rtthread.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/* pulse_encoder control command */
21#define PULSE_ENCODER_CMD_GET_TYPE (128 + 0) /* get a pulse_encoder type information */
22#define PULSE_ENCODER_CMD_ENABLE (128 + 1) /* enable pulse_encoder */
23#define PULSE_ENCODER_CMD_DISABLE (128 + 2) /* disable pulse_encoder */
24#define PULSE_ENCODER_CMD_CLEAR_COUNT (128 + 3) /* clear pulse_encoder count */
25
26/* pulse_encoder type */
28{
29 UNKNOWN_PULSE_ENCODER_TYPE = 0x00, /* Unknown pulse_encoder type */
30 SINGLE_PHASE_PULSE_ENCODER, /* single phase pulse_encoder */
31 AB_PHASE_PULSE_ENCODER /* two phase pulse_encoder */
32};
33
35
37{
38 rt_err_t (*init)(struct rt_pulse_encoder_device *pulse_encoder);
39 rt_int32_t (*get_count)(struct rt_pulse_encoder_device *pulse_encoder);
40 rt_err_t (*clear_count)(struct rt_pulse_encoder_device *pulse_encoder);
41 rt_err_t (*control)(struct rt_pulse_encoder_device *pulse_encoder, rt_uint32_t cmd, void *args);
42};
43
50
51rt_err_t rt_device_pulse_encoder_register(struct rt_pulse_encoder_device *pulse_encoder, const char *name, void *user_data);
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif /* __PULSE_ENCODER_H__ */
rt_pulse_encoder_type
@ SINGLE_PHASE_PULSE_ENCODER
@ UNKNOWN_PULSE_ENCODER_TYPE
@ AB_PHASE_PULSE_ENCODER
rt_err_t rt_device_pulse_encoder_register(struct rt_pulse_encoder_device *pulse_encoder, const char *name, void *user_data)
rt_base_t rt_err_t
unsigned int rt_uint32_t
signed int rt_int32_t
const struct rt_pulse_encoder_ops * ops
enum rt_pulse_encoder_type type
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(* init)(struct rt_pulse_encoder_device *pulse_encoder)
rt_err_t(* control)(struct rt_pulse_encoder_device *pulse_encoder, rt_uint32_t cmd, void *args)