Generic code (OSHW or Premium documentation...)

Hmm, I did some great code for Spider a few months back and tried to use it on the Cerberus, with huge difficulties. I had to re-write the whole piece of code.

Do you have any good ideas as how to write generic code, when I am swapping all the time between different mainboards, and need a stable re-use library that is portable?

Furthermore, may I suggest that the documentation has clear indicators as to which version of NETMF it is for and if the documentation is for OSHW or Premium!

As long as you use only standard NETMF classes you should be fine in general on any board. Documentation for premium and OSHW is separated.

Hmm, I think you misunderstood me. Lets take the SD card module from GHI, and the corresponding documentation: https://www.ghielectronics.com/docs/96/sd-card-module

There is no clear indicator as to what version it is for, and if it is the same code for Cerberus (OSHW) and Spider (Premium). My experience is that it is two different ways of using the SD-card, and I was requesting experience as to how it should be done in generic code…

Makes sense?

Ok, I see. Yes I agree if an example is for a premium or OSHW only then it should say so.

I’m definitely not an expert, but I suppose it all comes down to sticking with proper coding practices. I try as far as possible to keep my own modules completely independent from the hardware. A good code module should be able to also run on normal PC as well, so you can test easily test it. And this often requires having to add an interface between the code module and the hardware to cater for differences.

Docs have been updated. We do try to stick to generic code samples, so if you see this kind of issue, please speak up.

2 Likes