Commanders
Arduino buttons/bus library
|
A full explanation in French can be read at http://www.locoduino.org/spip.php?article165 .
The goal of this library is to virtualize input through a lot of ways (hardware buttons, bus, radio and so on) in order to be able to drive the rest of the sketch without taking care of the way the information was got.
Passing this information from the commanders through the accessories is done by events of type COMMANDERS_TYPE_EVENT. Each event have an Id, a type (MOVE, TOGGLE, MOVEPOSITION, LEFT, RIGHT, TOP, BOTTOM, etc... An additional integer is added with some events to complete the event information : the position value for MOVEPOSITION for instance.
Each kind of Commanders can be excluded from compilation, for memory problems purpose or for naming conflicts. Inside some Commanders, sub items can be excluded too, like the different buttons in the ButtonsCommander. You can exclude some parts of library here, to avoid losing program and data memory on parts you don't use. For example, if you don't want DCC, just uncomment the line #define NO_DCCCOMMANDER by removing // at the beginning.
CANCommander is excluded by default, because this is a rare usage of the library, and the associated CAN library mcp_can consume memory for nothing if this commander is not used.
The Arduino IDE compiles all the files of the library 'src' directory even if its content is not used. The result is, if an unused source file contains static declarations (SERIAL, DCC or CAN do !), these statics will be allocated and this memory will be lost. The only solution I have found is to rename the source files to something IDE don't know... So if you want to lose less memory, you can rename the linked files from .cpp to .ori, and from .hpp to .hppori. See below in the exclusion area the file names related to each exclusion. This software is Copyright (C) 2015-2018 thierry Paris / Locoduino. Use is subject to license conditions. The main licensing options available are GPL V2 or Commercial: