Started Implementing UART Register interface

This commit is contained in:
AlexanderHD27
2024-09-13 22:09:15 +02:00
parent 08598ca7a3
commit 49d52ca0ed
5 changed files with 128 additions and 4 deletions

View File

@@ -73,14 +73,53 @@ public:
bool crc_error_flag = false;
};
/**
* @brief Higher level interface to TMC2209 driver
* This class simplifies dealing with the registers of the TMC2209 driver
* so you can just set the values
*/
class TMC2209_Registers {
private:
TMC2209_UART uart_driver;
REG_CHOPCONF chopconfBuffer;
public:
TMC2209_Registers(TMC2209_UART uart_driver);
void read_all_state();
void set_reg_gconf(
bool i_scale_analog,
bool internal_rsense,
bool en_SpreadCycle,
bool shaft,
bool index_otpw,
bool index_step,
bool pdn_disable,
bool mstep_reg_select,
bool multistep_filt
);
void set_holdCurrent(
uint8_t currentHold,
uint8_t currentRun,
uint8_t holdDelay
);
void set_thresholdPowerdown(uint8_t threshold);
void set_thresholdStealthChop(uint32_t threshold);
void set_thresholdCoolStep(uint32_t threshold);
void set_thresholdStall(uint8_t threshold);
void set_chopConfig(
bool lowsideShortProtection,
bool GNDShortProtection,
bool doubleEdge,
bool interpolation,
uint8_t microstepResolution,
bool voltageSensatifity,
uint8_t hysteresisOffset,
uint8_t hysteresisStart
);
};