This is definitely much tidier, using a module dir, as suggested.
I created a module directory ~/libmaple/pnp
and moved all my .cpp/h
files in there.
Then I removed the int main(void)
function from my previous main.cpp
(now renamed openpnp.cpp
) and created an openpnp.h
to export the setup()
and loop()
functions. Obviously, I moved the while (1) ...
loop from the old main()
function into loop()
.
I then copied ~/libmaple/wirish/rules.mk
into my pnp/
module directory, and edited the cppSRCS_$(d) := ...
part to list my source .cpp
files. I also removed the two extra BUILDDIRS, at the top of the file, leaving only the first one, for the current directory.
So my ~/libmaple/main.cpp
now looks like this ...
#include "pnp/openpnp.h"
int main(void) {
setup();
// main loop
while (1)
{
loop();
}
return 0;
}
With the exception that I had to edit ~/libmaple/wirish/wirish.h
and ~/libmaple/wirish/boards.h
(see previous post, above), it's all working quite nicely.
Bryan.