Write my own 'driver'

I’ve looked at the source for the ‘driver’ of the Stepper_L6470 board I’m using. I must say that I don’t like it very much.
As far as I can tell, a ‘driver’ is merely a class that supports the board - it has no privileged status as far as the framework (or anything else) is concerned. So is there any reason I should not replace the supplied driver by one of my own? Any difficulty in doing so?

You absolutely can. This is one of the main reasons of the drivers being open source, so you can change them anyway you see fits for your needs.

It reads like you know what you’re doing, but just in-case: https://www.ghielectronics.com/docs/122/gadgeteer-driver-modification

[em]Sometimes[/em] I know what I’m doing, but that’s still helpful - thanks to both of you.
Phil

1 Like

Remember to share :wink:

Understood, but are you specifically interested in this driver? Anything about it you’d like to change?

@ philAtkin, what about the drive would you like to improve?

[ul]I’d like to improve the readability. There’s no reason to have names like “ACC” when you can have “Acceleration”; no need for “CONFIG_OC_SD_DISABLE” when “disable” will do[/ul]
[ul]I’d like to improve the documentation. The “documentation” for routines such as Speed_Steps_to_Par tells you all the things that are obvious from the names, but nothing that you’d actually like to know (such as what the units are)[/ul]
[ul]There are some bugs: IntSpd_Steps_to_Par has the wrong factor, and it’s invalid to alter the configuration without resetting (which makes an individual change expensive)[/ul]
[ul]There’s no facility to initialize the chip properly with custom settings (no constructor that takes a RegsStruct parameter, for example). Again, this makes a custom setup expensive.[/ul]
[ul]I’d like to improve the usability: the KVal parameters are difficult to understand to start with, and in my view this driver makes them more so (by introducing the ‘percentage’ concept for no apparent reason)[/ul]
[ul]Some properties are provided as parameterless methods, such as BusySW()[/ul]

I fully accept that some of these may be matters of personal taste and that others may find the established code perfectly adequate; I have no wish to argue about it! Which is why I began by asking if it was possible to write my own…

Wauw, this is going to be a really good driver. Seriously good and reasonable mods. Keep it up!

All I’ve done so far is talk…

Not true. Most of my projects takes many hours of thinking before I start coding. But when the coding starts your real skills are tested :wink:

I suppose I should publish an updated driver in codeshare in which I have address some of those readability concerns.

@ philAtkin,

[url]https://www.ghielectronics.com/community/forum/topic?id=16043[/url]

I’ve published my driver for the l6470; which is designed for a single daisy chain. I’ll try to modify it to support as many configurations as possible including Gadgeteer spi modules.

Let me know your concerns on that thread.