Closed alext-mkrs closed 8 years ago
Just to make it clear - by "platform" I mean either the whole "platform type" or "architecture", like arm
and x86
we currently have, or just another "platform" like NUC or Edison, within x86
type.
The former is cleaner and IMHO more logical + allows to create several different "mock boards", the latter would also work and save us some code to copy, but is inelegant.
You can see what I'm aiming at in this branch of my mraa repo fork.
As the first commit based on the proposed approach went in, this RFC is no longer needed. Closing.
Following discussions in #44 and #514 I'm going to dive a bit deeper into this and introduce mocking capability on a more basic level, which would make it available through all language bindings we support, without making extensive changes in the established code base.
This RFC is for the general architectural approach to this, as I can see at least a couple. Please let me know, what do you think, @arfoll, @tingleby and anyone else interested in the matter. Below are my thoughts based on my understanding of mraa's internals and a sort of a vision I have for this mocking capability. If you see any other general way of implementing this, I'm all ears.
#ifdef
's all over the place, so I don't think that would be a good way to go. If we were to go there, we'd probably want to#ifdef
pieces of current HW-dependent code in our generic (likegpio.c
) and board-specific (likeintel_nuc5.c
) files._replace
functions in addition to the standard platform definition. The drawback is that we are not able to trick the user they're dealing with an actual Edison board, but the positive is that we have cleaner code and faster implementation of the capability + we can define it however we want in terms of pin numbers and their layout.