// TMC2209 stepper driver init

#if AXIS1_DRIVER_MODEL == TMC2209_QUIET
  #undef AXIS1_DRIVER_MODEL
  #define AXIS1_DRIVER_MODEL TMC2209
  #undef AXIS1_DRIVER_DECAY_MODE
  #define AXIS1_DRIVER_DECAY_MODE STEALTHCHOP
#elif AXIS1_DRIVER_MODEL == TMC2209_VQUIET
  #undef AXIS1_DRIVER_MODEL
  #define AXIS1_DRIVER_MODEL TMC2209
  #undef AXIS1_DRIVER_DECAY_MODE
  #define AXIS1_DRIVER_DECAY_MODE STEALTHCHOP
  #undef AXIS1_DRIVER_DECAY_MODE_GOTO
  #define AXIS1_DRIVER_DECAY_MODE_GOTO STEALTHCHOP
#endif

#if AXIS2_DRIVER_MODEL == TMC2209_QUIET
  #undef AXIS2_DRIVER_MODEL
  #define AXIS2_DRIVER_MODEL TMC2209
  #undef AXIS2_DRIVER_DECAY_MODE
  #define AXIS2_DRIVER_DECAY_MODE STEALTHCHOP
#elif AXIS2_DRIVER_MODEL == TMC2209_VQUIET
  #undef AXIS2_DRIVER_MODEL
  #define AXIS2_DRIVER_MODEL TMC2209
  #undef AXIS2_DRIVER_DECAY_MODE
  #define AXIS2_DRIVER_DECAY_MODE STEALTHCHOP
  #undef AXIS2_DRIVER_DECAY_MODE_GOTO
  #define AXIS2_DRIVER_DECAY_MODE_GOTO STEALTHCHOP
#endif

#if AXIS1_DRIVER_MODEL == TMC2209
  #define AXIS1_DRIVER_DISABLE_M2
  #if AXIS1_DRIVER_DECAY_MODE != OFF
    #if AXIS1_DRIVER_DECAY_MODE == STEALTHCHOP
      #undef AXIS1_DRIVER_DECAY_MODE
      #define AXIS1_DRIVER_DECAY_MODE LOW
    #elif AXIS1_DRIVER_DECAY_MODE == SPREADCYCLE
      #undef AXIS1_DRIVER_DECAY_MODE
      #define AXIS1_DRIVER_DECAY_MODE HIGH
    #else
      #error "Configuration (Config.h): AXIS1_DRIVER_DECAY_MODE; Invalid option for TMC2209 stepper driver."
    #endif
  #else
    #undef AXIS1_DRIVER_DECAY_MODE
    #define AXIS1_DRIVER_DECAY_MODE HIGH
  #endif
  #if AXIS1_DRIVER_DECAY_MODE_GOTO != OFF
    #if AXIS1_DRIVER_DECAY_MODE_GOTO == STEALTHCHOP
      #undef AXIS1_DRIVER_DECAY_MODE_GOTO
      #define AXIS1_DRIVER_DECAY_MODE_GOTO LOW
    #elif AXIS1_DRIVER_DECAY_MODE_GOTO == SPREADCYCLE
      #undef AXIS1_DRIVER_DECAY_MODE_GOTO
      #define AXIS1_DRIVER_DECAY_MODE_GOTO HIGH
    #else
      #error "Configuration (Config.h): AXIS1_DRIVER_DECAY_MODE_GOTO; Invalid option for TMC2209 stepper driver."
    #endif
  #else
    #undef AXIS1_DRIVER_DECAY_MODE_GOTO
    #define AXIS1_DRIVER_DECAY_MODE_GOTO HIGH
  #endif
#endif

#if AXIS2_DRIVER_MODEL == TMC2209
  #define AXIS2_DRIVER_DISABLE_M2
  #if AXIS2_DRIVER_DECAY_MODE != OFF
    #if AXIS2_DRIVER_DECAY_MODE == STEALTHCHOP
      #undef AXIS2_DRIVER_DECAY_MODE
      #define AXIS2_DRIVER_DECAY_MODE LOW
    #elif AXIS2_DRIVER_DECAY_MODE == SPREADCYCLE
      #undef AXIS2_DRIVER_DECAY_MODE
      #define AXIS2_DRIVER_DECAY_MODE HIGH
    #else
      #error "Configuration (Config.h): AXIS2_DRIVER_DECAY_MODE; Invalid option for TMC2209 stepper driver."
    #endif
  #else
    #undef AXIS2_DRIVER_DECAY_MODE
    #define AXIS2_DRIVER_DECAY_MODE HIGH
  #endif
  #if AXIS2_DRIVER_DECAY_MODE_GOTO != OFF
    #if AXIS2_DRIVER_DECAY_MODE_GOTO == STEALTHCHOP
      #undef AXIS2_DRIVER_DECAY_MODE_GOTO
      #define AXIS2_DRIVER_DECAY_MODE_GOTO LOW
    #elif AXIS2_DRIVER_DECAY_MODE_GOTO == SPREADCYCLE
      #undef AXIS2_DRIVER_DECAY_MODE_GOTO
      #define AXIS2_DRIVER_DECAY_MODE_GOTO HIGH
    #else
      #error "Configuration (Config.h): AXIS2_DRIVER_DECAY_MODE_GOTO; Invalid option for TMC2209 stepper driver."
    #endif
  #else
    #undef AXIS2_DRIVER_DECAY_MODE_GOTO
    #define AXIS2_DRIVER_DECAY_MODE_GOTO HIGH
  #endif
#endif
