Cosa: An Object-Oriented Platform for Arduino programming

Just stumbled onto this. Nice lib!

I am writing a modest lib myself that is only for advanced users and targets to minimize ram usage (at the expense of using more prog-mem) and allow total control. I got frustrated with the stupid Arduino lib implementations that seem to be the standard -they are great for demo's and simple prototypes, but will fight you when you want to do some real work. I also use mainly template classes and no virtual functions to accomplish my goals. I intentionally leave out/do not use certain OO/C++ features in order to keep it small.

What do you think of this (to me, this looks very logical):
ViewPort<TextLcd<LcdDriver<..pin io..>, ..physical size..>, ..virtual size..>

This demonstrates:

  • separation of concerns: the actual hardware driver can be swapped out for different types of LCDs, or any one of the template classes
  • extensablility: if you don't like the impl. of some part, replace with your own.
  • No ram: all parameters are compiled into the code and the template classes do not use virtuals. This assumes you will not add/change LCD displays dynamically.

To avoid using virtuals, I use this a lot:

template<BaseT>
class SomeService : BaseT
{
public:
  void SomeMethod()
  {
     BaseT::MethodOnBaseT();
  }
};

Currently I still depend on the Arduino lib, but I'm planning to replace that.

Anyway, all the best with your library.