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

SPI_STATUS structure - status flags returned with each SPI datagram. More...

#include <tmc51x0_comm_interface.hpp>

Public Member Functions

bool HasError () const noexcept
 Check if any error flags are set.
 
bool ResetFlag () const noexcept
 Get reset flag (bit 0)
 
bool DriverError () const noexcept
 Get driver error flag (bit 1)
 
bool StallGuard2 () const noexcept
 Get StallGuard2 flag (bit 2)
 
bool Standstill () const noexcept
 Get standstill flag (bit 3)
 
bool VelocityReached () const noexcept
 Get velocity reached flag (bit 4)
 
bool PositionReached () const noexcept
 Get position reached flag (bit 5)
 
bool StopLeft () const noexcept
 Get stop left switch flag (bit 6)
 
bool StopRight () const noexcept
 Get stop right switch flag (bit 7)
 
void FormatStatusBits (char *out, size_t cap) const noexcept
 Format status bits as compact string (bit names and values)
 
const char * ToString () const noexcept
 Format status flags as human-readable string.
 

Static Public Member Functions

static SpiStatus FromByte (uint8_t status_byte) noexcept
 Extract SPI_STATUS from response byte.
 

Public Attributes

uint8_t value
 Raw SPI_STATUS byte value.
 

Detailed Description

SPI_STATUS structure - status flags returned with each SPI datagram.

Per datasheet section 4.1.2, SPI_STATUS is transmitted with each SPI access in bits 39 to 32 (byte 0 of response). New status information becomes latched at the end of each access and is available with the next SPI transfer.

Member Function Documentation

◆ DriverError()

bool tmc51x0::SpiStatus::DriverError ( ) const
inlinenoexcept

Get driver error flag (bit 1)

Returns
true if driver error occurred
Here is the caller graph for this function:

◆ FormatStatusBits()

void tmc51x0::SpiStatus::FormatStatusBits ( char * out,
size_t cap ) const
inlinenoexcept

Format status bits as compact string (bit names and values)

Parameters
outDestination buffer
capDestination capacity in bytes

Output format: "RST:0 STST:0 VEL:0 POS:0 STOP_L:0 STOP_R:0 SG2:0 DRV_ERR:0"

Note
No heap allocation (embedded-friendly).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FromByte()

static SpiStatus tmc51x0::SpiStatus::FromByte ( uint8_t status_byte)
inlinestaticnoexcept

Extract SPI_STATUS from response byte.

Parameters
status_byteByte 0 from SPI response (bits 39-32)
Returns
SpiStatus structure with parsed bits
Here is the caller graph for this function:

◆ HasError()

bool tmc51x0::SpiStatus::HasError ( ) const
inlinenoexcept

Check if any error flags are set.

Returns
true if driver_error is set (reset_flag is informational, not an error)

Note: Reset flag indicates the chip was reset (normal on power-up) and is cleared when read. Only driver_error indicates an actual error condition.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PositionReached()

bool tmc51x0::SpiStatus::PositionReached ( ) const
inlinenoexcept

Get position reached flag (bit 5)

Returns
true if target position reached (motion controller only)
Here is the caller graph for this function:

◆ ResetFlag()

bool tmc51x0::SpiStatus::ResetFlag ( ) const
inlinenoexcept

Get reset flag (bit 0)

Returns
true if reset has occurred
Here is the caller graph for this function:

◆ StallGuard2()

bool tmc51x0::SpiStatus::StallGuard2 ( ) const
inlinenoexcept

Get StallGuard2 flag (bit 2)

Returns
true if StallGuard flag is active
Here is the caller graph for this function:

◆ Standstill()

bool tmc51x0::SpiStatus::Standstill ( ) const
inlinenoexcept

Get standstill flag (bit 3)

Returns
true if motor is in standstill
Here is the caller graph for this function:

◆ StopLeft()

bool tmc51x0::SpiStatus::StopLeft ( ) const
inlinenoexcept

Get stop left switch flag (bit 6)

Returns
true if stop left switch is active (motion controller only)
Here is the caller graph for this function:

◆ StopRight()

bool tmc51x0::SpiStatus::StopRight ( ) const
inlinenoexcept

Get stop right switch flag (bit 7)

Returns
true if stop right switch is active (motion controller only)
Here is the caller graph for this function:

◆ ToString()

const char * tmc51x0::SpiStatus::ToString ( ) const
inlinenoexcept

Format status flags as human-readable string.

Returns
String describing active flags (for debug logging)

Note: Reset flag is informational (normal on power-up), not an error

Here is the call graph for this function:

◆ VelocityReached()

bool tmc51x0::SpiStatus::VelocityReached ( ) const
inlinenoexcept

Get velocity reached flag (bit 4)

Returns
true if target velocity reached (motion controller only)
Here is the caller graph for this function:

Member Data Documentation

◆ value

uint8_t tmc51x0::SpiStatus::value

Raw SPI_STATUS byte value.


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