Commit 05e94ed2 authored by Jilay Pandya's avatar Jilay Pandya Committed by Benjamin Cabé
Browse files

drivers: stepper: api: rename stepper_move to stepper_move_by

rename stepper_move to stepper_move_by in following files:
- include/zephyr/drivers/stepper.h
- include/zephyr/drivers/stepper/stepper_fake.h
- doc/hardware/peripherals/stepper.rst
- doc/releases/migration-guide-4.1.rst
- drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c
- drivers/stepper/fake_stepper_controller.c
- drivers/stepper/gpio_stepper_controller.c
- drivers/stepper/stepper_shell.c
- tests/drivers/stepper/shell/src/main.c

Signed-off-by: default avatarJilay Pandya <jilay.pandya@outlook.com>
parent 220c4fff
Loading
Loading
Loading
Loading
+1 −1
Changes for doc/hardware/peripherals/stepper.rst: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ Configure Stepper Driver
Control Stepper
===============

- **Move by** +/- micro-steps also known as **relative movement** using :c:func:`stepper_move`.
- **Move by** +/- micro-steps also known as **relative movement** using :c:func:`stepper_move_by`.
- **Move to** a specific position also known as **absolute movement**
  using :c:func:`stepper_set_target_position`.
- Run continuously with a **constant velocity** in a specific direction until
+1 −0
Changes for doc/releases/migration-guide-4.1.rst: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ Stepper
  * Renamed the ``compatible`` from ``zephyr,gpio-steppers`` to :dtcompatible:`zephyr,gpio-stepper`.
  * Renamed the ``stepper_set_actual_position`` function to :c:func:`stepper_set_reference_position`.
  * Renamed the ``stepper_enable_constant_velocity_mode`` function to :c:func:`stepper_run`.
  * Renamed the ``stepper_move`` function to :c:func:`stepper_move_by`.

SPI
===
+4 −4
Changes for drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ static int tmc5041_stepper_is_moving(const struct device *dev, bool *is_moving)
	return 0;
}

static int tmc5041_stepper_move(const struct device *dev, const int32_t steps)
static int tmc5041_stepper_move_by(const struct device *dev, const int32_t micro_steps)
{
	const struct tmc5041_stepper_config *config = dev->config;
	struct tmc5041_stepper_data *data = dev->data;
@@ -320,7 +320,7 @@ static int tmc5041_stepper_move(const struct device *dev, const int32_t steps)
	if (err != 0) {
		return -EIO;
	}
	int32_t target_position = position + steps;
	int32_t target_position = position + micro_steps;

	err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index),
			    TMC5XXX_RAMPMODE_POSITIONING_MODE);
@@ -328,7 +328,7 @@ static int tmc5041_stepper_move(const struct device *dev, const int32_t steps)
		return -EIO;
	}
	LOG_DBG("Stepper motor controller %s moved to %d by steps: %d", dev->name, target_position,
		steps);
		micro_steps);
	err = tmc5041_write(config->controller, TMC5041_XTARGET(config->index), target_position);
	if (err != 0) {
		return -EIO;
@@ -723,7 +723,7 @@ static int tmc5041_stepper_init(const struct device *dev)
	static DEVICE_API(stepper, tmc5041_stepper_api_##child) = {				\
		.enable = tmc5041_stepper_enable,						\
		.is_moving = tmc5041_stepper_is_moving,						\
		.move = tmc5041_stepper_move,							\
		.move_by = tmc5041_stepper_move_by,						\
		.set_max_velocity = tmc5041_stepper_set_max_velocity,				\
		.set_micro_step_res = tmc5041_stepper_set_micro_step_res,			\
		.get_micro_step_res = tmc5041_stepper_get_micro_step_res,			\
+3 −3
Changes for drivers/stepper/fake_stepper_controller.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_enable, const struct device *, bool);

DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_is_moving, const struct device *, bool *);

DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_move, const struct device *, int32_t);
DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_move_by, const struct device *, int32_t);

DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_max_velocity, const struct device *, uint32_t);

@@ -90,7 +90,7 @@ static void fake_stepper_reset_rule_before(const struct ztest_unit_test *test, v
	ARG_UNUSED(fixture);

	RESET_FAKE(fake_stepper_enable);
	RESET_FAKE(fake_stepper_move);
	RESET_FAKE(fake_stepper_move_by);
	RESET_FAKE(fake_stepper_is_moving);
	RESET_FAKE(fake_stepper_set_max_velocity);
	RESET_FAKE(fake_stepper_set_micro_step_res);
@@ -126,7 +126,7 @@ static int fake_stepper_init(const struct device *dev)

static DEVICE_API(stepper, fake_stepper_driver_api) = {
	.enable = fake_stepper_enable,
	.move = fake_stepper_move,
	.move_by = fake_stepper_move_by,
	.is_moving = fake_stepper_is_moving,
	.set_max_velocity = fake_stepper_set_max_velocity,
	.set_micro_step_res = fake_stepper_set_micro_step_res,
+2 −2
Changes for drivers/stepper/gpio_stepper_controller.c: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ static void stepper_work_step_handler(struct k_work *work)
	}
}

static int gpio_stepper_move(const struct device *dev, int32_t micro_steps)
static int gpio_stepper_move_by(const struct device *dev, int32_t micro_steps)
{
	struct gpio_stepper_data *data = dev->data;

@@ -353,7 +353,7 @@ static int gpio_stepper_init(const struct device *dev)

static DEVICE_API(stepper, gpio_stepper_api) = {
	.enable = gpio_stepper_enable,
	.move = gpio_stepper_move,
	.move_by = gpio_stepper_move_by,
	.is_moving = gpio_stepper_is_moving,
	.set_reference_position = gpio_stepper_set_reference_position,
	.get_actual_position = gpio_stepper_get_actual_position,
Loading