HF-TMC9660 Driver 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
tmc9660::TMC9660< CommType >::FeedbackSense Struct Reference

Subsystem for feedback sensor configuration. More...

#include <tmc9660.hpp>

Collaboration diagram for tmc9660::TMC9660< CommType >::FeedbackSense:
[legend]

Classes

struct  Abn2Config
 Configuration structure for ABN2 (secondary) encoder auto-configuration. More...
 
struct  AbnConfig
 Configuration structure for ABN encoder auto-configuration. More...
 
struct  HallConfig
 Configuration structure for Hall sensor auto-configuration. More...
 
struct  SpiEncoderConfig
 Configuration structure for SPI encoder auto-configuration. More...
 

Public Member Functions

bool configureHall (tmc9660::tmcl::HallSectorOffset sectorOffset=tmc9660::tmcl::HallSectorOffset::DEG_0, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, tmc9660::tmcl::EnableDisable enableExtrapolation=tmc9660::tmcl::EnableDisable::DISABLED, uint8_t filterLength=0) noexcept
 Configure digital Hall sensors for BLDC commutation.
 
bool setHallPositionOffsets (int16_t offset0=0, int16_t offset60=10922, int16_t offset120=21845, int16_t offset180=-32768, int16_t offset240=-21846, int16_t offset300=-10923, int16_t globalOffset=0) noexcept
 Set Hall sensor position offsets for improved accuracy.
 
bool setHallPositionOffsetsDegrees (float offset0Deg=0.0f, float offset60Deg=60.0f, float offset120Deg=120.0f, float offset180Deg=180.0f, float offset240Deg=240.0f, float offset300Deg=300.0f, float globalOffsetDeg=0.0f) noexcept
 Set Hall sensor position offsets using degrees.
 
bool setHallPositionOffsetsRadians (float offset0Rad=0.0f, float offset60Rad=1.04719755f, float offset120Rad=2.09439510f, float offset180Rad=3.14159265f, float offset240Rad=4.18879020f, float offset300Rad=5.23598775f, float globalOffsetRad=0.0f) noexcept
 Set Hall sensor position offsets using radians.
 
bool getHallPhiE (int16_t &phi_e) noexcept
 Read the electrical angle (phi_e) calculated from Hall feedback.
 
bool configureABNEncoder (uint32_t counts_per_rev, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, tmc9660::tmcl::EnableDisable nChannelInverted=tmc9660::tmcl::EnableDisable::DISABLED) noexcept
 Configure an ABN incremental encoder for feedback.
 
bool configureABNInitialization (tmc9660::tmcl::AbnInitMethod initMethod=tmc9660::tmcl::AbnInitMethod::FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING, uint16_t initDelay=1000, int32_t initVelocity=5, int16_t nChannelOffset=0) noexcept
 Configure ABN encoder initialization method.
 
bool getABNInitializationState (tmc9660::tmcl::AbnInitState &state) noexcept
 Read the current state of ABN encoder initialization.
 
bool getABNPhiE (int16_t &phi_e) noexcept
 Read the electrical angle (phi_e) calculated from ABN feedback.
 
bool getABNRawValue (uint32_t &value) noexcept
 Read the raw ABN encoder internal counter value.
 
bool configureABNNChannel (tmc9660::tmcl::AbnNChannelFiltering filterMode=tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF, tmc9660::tmcl::EnableDisable clearOnNextNull=tmc9660::tmcl::EnableDisable::DISABLED) noexcept
 Configure N-channel filtering for ABN encoder.
 
bool configureSecondaryABNEncoder (uint32_t counts_per_rev, tmc9660::tmcl::Direction inverted=tmc9660::tmcl::Direction::NOT_INVERTED, uint8_t gearRatio=1) noexcept
 Configure the secondary ABN encoder input.
 
bool getSecondaryABNCountsPerRev (uint32_t &counts) noexcept
 Read ABN_2_STEPS (encoder steps per rotation, 0…16777215).
 
bool getSecondaryABNDirection (tmc9660::tmcl::Direction &dir) noexcept
 Read ABN_2_DIRECTION (normal/inverted).
 
bool getSecondaryABNGearRatio (uint8_t &ratio) noexcept
 Read ABN_2_GEAR_RATIO (1…255).
 
bool setSecondaryABNEncoderEnabled (bool enable) noexcept
 Enable or disable the secondary ABN encoder.
 
bool getSecondaryABNEncoderValue (uint32_t &value) noexcept
 Read the raw ABN2 encoder internal counter value.
 
bool configureSPIEncoder (uint8_t cmd_size, uint16_t cs_settle_time_ns, uint8_t cs_idle_time_us) noexcept
 Configure a SPI-based encoder for feedback.
 
bool configureSPIEncoderDataFormat (uint32_t position_mask, uint8_t positionShift=0, tmc9660::tmcl::Direction invertDirection=tmc9660::tmcl::Direction::NOT_INVERTED) noexcept
 Configure SPI encoder data format and processing.
 
bool setSPIEncoderRequestData (const uint8_t *requestData, uint8_t size) noexcept
 Set up SPI encoder request data for continuous transfer mode.
 
bool configureSPIEncoderInitialization (tmc9660::tmcl::SpiInitMethod init_method, int16_t offset=0) noexcept
 Configure SPI encoder initialization method.
 
bool setSPIEncoderLUTCorrection (tmc9660::tmcl::EnableDisable enable, int8_t shiftFactor=0) noexcept
 Enable or disable SPI encoder lookup table correction.
 
bool uploadSPIEncoderLUTEntry (uint8_t index, int8_t value) noexcept
 Upload a single entry to the SPI encoder correction lookup table.
 
bool getSPIEncoderCSSettleDelay (uint16_t &timeNs) noexcept
 Read SPI_ENCODE_CS_SETTLE_DELAY_TIME (0…6375 ns).
 
bool getSPIEncoderCSIdleDelay (uint8_t &timeUs) noexcept
 Read SPI_ENCODER_CS_IDLE_DELAY_TIME (0…102 µs).
 
bool getSPIEncoderMainCmdSize (uint8_t &size) noexcept
 Read SPI_ENCODER_MAIN_TRANSFER_CMD_SIZE (1…16 bytes).
 
bool getSPIEncoderSecondaryCmdSize (uint8_t &size) noexcept
 Read SPI_ENCODER_SECONDARY_TRANSFER_CMD_SIZE (0…15 bytes).
 
bool getSPIEncoderPositionMask (uint32_t &mask) noexcept
 Read SPI_ENCODER_POSITION_COUNTER_MASK.
 
bool getSPIEncoderPositionShift (uint8_t &shift) noexcept
 Read SPI_ENCODER_POSITION_COUNTER_SHIFT.
 
bool getSPIEncoderPositionValue (uint32_t &value) noexcept
 Read SPI_ENCODER_POSITION_COUNTER_VALUE.
 
bool getSPIEncoderCommutationAngle (int16_t &angle) noexcept
 Read SPI_ENCODER_COMMUTATION_ANGLE (-32768…32767).
 
bool getSPIEncoderInitialization (tmc9660::tmcl::SpiInitMethod &method, int16_t &offset) noexcept
 Read SPI_ENCODER_INITIALIZATION_METHOD and SPI_ENCODER_OFFSET.
 
bool getSPIEncoderDirection (tmc9660::tmcl::Direction &dir) noexcept
 Read SPI_ENCODER_DIRECTION.
 
bool getSPIEncoderLUTAddress (uint8_t &address) noexcept
 Read SPI_LUT_ADDRESS_SELECT.
 
bool getSPIEncoderLUTData (int8_t &data) noexcept
 Read SPI_LUT_DATA.
 
bool getSPIEncoderLUTShiftFactor (int8_t &shift_factor) noexcept
 Read SPI_LUT_COMMON_SHIFT_FACTOR.
 
bool configureAuto (const HallConfig &config) noexcept
 Auto-configure Hall sensor feedback.
 
bool configureAuto (const AbnConfig &config) noexcept
 Auto-configure ABN encoder feedback.
 
bool configureAuto (const Abn2Config &config) noexcept
 Auto-configure ABN2 (secondary) encoder feedback.
 
bool configureAuto (const SpiEncoderConfig &config) noexcept
 Auto-configure SPI encoder feedback.
 

Static Public Member Functions

static int16_t degreesToHallOffset (float degrees) noexcept
 Convert electrical angle from degrees to 16-bit format.
 
static int16_t radiansToHallOffset (float radians) noexcept
 Convert electrical angle from radians to 16-bit format.
 

Private Member Functions

 FeedbackSense (TMC9660 &parent) noexcept
 

Private Attributes

TMC9660driver
 

Friends

class TMC9660
 

Detailed Description

template<typename CommType>
struct tmc9660::TMC9660< CommType >::FeedbackSense

Subsystem for feedback sensor configuration.

Constructor & Destructor Documentation

◆ FeedbackSense()

template<typename CommType >
tmc9660::TMC9660< CommType >::FeedbackSense::FeedbackSense ( TMC9660 & parent)
inlineexplicitprivatenoexcept

Member Function Documentation

◆ configureABNEncoder()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureABNEncoder ( uint32_t counts_per_rev,
tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
tmc9660::tmcl::EnableDisable nChannelInverted = tmc9660::tmcl::EnableDisable::DISABLED )
noexcept

Configure an ABN incremental encoder for feedback.

Sets up an incremental quadrature encoder with optional index (N) channel for position and velocity feedback.

Parameters
counts_per_revEncoder resolution (counts per revolution, 0-16777215).
invertedIf true, invert the encoder direction (tmc9660::tmcl::Direction).
n_channel_invertedIf true, invert the N-channel signal (active low instead of active high) (tmc9660::tmcl::EnableDisable).
Returns
true if encoder parameters were set successfully.

◆ configureABNInitialization()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureABNInitialization ( tmc9660::tmcl::AbnInitMethod initMethod = tmc9660::tmcl::AbnInitMethod::FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING,
uint16_t initDelay = 1000,
int32_t initVelocity = 5,
int16_t nChannelOffset = 0 )
noexcept

Configure ABN encoder initialization method.

Sets the method used to align the ABN encoder with the rotor's absolute position.

Parameters
init_methodInitialization method (tmc9660::tmcl::AbnInitMethod): FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING, FORCED_PHI_E_90_ZERO, USE_HALL, USE_N_CHANNEL_OFFSET
init_delayDelay in milliseconds to wait for mechanical oscillations to stop (1000-10000)
init_velocityVelocity used during N-channel initialization (-200000 to 200000)
n_channel_offsetOffset between phi_e zero and encoder index pulse position (-32768 to 32767)
Returns
true if ABN initialization parameters were set successfully.

◆ configureABNNChannel()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureABNNChannel ( tmc9660::tmcl::AbnNChannelFiltering filterMode = tmc9660::tmcl::AbnNChannelFiltering::FILTERING_OFF,
tmc9660::tmcl::EnableDisable clearOnNextNull = tmc9660::tmcl::EnableDisable::DISABLED )
noexcept

Configure N-channel filtering for ABN encoder.

Sets up filtering for the N-channel (index pulse) to handle imprecise encoders.

Parameters
filter_modeN-channel filtering mode (tmc9660::tmcl::AbnNChannelFiltering): FILTERING_OFF, N_EVENT_ON_A_HIGH_B_HIGH, N_EVENT_ON_A_HIGH_B_LOW, N_EVENT_ON_A_LOW_B_HIGH, N_EVENT_ON_A_LOW_B_LOW
clear_on_next_nullIf true, clear position counter on next N-channel event (tmc9660::tmcl::EnableDisable).
Returns
true if N-channel settings were applied successfully.

◆ configureAuto() [1/4]

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureAuto ( const Abn2Config & config)
noexcept

Auto-configure ABN2 (secondary) encoder feedback.

Configures the secondary ABN encoder for position/velocity feedback (cannot be used for commutation).

Parameters
configABN2 encoder configuration (see Abn2Config)
Returns
true if all configurations succeeded, false otherwise

◆ configureAuto() [2/4]

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureAuto ( const AbnConfig & config)
noexcept

Auto-configure ABN encoder feedback.

Configures ABN encoder including initialization method, N-channel settings, and filtering.

Parameters
configABN encoder configuration (see AbnConfig)
Returns
true if all configurations succeeded, false otherwise

◆ configureAuto() [3/4]

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureAuto ( const HallConfig & config)
noexcept

Auto-configure Hall sensor feedback.

Configures all Hall sensor parameters including offsets, filtering, and extrapolation.

Parameters
configHall sensor configuration (see HallConfig)
Returns
true if all configurations succeeded, false otherwise

◆ configureAuto() [4/4]

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureAuto ( const SpiEncoderConfig & config)
noexcept

Auto-configure SPI encoder feedback.

Configures SPI encoder including timing, data format, initialization, and optional LUT correction.

Parameters
configSPI encoder configuration (see SpiEncoderConfig)
Returns
true if all configurations succeeded, false otherwise

◆ configureHall()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureHall ( tmc9660::tmcl::HallSectorOffset sectorOffset = tmc9660::tmcl::HallSectorOffset::DEG_0,
tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
tmc9660::tmcl::EnableDisable enableExtrapolation = tmc9660::tmcl::EnableDisable::DISABLED,
uint8_t filterLength = 0 )
noexcept

Configure digital Hall sensors for BLDC commutation.

This enables Hall sensor inputs as the feedback for commutation. Typically used with tmc9660::tmcl::CommutationMode::FOC_HALL.

Parameters
sector_offsetHall sensor 60-degree/sector offset (tmc9660::tmcl::HallSectorOffset): tmc9660::tmcl::HallSectorOffset::DEG_0, DEG_60, DEG_120, DEG_180, DEG_240, DEG_300 This combines both the 120° order offset and 180° polarity offset.
invertedIf true, invert the interpretation of hall sensor signals (tmc9660::tmcl::Direction).
enable_extrapolationIf true, enable hall extrapolation for higher resolution position signal (tmc9660::tmcl::EnableDisable).
filter_lengthDigital filter length (0-255) for hall sensor inputs.
Returns
true if Hall sensor feedback is configured successfully.

◆ configureSecondaryABNEncoder()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureSecondaryABNEncoder ( uint32_t counts_per_rev,
tmc9660::tmcl::Direction inverted = tmc9660::tmcl::Direction::NOT_INVERTED,
uint8_t gearRatio = 1 )
noexcept

Configure the secondary ABN encoder input.

This allows the use of a second incremental encoder or a geared encoder setup. It writes ABN_2_* parameters to set the resolution, direction and optional gear ratio.

Parameters
counts_per_revEncoder resolution in counts per revolution.
invertedTrue to invert the encoder direction (tmc9660::tmcl::Direction).
gear_ratioGear ratio between the second encoder and the motor shaft. Use 1 if directly coupled.
Returns
true if all parameters were written successfully.

◆ configureSPIEncoder()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureSPIEncoder ( uint8_t cmd_size,
uint16_t cs_settle_time_ns,
uint8_t cs_idle_time_us )
noexcept

Configure a SPI-based encoder for feedback.

Sets up a digital SPI encoder (e.g., absolute magnetic encoder) for position feedback.

Parameters
cmd_sizeSize of SPI transfer frame (1-16 bytes).
cs_settle_time_nsCS settle time in nanoseconds (0-6375).
cs_idle_time_usCS idle time between frames in microseconds (0-102).
Returns
true if configured successfully.

◆ configureSPIEncoderDataFormat()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureSPIEncoderDataFormat ( uint32_t position_mask,
uint8_t positionShift = 0,
tmc9660::tmcl::Direction invertDirection = tmc9660::tmcl::Direction::NOT_INVERTED )
noexcept

Configure SPI encoder data format and processing.

Sets up how the position data is extracted from the SPI encoder response.

Parameters
position_maskBit mask to extract position from SPI response.
position_shiftRight shift value to apply to position counter.
invert_directionIf true, invert the direction of the SPI encoder (tmc9660::tmcl::Direction).
Returns
true if configuration was successful.

◆ configureSPIEncoderInitialization()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::configureSPIEncoderInitialization ( tmc9660::tmcl::SpiInitMethod init_method,
int16_t offset = 0 )
noexcept

Configure SPI encoder initialization method.

Sets how the SPI encoder is initialized for commutation.

Parameters
init_methodInitialization method (tmc9660::tmcl::SpiInitMethod): FORCED_PHI_E_ZERO_WITH_ACTIVE_SWING, FORCED_PHI_E_90_ZERO, USE_OFFSET
offsetManual offset value if using offset-based initialization.
Returns
true if initialization method was set successfully.

◆ degreesToHallOffset()

template<typename CommType >
static int16_t tmc9660::TMC9660< CommType >::FeedbackSense::degreesToHallOffset ( float degrees)
staticnoexcept

Convert electrical angle from degrees to 16-bit format.

Converts degrees to the internal representation: value = (degrees * 65536) / 360. The result wraps around the 16-bit signed integer range.

Parameters
degreesElectrical angle in degrees
Returns
16-bit signed integer value (-32768 to 32767)

◆ getABNInitializationState()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getABNInitializationState ( tmc9660::tmcl::AbnInitState & state)
noexcept

Read the current state of ABN encoder initialization.

Parameters
[out]stateCurrent initialization state (tmc9660::tmcl::AbnInitState): IDLE, BUSY, WAIT, DONE
Returns
true if the state was read successfully.

◆ getABNPhiE()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getABNPhiE ( int16_t & phi_e)
noexcept

Read the electrical angle (phi_e) calculated from ABN feedback.

Parameters
[out]phi_eElectrical angle (-32768 to 32767).
Returns
true if the value was read successfully.

◆ getABNRawValue()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getABNRawValue ( uint32_t & value)
noexcept

Read the raw ABN encoder internal counter value.

Parameters
[out]valueRaw counter value (0-16777215).
Returns
true if the value was read successfully.

◆ getHallPhiE()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getHallPhiE ( int16_t & phi_e)
noexcept

Read the electrical angle (phi_e) calculated from Hall feedback.

Parameters
[out]phi_eElectrical angle (-32768 to 32767).
Returns
true if the value was read successfully.

◆ getSecondaryABNCountsPerRev()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSecondaryABNCountsPerRev ( uint32_t & counts)
noexcept

Read ABN_2_STEPS (encoder steps per rotation, 0…16777215).

Parameters
[out]countsCPR value.
Returns
true if read successful.

◆ getSecondaryABNDirection()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSecondaryABNDirection ( tmc9660::tmcl::Direction & dir)
noexcept

Read ABN_2_DIRECTION (normal/inverted).

Parameters
[out]dirDirection (tmc9660::tmcl::Direction).
Returns
true if read successful.

◆ getSecondaryABNEncoderValue()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSecondaryABNEncoderValue ( uint32_t & value)
noexcept

Read the raw ABN2 encoder internal counter value.

Parameters
[out]valueRaw counter value (0-4294967295).
Returns
true if the value was read successfully.

◆ getSecondaryABNGearRatio()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSecondaryABNGearRatio ( uint8_t & ratio)
noexcept

Read ABN_2_GEAR_RATIO (1…255).

Parameters
[out]ratioGear ratio.
Returns
true if read successful.

◆ getSPIEncoderCommutationAngle()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderCommutationAngle ( int16_t & angle)
noexcept

Read SPI_ENCODER_COMMUTATION_ANGLE (-32768…32767).

◆ getSPIEncoderCSIdleDelay()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderCSIdleDelay ( uint8_t & timeUs)
noexcept

Read SPI_ENCODER_CS_IDLE_DELAY_TIME (0…102 µs).

◆ getSPIEncoderCSSettleDelay()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderCSSettleDelay ( uint16_t & timeNs)
noexcept

Read SPI_ENCODE_CS_SETTLE_DELAY_TIME (0…6375 ns).

◆ getSPIEncoderDirection()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderDirection ( tmc9660::tmcl::Direction & dir)
noexcept

Read SPI_ENCODER_DIRECTION.

◆ getSPIEncoderInitialization()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderInitialization ( tmc9660::tmcl::SpiInitMethod & method,
int16_t & offset )
noexcept

Read SPI_ENCODER_INITIALIZATION_METHOD and SPI_ENCODER_OFFSET.

◆ getSPIEncoderLUTAddress()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderLUTAddress ( uint8_t & address)
noexcept

Read SPI_LUT_ADDRESS_SELECT.

◆ getSPIEncoderLUTData()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderLUTData ( int8_t & data)
noexcept

Read SPI_LUT_DATA.

◆ getSPIEncoderLUTShiftFactor()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderLUTShiftFactor ( int8_t & shift_factor)
noexcept

Read SPI_LUT_COMMON_SHIFT_FACTOR.

◆ getSPIEncoderMainCmdSize()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderMainCmdSize ( uint8_t & size)
noexcept

Read SPI_ENCODER_MAIN_TRANSFER_CMD_SIZE (1…16 bytes).

◆ getSPIEncoderPositionMask()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderPositionMask ( uint32_t & mask)
noexcept

Read SPI_ENCODER_POSITION_COUNTER_MASK.

◆ getSPIEncoderPositionShift()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderPositionShift ( uint8_t & shift)
noexcept

Read SPI_ENCODER_POSITION_COUNTER_SHIFT.

◆ getSPIEncoderPositionValue()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderPositionValue ( uint32_t & value)
noexcept

Read SPI_ENCODER_POSITION_COUNTER_VALUE.

◆ getSPIEncoderSecondaryCmdSize()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::getSPIEncoderSecondaryCmdSize ( uint8_t & size)
noexcept

Read SPI_ENCODER_SECONDARY_TRANSFER_CMD_SIZE (0…15 bytes).

◆ radiansToHallOffset()

template<typename CommType >
static int16_t tmc9660::TMC9660< CommType >::FeedbackSense::radiansToHallOffset ( float radians)
staticnoexcept

Convert electrical angle from radians to 16-bit format.

Converts radians to the internal representation: value = (radians * 65536) / (2 * π). The result wraps around the 16-bit signed integer range.

Parameters
radiansElectrical angle in radians
Returns
16-bit signed integer value (-32768 to 32767)

◆ setHallPositionOffsets()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setHallPositionOffsets ( int16_t offset0 = 0,
int16_t offset60 = 10922,
int16_t offset120 = 21845,
int16_t offset180 = -32768,
int16_t offset240 = -21846,
int16_t offset300 = -10923,
int16_t globalOffset = 0 )
noexcept

Set Hall sensor position offsets for improved accuracy.

Compensates for Hall sensor mounting tolerances by setting precise electrical angle offsets.

Parameters
offset0Offset for 0° Hall position (-32768 to 32767)
offset60Offset for 60° Hall position (-32768 to 32767)
offset120Offset for 120° Hall position (-32768 to 32767)
offset180Offset for 180° Hall position (-32768 to 32767)
offset240Offset for 240° Hall position (-32768 to 32767)
offset300Offset for 300° Hall position (-32768 to 32767)
global_offsetAdditional global offset applied to all positions (-32768 to 32767)
Returns
true if Hall position offsets were set successfully.

◆ setHallPositionOffsetsDegrees()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setHallPositionOffsetsDegrees ( float offset0Deg = 0.0f,
float offset60Deg = 60.0f,
float offset120Deg = 120.0f,
float offset180Deg = 180.0f,
float offset240Deg = 240.0f,
float offset300Deg = 300.0f,
float globalOffsetDeg = 0.0f )
noexcept

Set Hall sensor position offsets using degrees.

Convenience function that converts degrees to the internal 16-bit format. The electrical angle is represented as: value = (degrees * 65536) / 360.

Parameters
offset0DegOffset for 0° Hall position in degrees
offset60DegOffset for 60° Hall position in degrees
offset120DegOffset for 120° Hall position in degrees
offset180DegOffset for 180° Hall position in degrees
offset240DegOffset for 240° Hall position in degrees
offset300DegOffset for 300° Hall position in degrees
global_offset_degAdditional global offset in degrees
Returns
true if Hall position offsets were set successfully.

◆ setHallPositionOffsetsRadians()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setHallPositionOffsetsRadians ( float offset0Rad = 0.0f,
float offset60Rad = 1.04719755f,
float offset120Rad = 2.09439510f,
float offset180Rad = 3.14159265f,
float offset240Rad = 4.18879020f,
float offset300Rad = 5.23598775f,
float globalOffsetRad = 0.0f )
noexcept

Set Hall sensor position offsets using radians.

Convenience function that converts radians to the internal 16-bit format. The electrical angle is represented as: value = (radians * 65536) / (2 * π).

Parameters
offset0RadOffset for 0° Hall position in radians
offset60RadOffset for 60° Hall position in radians
offset120RadOffset for 120° Hall position in radians
offset180RadOffset for 180° Hall position in radians
offset240RadOffset for 240° Hall position in radians
offset300RadOffset for 300° Hall position in radians
global_offset_radAdditional global offset in radians
Returns
true if Hall position offsets were set successfully.

◆ setSecondaryABNEncoderEnabled()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setSecondaryABNEncoderEnabled ( bool enable)
noexcept

Enable or disable the secondary ABN encoder.

Parameters
enableTrue to enable, false to disable.
Returns
true if the operation was successful.

◆ setSPIEncoderLUTCorrection()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setSPIEncoderLUTCorrection ( tmc9660::tmcl::EnableDisable enable,
int8_t shiftFactor = 0 )
noexcept

Enable or disable SPI encoder lookup table correction.

Enables the lookup table-based correction for encoder nonlinearity.

Parameters
enableIf true, enable LUT correction (tmc9660::tmcl::EnableDisable).
shift_factorCommon shift factor for all LUT entries.
Returns
true if LUT settings were applied successfully.

◆ setSPIEncoderRequestData()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::setSPIEncoderRequestData ( const uint8_t * requestData,
uint8_t size )
noexcept

Set up SPI encoder request data for continuous transfer mode.

Sets the data to be sent to the SPI encoder during position acquisition.

Parameters
requestDataArray of data bytes to send to the encoder.
sizeSize of the request data (1-16 bytes).
Returns
true if transfer data was set successfully.

◆ uploadSPIEncoderLUTEntry()

template<typename CommType >
bool tmc9660::TMC9660< CommType >::FeedbackSense::uploadSPIEncoderLUTEntry ( uint8_t index,
int8_t value )
noexcept

Upload a single entry to the SPI encoder correction lookup table.

Parameters
indexIndex in the LUT (0-255).
valueCorrection value (-128 to 127).
Returns
true if the entry was uploaded successfully.

Friends And Related Symbol Documentation

◆ TMC9660

template<typename CommType >
friend class TMC9660
friend

Member Data Documentation

◆ driver

template<typename CommType >
TMC9660& tmc9660::TMC9660< CommType >::FeedbackSense::driver
private

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