Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Stepper-Drv

Interface for stepper-drv drivers. More...

Macros

#define MICRO_STEP_RES_INDEX(res)
 Macro to calculate the index of the microstep resolution.
#define VALID_MICRO_STEP_RES(res)

Enumerations

enum  stepper_drv_micro_step_resolution {
  STEPPER_DRV_MICRO_STEP_1 = 1 , STEPPER_DRV_MICRO_STEP_2 = 2 , STEPPER_DRV_MICRO_STEP_4 = 4 , STEPPER_DRV_MICRO_STEP_8 = 8 ,
  STEPPER_DRV_MICRO_STEP_16 = 16 , STEPPER_DRV_MICRO_STEP_32 = 32 , STEPPER_DRV_MICRO_STEP_64 = 64 , STEPPER_DRV_MICRO_STEP_128 = 128 ,
  STEPPER_DRV_MICRO_STEP_256 = 256
}
 Stepper Motor micro-step resolution options. More...
enum  stepper_drv_event { STEPPER_DRV_EVENT_STALL_DETECTED = 0 , STEPPER_DRV_EVENT_FAULT_DETECTED = 1 }

Functions

int stepper_drv_enable (const struct device *dev)
 Enable stepper driver.
int stepper_drv_disable (const struct device *dev)
 Disable stepper driver.
int stepper_drv_set_micro_step_res (const struct device *dev, enum stepper_drv_micro_step_resolution res)
 Set the micro-step resolution in stepper driver.
int stepper_drv_get_micro_step_res (const struct device *dev, enum stepper_drv_micro_step_resolution *res)
 Get the micro-step resolution in stepper driver.
int stepper_drv_set_event_cb (const struct device *dev, stepper_drv_event_cb_t callback, void *user_data)
 Set the callback function to be called when a stepper_drv_event occurs.

Detailed Description

Interface for stepper-drv drivers.

Since
4.0
Version
0.8.0

Macro Definition Documentation

◆ MICRO_STEP_RES_INDEX

#define MICRO_STEP_RES_INDEX ( res)

#include <zephyr/drivers/stepper.h>

Value:
LOG2(res)
#define LOG2(x)
Compute log2(x).
Definition util.h:879

Macro to calculate the index of the microstep resolution.

Parameters
resMicrostep resolution

◆ VALID_MICRO_STEP_RES

#define VALID_MICRO_STEP_RES ( res)

#include <zephyr/drivers/stepper.h>

Value:
@ STEPPER_DRV_MICRO_STEP_2
2 micro-steps per full step
Definition stepper.h:413
@ STEPPER_DRV_MICRO_STEP_64
64 micro-steps per full step
Definition stepper.h:423
@ STEPPER_DRV_MICRO_STEP_128
128 micro-steps per full step
Definition stepper.h:425
@ STEPPER_DRV_MICRO_STEP_8
8 micro-steps per full step
Definition stepper.h:417
@ STEPPER_DRV_MICRO_STEP_1
Full step resolution.
Definition stepper.h:411
@ STEPPER_DRV_MICRO_STEP_32
32 micro-steps per full step
Definition stepper.h:421
@ STEPPER_DRV_MICRO_STEP_16
16 micro-steps per full step
Definition stepper.h:419
@ STEPPER_DRV_MICRO_STEP_4
4 micro-steps per full step
Definition stepper.h:415
@ STEPPER_DRV_MICRO_STEP_256
256 micro-steps per full step
Definition stepper.h:427

Enumeration Type Documentation

◆ stepper_drv_event

#include <zephyr/drivers/stepper.h>

Enumerator
STEPPER_DRV_EVENT_STALL_DETECTED 

Stepper driver stall detected.

STEPPER_DRV_EVENT_FAULT_DETECTED 

Stepper driver fault detected.

◆ stepper_drv_micro_step_resolution

#include <zephyr/drivers/stepper.h>

Stepper Motor micro-step resolution options.

Enumerator
STEPPER_DRV_MICRO_STEP_1 

Full step resolution.

STEPPER_DRV_MICRO_STEP_2 

2 micro-steps per full step

STEPPER_DRV_MICRO_STEP_4 

4 micro-steps per full step

STEPPER_DRV_MICRO_STEP_8 

8 micro-steps per full step

STEPPER_DRV_MICRO_STEP_16 

16 micro-steps per full step

STEPPER_DRV_MICRO_STEP_32 

32 micro-steps per full step

STEPPER_DRV_MICRO_STEP_64 

64 micro-steps per full step

STEPPER_DRV_MICRO_STEP_128 

128 micro-steps per full step

STEPPER_DRV_MICRO_STEP_256 

256 micro-steps per full step

Function Documentation

◆ stepper_drv_disable()

int stepper_drv_disable ( const struct device * dev)

#include <zephyr/drivers/stepper.h>

Disable stepper driver.

Disabling the driver shall switch off the power stage and de-energize the coils.

Parameters
devpointer to the device structure for the driver instance.
Return values
-ENOTSUPDisabling of driver is not supported.
-EIOError during Disabling
0Success

◆ stepper_drv_enable()

int stepper_drv_enable ( const struct device * dev)

#include <zephyr/drivers/stepper.h>

Enable stepper driver.

Enabling the driver shall switch on the power stage and energize the coils.

Parameters
devpointer to the device structure for the driver instance.
Return values
-EIOError during Enabling
0Success

◆ stepper_drv_get_micro_step_res()

int stepper_drv_get_micro_step_res ( const struct device * dev,
enum stepper_drv_micro_step_resolution * res )

#include <zephyr/drivers/stepper.h>

Get the micro-step resolution in stepper driver.

Parameters
devpointer to the device structure for the driver instance.
resmicro-step resolution
Return values
-EIOGeneral input / output error
0Success

◆ stepper_drv_set_event_cb()

int stepper_drv_set_event_cb ( const struct device * dev,
stepper_drv_event_cb_t callback,
void * user_data )

#include <zephyr/drivers/stepper.h>

Set the callback function to be called when a stepper_drv_event occurs.

Parameters
devpointer to the device structure for the driver instance.
callbackCallback function to be called when a stepper_drv_event occurs passing NULL will disable the callback
user_dataUser data to be passed to the callback function
Return values
-ENOSYSIf not implemented by device driver
0Success

◆ stepper_drv_set_micro_step_res()

int stepper_drv_set_micro_step_res ( const struct device * dev,
enum stepper_drv_micro_step_resolution res )

#include <zephyr/drivers/stepper.h>

Set the micro-step resolution in stepper driver.

Parameters
devpointer to the device structure for the driver instance.
resmicro-step resolution
Return values
-EIOGeneral input / output error
-EINVALIf the requested resolution is invalid
-ENOTSUPIf the requested resolution is not supported
0Success