|
|
@ -30,7 +30,7 @@ static const uint8_t tmc5130_defaultRegisterAccess[TMC5130_REGISTER_COUNT] = { |
|
|
|
#endif
|
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 撌亙�摰� * |
|
|
|
* 撌亙�摰? * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
#define FIELD_SET(data, mask, shift, value) (data = (((data) & (~(mask))) | (((value) << (shift)) & (mask))))
|
|
|
@ -106,7 +106,7 @@ void TMC51X0::writeField(uint8_t add, uint32_t mask, uint32_t shift, uint32_t va |
|
|
|
int32_t TMC51X0::readInt(uint8_t address) { |
|
|
|
/**
|
|
|
|
* @WARNING: |
|
|
|
* 餈䠷�瘝⊥��斗鱏撖���冽糓�血虾霂鳴��劐�撖���冽糓銝滚虾霂餅�隞伐���隞亙虾�質粉�墧䔉��㺭�澆��坔��啣�潭糓銝滨㮾蝑厩� |
|
|
|
* 餈䠷�瘝⊥��斗鱏撖���冽糓�血虾霂鳴��劐�撖���冽糓銝滚虾霂餅�隞伐���隞亙虾�質?餃��亦��啣�澆��坔��啣�潭糓銝滨㮾蝑厩� |
|
|
|
*/ |
|
|
|
address = TMC51x0_ADDRESS(address); |
|
|
|
|
|
|
@ -225,6 +225,11 @@ int32_t TMC51X0::getXACTUAL() { |
|
|
|
|
|
|
|
return to_user_pos(readInt(TMC5130_XACTUAL)); |
|
|
|
} |
|
|
|
int32_t TMC51X0::getXactualRAW() { |
|
|
|
zlock_guard lkg(m_mutex); |
|
|
|
return readInt(TMC5130_XACTUAL); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t TMC51X0::getVACTUAL() { |
|
|
|
zlock_guard lkg(m_mutex); |
|
|
|
return to_user_pos(readInt(TMC5130_VACTUAL)); |
|
|
@ -259,7 +264,7 @@ bool TMC51X0::isTMC5130() { |
|
|
|
return chipId == kTMC5130; |
|
|
|
} |
|
|
|
|
|
|
|
TMC5130DevStatusReg_t TMC51X0::getDevStatus() { // R 霂餃�銝齿�
|
|
|
|
TMC5130DevStatusReg_t TMC51X0::getDevStatus() { // R
|
|
|
|
zlock_guard lkg(m_mutex); |
|
|
|
static_assert(sizeof(TMC5130DevStatusReg_t) == 4); |
|
|
|
uint32_t value = readInt(TMC5130_DRVSTATUS); |
|
|
@ -267,7 +272,7 @@ TMC5130DevStatusReg_t TMC51X0::getDevStatus() { // R 读后不清 |
|
|
|
memcpy(&val, &value, sizeof(TMC5130DevStatusReg_t)); |
|
|
|
return val; |
|
|
|
} |
|
|
|
TMC5130GState_t TMC51X0::getGState() { // R+C 霂餃��芸𢆡皜�膄
|
|
|
|
TMC5130GState_t TMC51X0::getGState() { // R+C
|
|
|
|
zlock_guard lkg(m_mutex); |
|
|
|
static_assert(sizeof(TMC5130GState_t) == 4); |
|
|
|
uint32_t value = readInt(TMC5130_GSTAT); |
|
|
@ -365,9 +370,9 @@ bool TMC51X0::setEncResolution(int32_t enc_resolution) { |
|
|
|
/**
|
|
|
|
* @brief |
|
|
|
* |
|
|
|
* 1.��挽�菜㦤��256蝏�� |
|
|
|
* 2.��挽TMC5130_ENC_CONST�臬�餈𥕦�璅∪� |
|
|
|
* 3.�芣𣈲���摰𡁜�颲函������膥 |
|
|
|
* 1.��?曄㩞�箸糓256蝏�� |
|
|
|
* 2.��?鋁MC5130_ENC_CONST�?����嗆芋撘? |
|
|
|
* 3.�?�?���摰𡁜�颲函������膥 |
|
|
|
*/ |
|
|
|
|
|
|
|
int32_t enc_resolution_tmp = enc_resolution * 4; |
|
|
|