@@ -176,7 +176,6 @@ static void stallguard_work_handler(struct k_work *work)
176
176
}
177
177
}
178
178
179
-
180
179
static void execute_callback (const struct device * dev , const enum stepper_event event )
181
180
{
182
181
struct tmc50xx_stepper_data * data = dev -> data ;
@@ -543,6 +542,25 @@ static int tmc50xx_stepper_run(const struct device *dev, const enum stepper_dire
543
542
return 0 ;
544
543
}
545
544
545
+ static int tmc50xx_stepper_stop (const struct device * dev )
546
+ {
547
+ const struct tmc50xx_stepper_config * config = dev -> config ;
548
+ int err ;
549
+
550
+ err = tmc50xx_write (config -> controller , TMC50XX_RAMPMODE (config -> index ),
551
+ TMC5XXX_RAMPMODE_POSITIVE_VELOCITY_MODE );
552
+ if (err != 0 ) {
553
+ return - EIO ;
554
+ }
555
+
556
+ err = tmc50xx_write (config -> controller , TMC50XX_VMAX (config -> index ), 0 );
557
+ if (err != 0 ) {
558
+ return - EIO ;
559
+ }
560
+
561
+ return 0 ;
562
+ }
563
+
546
564
#ifdef CONFIG_STEPPER_ADI_TMC50XX_RAMP_GEN
547
565
548
566
int tmc50xx_stepper_set_ramp (const struct device * dev ,
@@ -704,6 +722,7 @@ static DEVICE_API(stepper, tmc50xx_stepper_api) = {
704
722
.get_actual_position = tmc50xx_stepper_get_actual_position ,
705
723
.move_to = tmc50xx_stepper_move_to ,
706
724
.run = tmc50xx_stepper_run ,
725
+ .stop = tmc50xx_stepper_stop ,
707
726
.set_event_callback = tmc50xx_stepper_set_event_callback ,
708
727
};
709
728
0 commit comments