Skip to content

Commit

Permalink
drivers: stepper: tmc: add CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN
Browse files Browse the repository at this point in the history
rename CONFIG_STEPPER_ADI_RAMP_GEN to CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN

Signed-off-by: Jilay Pandya <[email protected]>
  • Loading branch information
jilaypandya committed Dec 16, 2024
1 parent a08ccfe commit 37e28b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 0 additions & 7 deletions drivers/stepper/adi_tmc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ menuconfig STEPPER_ADI_TMC

if STEPPER_ADI_TMC

config STEPPER_ADI_TMC_RAMP_GEN
bool "Use Trinamic Stepper Controller with Ramp Generator"
depends on STEPPER_ADI_TMC
default y
help
Enable ramp generator for trinamic stepper controller

config STEPPER_ADI_TMC_SPI
bool "Use Trinamic Stepper Controller with SPI"
depends on STEPPER_ADI_TMC
Expand Down
7 changes: 7 additions & 0 deletions drivers/stepper/adi_tmc/Kconfig.tmc_rampgen_template
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ config STEPPER_ADI_$(module)_RAMPSTAT_POLL_INTERVAL_IN_MSEC
default 100
help
The interval in ms to poll the ramp status on TMC.

config STEPPER_ADI_$(module)_RAMP_GEN
bool "Use $(module-str) with Ramp Generator"
depends on STEPPER_ADI_$(module)
default y
help
Enable ramp generator for trinamic stepper controller
10 changes: 5 additions & 5 deletions drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct tmc5041_stepper_config {
const uint32_t sg_threshold_velocity;
/* parent controller required for bus communication */
const struct device *controller;
#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN
#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN
const struct tmc_ramp_generator_data default_ramp_config;
#endif
};
Expand Down Expand Up @@ -537,7 +537,7 @@ static int tmc5041_stepper_run(const struct device *dev, const enum stepper_dire
return 0;
}

#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN
#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN

int tmc5041_stepper_set_ramp(const struct device *dev,
const struct tmc_ramp_generator_data *ramp_data)
Expand Down Expand Up @@ -676,7 +676,7 @@ static int tmc5041_stepper_init(const struct device *dev)
}
}

#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN
#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN
err = tmc5041_stepper_set_ramp(dev, &stepper_config->default_ramp_config);
if (err != 0) {
return -EIO;
Expand All @@ -702,7 +702,7 @@ static int tmc5041_stepper_init(const struct device *dev)
COND_CODE_1(DT_PROP_EXISTS(child, stallguard_threshold_velocity), \
BUILD_ASSERT(DT_PROP(child, stallguard_threshold_velocity), \
"stallguard threshold velocity must be a positive value"), ()); \
IF_ENABLED(CONFIG_STEPPER_ADI_TMC_RAMP_GEN, (CHECK_RAMP_DT_DATA(child))); \
IF_ENABLED(CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN, (CHECK_RAMP_DT_DATA(child))); \
static const struct tmc5041_stepper_config tmc5041_stepper_config_##child = { \
.controller = DEVICE_DT_GET(DT_PARENT(child)), \
.default_micro_step_res = DT_PROP(child, micro_step_res), \
Expand All @@ -712,7 +712,7 @@ static int tmc5041_stepper_init(const struct device *dev)
.sg_velocity_check_interval_ms = DT_PROP(child, \
stallguard_velocity_check_interval_ms), \
.is_sg_enabled = DT_PROP(child, activate_stallguard2), \
IF_ENABLED(CONFIG_STEPPER_ADI_TMC_RAMP_GEN, \
IF_ENABLED(CONFIG_STEPPER_ADI_TMC5041_RAMP_GEN, \
(.default_ramp_config = TMC_RAMP_DT_SPEC_GET(child))) };

#define TMC5041_STEPPER_DATA_DEFINE(child) \
Expand Down

0 comments on commit 37e28b6

Please sign in to comment.