Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
stepper_ctrl.h File Reference

Main header file for stepper motion controller driver API. More...

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <errno.h>
#include <zephyr/syscalls/stepper_ctrl.h>

Go to the source code of this file.

Data Structures

struct  stepper_ctrl_ramp
 Steper Motion Controller Ramp Parameters. More...
struct  stepper_ctrl_driver_api
  Driver Operations Stepper Motion Controller driver operations More...

Typedefs

typedef void(* stepper_ctrl_event_callback_t) (const struct device *dev, const enum stepper_ctrl_event event, void *user_data)
 Callback function for stepper motion controller events.
typedef int(* stepper_ctrl_set_reference_position_t) (const struct device *dev, const int32_t value)
 Set the reference position of the stepper motion controller.
typedef int(* stepper_ctrl_get_actual_position_t) (const struct device *dev, int32_t *value)
 Get the actual a.k.a reference position of the stepper motion controller.
typedef int(* stepper_ctrl_set_event_cb_t) (const struct device *dev, stepper_ctrl_event_callback_t callback, void *user_data)
 Set the callback function to be called when a stepper motion controller event occurs.
typedef int(* stepper_ctrl_set_microstep_interval_t) (const struct device *dev, const uint64_t microstep_interval_ns)
 Set the time interval between steps in nanoseconds.
typedef int(* stepper_ctrl_configure_ramp_t) (const struct device *dev, const struct stepper_ctrl_ramp *ramp)
 Configure the ramp parameters for the stepper motion controller.
typedef int(* stepper_ctrl_move_by_t) (const struct device *dev, const int32_t micro_steps)
 Move the stepper relatively by a given number of micro-steps.
typedef int(* stepper_ctrl_move_to_t) (const struct device *dev, const int32_t micro_steps)
 Move the stepper to an absolute position in micro-steps.
typedef int(* stepper_ctrl_run_t) (const struct device *dev, const enum stepper_ctrl_direction direction)
 Run the stepper with a given step interval in a given direction.
typedef int(* stepper_ctrl_stop_t) (const struct device *dev)
 Stop the stepper.
typedef int(* stepper_ctrl_is_moving_t) (const struct device *dev, bool *is_moving)
 Is the target position fo the stepper reached.

Enumerations

enum  stepper_ctrl_direction { STEPPER_CTRL_DIRECTION_NEGATIVE = 0 , STEPPER_CTRL_DIRECTION_POSITIVE = 1 }
 Stepper Motion Controller direction options. More...
enum  stepper_ctrl_run_mode { STEPPER_CTRL_RUN_MODE_HOLD = 0 , STEPPER_CTRL_RUN_MODE_POSITION = 1 , STEPPER_CTRL_RUN_MODE_VELOCITY = 2 }
 Stepper Motion Controller run mode options. More...
enum  stepper_ctrl_event { STEPPER_CTRL_EVENT_STEPS_COMPLETED = 0 , STEPPER_CTRL_EVENT_LEFT_END_STOP_DETECTED = 1 , STEPPER_CTRL_EVENT_RIGHT_END_STOP_DETECTED = 2 , STEPPER_CTRL_EVENT_STOPPED = 3 }
 Stepper Motion Controller Events. More...

Functions

int stepper_ctrl_set_reference_position (const struct device *dev, const int32_t value)
 Set the reference position.
int stepper_ctrl_get_actual_position (const struct device *dev, int32_t *value)
 Get the actual step count.
int stepper_ctrl_set_event_cb (const struct device *dev, stepper_ctrl_event_callback_t callback, void *user_data)
 Set the callback function to be called when a stepper motion controller event occurs.
int stepper_ctrl_set_microstep_interval (const struct device *dev, const uint64_t microstep_interval_ns)
 Set the time interval between steps in nanoseconds with immediate effect.
int stepper_ctrl_configure_ramp (const struct device *dev, const struct stepper_ctrl_ramp *ramp)
 Configure the ramp for the stepper motion controller.
int stepper_ctrl_move_by (const struct device *dev, const int32_t micro_steps)
 Set the micro-steps to be moved from the current position i.e.
int stepper_ctrl_move_to (const struct device *dev, const int32_t micro_steps)
 Set the absolute target position of the stepper.
int stepper_ctrl_run (const struct device *dev, const enum stepper_ctrl_direction direction)
 Run the stepper with a given step interval in a given direction.
int stepper_ctrl_stop (const struct device *dev)
 Stop the stepper.
int stepper_ctrl_is_moving (const struct device *dev, bool *is_moving)
 Check if the stepper is currently moving.

Detailed Description

Main header file for stepper motion controller driver API.