-
C++ wins again
02/10/2016 at 22:38 • 0 commentsI have just rewritten joystick code in fully object-oriented fashion.
Earlier DigitalJoystick constructor needed 13 arguments (USB Joystick handle, 5 pins, 5 keys, potx and poty). Now it is constructed from objects xAxis, yAxis and trigger.
- there is no code repetition anymore - both axes are handled by the same class
- the code is easier to read
- the cost? there was no cost, I saved 24 bytes of flash
Comparison side by side is here.
I put "again" in the title because of earlier experiences from my other project (check out "Programming" section). It is actually more efficient to write fully object-oriented code for 8-bit microcontroller.
Unbelievable.
-
Project completed
02/07/2016 at 00:34 • 0 comments