QEI

The Quadrature Encoder Interface (QEI) provides to MCUs’ hardware encoders used to monitor the speed and direction of motors and other rotary devices.

More information about accessing peripheral IO is in the Device Interface section.

Details

define QEI_VERSION

define QEI_IOC_IDENT_CHAR

define QEI_SAMPLE_T

define I_QEI_GETVERSION

define I_QEI_GETINFO

define I_QEI_SETATTR

define I_QEI_SETACTION

define I_QEI_GET

This request reads the QEI position.

Example:

u32 value;
value = ioctl(qei_fd, I_QEI_READ);

define I_QEI_GETVELOCITY

This request reads the QEI velocity.

Example:

int32_t velocity;
velocity = ioctl(qei_fd, I_QEI_GETVELOCITY);

define I_QEI_GET_VELOCITY

define I_QEI_GETINDEX

This request reads the QEI index counter.

Example:

int32_t index_pulses;
index_pulses = ioctl(qei_fd, I_QEI_GETINDEX);

define I_QEI_GET_INDEX

define I_QEI_TOTAL

enum qei_flag_t
  • QEI_FLAG_NONE
  • QEI_FLAG_SET Set the QEI attributes
  • QEI_FLAG_IS_INVERT_DIR Invert the direction
  • QEI_FLAG_IS_SIGNAL_MODE Use signal mode
  • QEI_FLAG_IS_DOUBLE_EDGE Count both edges
  • QEI_FLAG_IS_INVERT_INDEX Invert the index
  • QEI_FLAG_RESET Reset the QEI
  • QEI_FLAG_IS_RESET_POS Reset the position
  • QEI_FLAG_IS_RESET_VELOCITY Reset the velocity
  • QEI_FLAG_IS_RESET_INDEX Reset the index count
  • QEI_FLAG_IS_RESET_POS_ONINDEX Reset the position on the next index pulse

This defines the bits used in the “mode” member of qei_attr_t.


typedef u32 qei_sample_t

typedef mcu_action_t qei_action_t

struct::qei_info_t

u32 o_flags

u32 o_events

u32 resd

struct::qei_pin_assignment_t

mcu_pin_t a

mcu_pin_t b

mcu_pin_t idx

struct::qei_attr_t

This structure defines how the control structure for opening or reconfiguring the QEI port.

u32 o_flags

Flag bitmask

qei_pin_assignment_t pin_assignment

Pin assignment

u32 freq

u32 top

Maximum value

u32 velocity_freq

u32 max_position

The maximum position (QEI rolls over at this point)

u32 velocity_comp

The Velocity compare value

u32 filter

The filter coefficient (0 to disable)

u32 resd

X

Thanks for Coming!

Subscribe to news and updates