Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ add_subdirectory_ifdef(CONFIG_SERIAL serial)
add_subdirectory_ifdef(CONFIG_SMBUS smbus)
add_subdirectory_ifdef(CONFIG_SPI spi)
add_subdirectory_ifdef(CONFIG_STEPPER stepper)
add_subdirectory_ifdef(CONFIG_STEPPER_CONTROL stepper_control)
add_subdirectory_ifdef(CONFIG_SYSCON syscon)
add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer)
add_subdirectory_ifdef(CONFIG_TEE tee)
Expand Down
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ source "drivers/sip_svc/Kconfig"
source "drivers/smbus/Kconfig"
source "drivers/spi/Kconfig"
source "drivers/stepper/Kconfig"
source "drivers/stepper_control/Kconfig"
source "drivers/syscon/Kconfig"
source "drivers/timer/Kconfig"
source "drivers/usb/Kconfig"
Expand Down
2 changes: 1 addition & 1 deletion drivers/stepper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ zephyr_library()
zephyr_library_property(ALLOW_EMPTY TRUE)

zephyr_library_sources_ifdef(CONFIG_FAKE_STEPPER fake_stepper_controller.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_STEPPER gpio_stepper_controller.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_STEPPER gpio_stepper_driver.c)
zephyr_library_sources_ifdef(CONFIG_STEPPER_SHELL stepper_shell.c)
4 changes: 2 additions & 2 deletions drivers/stepper/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# SPDX-License-Identifier: Apache-2.0

menuconfig STEPPER
bool "Stepper Controller"
bool "Stepper Driver"
help
Enable stepper controller
Enable stepper driver

if STEPPER

Expand Down
3 changes: 1 addition & 2 deletions drivers/stepper/adi_tmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
zephyr_library()
zephyr_library_property(ALLOW_EMPTY TRUE)

zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC_SPI adi_tmc_spi.c)
zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC2209 tmc22xx.c)
zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC50XX tmc50xx.c)
zephyr_library_sources_ifdef(CONFIG_ADI_TMC5XXX_STEPPER_DRIVER tmc5xxx_stepper_driver.c)
zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC51XX tmc51xx.c)
5 changes: 2 additions & 3 deletions drivers/stepper/adi_tmc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ config STEPPER_ADI_TMC_SPI
depends on STEPPER_ADI_TMC
select SPI
help
A Trinamic Stepper Controller with SPI is enabled
A Trinamic Stepper Driver with SPI is enabled

comment "Trinamic Stepper Drivers"

rsource "Kconfig.tmc22xx"
rsource "Kconfig.tmc50xx"
rsource "Kconfig.tmc51xx"
rsource "Kconfig.tmc5xxx"

endif # STEPPER_ADI_TMC
8 changes: 8 additions & 0 deletions drivers/stepper/adi_tmc/Kconfig.tmc5xxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya
# SPDX-License-Identifier: Apache-2.0

config ADI_TMC5XXX_STEPPER_DRIVER
bool "Activate trinamic tmc5xxx stepper driver"
depends on DT_HAS_ADI_TMC5XXX_STEPPER_DRIVER_ENABLED
select STEPPER_ADI_TMC_SPI
default y
19 changes: 5 additions & 14 deletions drivers/stepper/adi_tmc/tmc22xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,25 @@ struct tmc22xx_config {
};

struct tmc22xx_data {
struct step_dir_stepper_common_data common;
enum stepper_micro_step_resolution resolution;
};

STEP_DIR_STEPPER_STRUCT_CHECK(struct tmc22xx_config, struct tmc22xx_data);
STEP_DIR_STEPPER_STRUCT_CHECK(struct tmc22xx_config);

static int tmc22xx_stepper_enable(const struct device *dev)
{
const struct tmc22xx_config *config = dev->config;

LOG_DBG("Enabling Stepper motor controller %s", dev->name);
return gpio_pin_set_dt(&config->enable_pin, 1);
return gpio_pin_set_dt(&config->enable_pin, 0);
}

static int tmc22xx_stepper_disable(const struct device *dev)
{
const struct tmc22xx_config *config = dev->config;

LOG_DBG("Disabling Stepper motor controller %s", dev->name);
return gpio_pin_set_dt(&config->enable_pin, 0);
return gpio_pin_set_dt(&config->enable_pin, 1);
}

static int tmc22xx_stepper_set_micro_step_res(const struct device *dev,
Expand Down Expand Up @@ -150,15 +149,8 @@ static int tmc22xx_stepper_init(const struct device *dev)
static DEVICE_API(stepper, tmc22xx_stepper_api) = {
.enable = tmc22xx_stepper_enable,
.disable = tmc22xx_stepper_disable,
.move_by = step_dir_stepper_common_move_by,
.is_moving = step_dir_stepper_common_is_moving,
.set_reference_position = step_dir_stepper_common_set_reference_position,
.get_actual_position = step_dir_stepper_common_get_actual_position,
.move_to = step_dir_stepper_common_move_to,
.set_microstep_interval = step_dir_stepper_common_set_microstep_interval,
.run = step_dir_stepper_common_run,
.stop = step_dir_stepper_common_stop,
.set_event_callback = step_dir_stepper_common_set_event_callback,
.step = step_dir_stepper_common_step,
.set_direction = step_dir_stepper_common_set_direction,
.set_micro_step_res = tmc22xx_stepper_set_micro_step_res,
.get_micro_step_res = tmc22xx_stepper_get_micro_step_res,
};
Expand All @@ -183,7 +175,6 @@ static DEVICE_API(stepper, tmc22xx_stepper_api) = {
(.msx_pins = tmc22xx_stepper_msx_pins_##inst)) \
}; \
static struct tmc22xx_data tmc22xx_data_##inst = { \
.common = STEP_DIR_STEPPER_DT_INST_COMMON_DATA_INIT(inst), \
.resolution = DT_INST_PROP(inst, micro_step_res), \
}; \
DEVICE_DT_INST_DEFINE(inst, tmc22xx_stepper_init, NULL, &tmc22xx_data_##inst, \
Expand Down
Loading
Loading