Can find certain combos of code in one library

Im using a nema17 stepper and feed screw with carriage.
The goal is to have the stepper move the carriage at a certain RPM for set time continuously.
Then, I need to it spin at another RPM for a set time.
This will split back and forth accordingly until it reaches an end point.
After, the carriage will need to head back to a home postion.

Im using the Tmc2209 driver as I need quiteness.
Ive been able to get it to move at rpms and with delaymicrosecond speeds but all the coding libraries are all different and trying to mix and match them boggles my brain

Can someone help with a simple line of code that does this:
Start stepper at (set RPM) for (set Time) at (set direction)
continue stepper at different (set RPM) for (set Time)
These will be put in back and forth as I need different times
it will reach a sensor switch to (set direction) the other way, at (set RPM) until home

Thanks in advance.

Have a look at this Simple Stepper Code

If you can't adapt it to your requirement please post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different. That way we can focus on the parts you need help with rather than wasting time on things that you can do.

Stepper Motor Basics

A set time at a set speed means a set number of steps, so should be trivial to code with any
stepper library.

total_steps = rpm / 60 * steps_per_turn * microstep_factor * duration_in_seconds