HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
tmc51x0::PinActiveLevels Struct Reference

Pin active level configuration structure. More...

#include <tmc51x0_comm_interface.hpp>

Public Member Functions

bool GetActiveLevel (TMC51x0CtrlPin pin) const noexcept
 Get active level for a specific pin.
 
void SetActiveLevel (TMC51x0CtrlPin pin, bool active_level) noexcept
 Set active level for a specific pin.
 

Public Attributes

bool en {false}
 EN pin (DRV_ENN, pin 28): LOW=enable (active LOW)
 
bool dir {true}
 DIR pin (REFR_DIR, pin 18): HIGH=active (active HIGH)
 
bool step {true}
 STEP pin (REFL_STEP, pin 17): HIGH=active (active HIGH)
 
bool ref_left
 REFL_STEP (pin 17): LOW=active (typically active LOW)
 
bool ref_right
 REFR_DIR (pin 18): LOW=active (typically active LOW)
 
bool diag0 {true}
 
bool diag1 {true}
 
bool enca {true}
 
bool encb {true}
 
bool encn {true}
 
bool dcen {true}
 DCEN (pin 23): HIGH=active (active HIGH)
 
bool dcin {true}
 DCIN (pin 24): HIGH=active (active HIGH)
 
bool dco {true}
 
bool clk
 CLK (pin 12): HIGH=active (active HIGH, if used as output)
 
bool spi_mode {true}
 SPI_MODE (pin 22): HIGH=SPI mode (active HIGH)
 
bool sd_mode
 SD_MODE (pin 21): HIGH=External Step/Dir (active HIGH)
 

Detailed Description

Pin active level configuration structure.

This structure defines the physical GPIO level (HIGH or LOW) that corresponds to the ACTIVE state for each TMC51x0 control pin. Default values are based on the TMC51x0 datasheet specifications.

Users can create an instance of this struct, modify specific pin active levels if their board has inverters, NOT gates, or other logic that changes pin polarity, and pass it to the communication interface constructor.

Example usage:

// Use defaults (datasheet-compliant)
tmc51x0::PinActiveLevels active_levels; // Uses all defaults
// Override for custom board with inverter on EN pin
tmc5160::PinActiveLevels active_levels;
active_levels.en = true; // EN pin has inverter, so ACTIVE = HIGH
// Pass to constructor (ESP32-specific example - see esp32_tmc51x0_bus.hpp)
// Esp32SPI spi(SPI2_HOST, pin_config, 4000000, active_levels);
Pin active level configuration structure.
Definition tmc51x0_comm_interface.hpp:352
bool en
EN pin (DRV_ENN, pin 28): LOW=enable (active LOW)
Definition tmc51x0_comm_interface.hpp:354
Note
Platform-specific pin configuration structures (like Esp32SpiPinConfig) are defined in platform-specific implementation files, not in this core interface.

Member Function Documentation

◆ GetActiveLevel()

bool tmc51x0::PinActiveLevels::GetActiveLevel ( TMC51x0CtrlPin pin) const
inlinenoexcept

Get active level for a specific pin.

Parameters
pinThe TMC51x0 control pin
Returns
The active level (true=HIGH, false=LOW) for the pin
Here is the caller graph for this function:

◆ SetActiveLevel()

void tmc51x0::PinActiveLevels::SetActiveLevel ( TMC51x0CtrlPin pin,
bool active_level )
inlinenoexcept

Set active level for a specific pin.

Parameters
pinThe TMC51x0 control pin
active_levelThe active level (true=HIGH, false=LOW)
Here is the caller graph for this function:

Member Data Documentation

◆ clk

bool tmc51x0::PinActiveLevels::clk
Initial value:
{
true}

CLK (pin 12): HIGH=active (active HIGH, if used as output)

◆ dcen

bool tmc51x0::PinActiveLevels::dcen {true}

DCEN (pin 23): HIGH=active (active HIGH)

◆ dcin

bool tmc51x0::PinActiveLevels::dcin {true}

DCIN (pin 24): HIGH=active (active HIGH)

◆ dco

bool tmc51x0::PinActiveLevels::dco {true}

DCO (pin 25): Read-only output (default HIGH, but not used for control)

◆ diag0

bool tmc51x0::PinActiveLevels::diag0 {true}

DIAG0 (pin 26): Read-only output (default HIGH, but not used for control)

◆ diag1

bool tmc51x0::PinActiveLevels::diag1 {true}

DIAG1 (pin 27): Read-only output (default HIGH, but not used for control)

◆ dir

bool tmc51x0::PinActiveLevels::dir {true}

DIR pin (REFR_DIR, pin 18): HIGH=active (active HIGH)

◆ en

bool tmc51x0::PinActiveLevels::en {false}

EN pin (DRV_ENN, pin 28): LOW=enable (active LOW)

◆ enca

bool tmc51x0::PinActiveLevels::enca {true}

ENCA (pin 24): Read-only input (default HIGH, but not used for control)

◆ encb

bool tmc51x0::PinActiveLevels::encb {true}

ENCB (pin 23): Read-only input (default HIGH, but not used for control)

◆ encn

bool tmc51x0::PinActiveLevels::encn {true}

ENCN (pin 25): Read-only input (default HIGH, but not used for control)

◆ ref_left

bool tmc51x0::PinActiveLevels::ref_left
Initial value:
{
false}

REFL_STEP (pin 17): LOW=active (typically active LOW)

◆ ref_right

bool tmc51x0::PinActiveLevels::ref_right
Initial value:
{
false}

REFR_DIR (pin 18): LOW=active (typically active LOW)

◆ sd_mode

bool tmc51x0::PinActiveLevels::sd_mode
Initial value:
{
true}

SD_MODE (pin 21): HIGH=External Step/Dir (active HIGH)

◆ spi_mode

bool tmc51x0::PinActiveLevels::spi_mode {true}

SPI_MODE (pin 22): HIGH=SPI mode (active HIGH)

◆ step

bool tmc51x0::PinActiveLevels::step {true}

STEP pin (REFL_STEP, pin 17): HIGH=active (active HIGH)


The documentation for this struct was generated from the following file: