analogdevicesinc / TMC-API

TRINAMIC's IC API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why isn't ConfigurationTypeDef just embedded in TMC2130TypeDef?

kaysievers opened this issue · comments

Just a general API question I was wondering about: Why doesn't the device struct just embed the generic config struct instead of the currently used pointer to it?

Users need to declare both independently and they get connected internally by calling init(). Both structures are mandatory, must be writable, are always a 1:1 relation, and cannot be shared independently; therefore conceptually they appear to be the same entity.

From a user perspective, it would be simpler to just deal with one device structure.

That is one of the other breaking changes i have planned. It was more or less taken over from older design stages where only the config section existed. This config section was previously (and still is) shared for motion controllers and drivers respectively to save space in the TMC-EvalSystem. Instead the changed version will simply integrate this config struct into the device struct and achieve the space saving by adding all different Motion controllers and drivers into two unions (one for each type) instead.