#include <DIO2.h>
#include "Commander.hpp"
#include "Commanders.hpp"
#include "CANCommander.hpp"
#include "DccCommander.hpp"
#include "I2CCommander.hpp"
#include "ButtonsCommander.hpp"
#include "SerialCommander.hpp"
#include "TextInterpreter.hpp"
#include "EventsSequencer.hpp"
Go to the source code of this file.
e Revision History
- 21/05/2018 1.60.2
-
- 20/05/2018 1.60.1
- Correction des exemples SimpleButtons et SimpleButtonsByIds
- Fix of samples SimpleButtons and SimpleButtonsByIds.
- 14/04/2018 1.60.0
-
- 16/02/2018 1.51.2
- Correction de la syntaxe de la documentation anglaise.
- Fix of English documentation syntax !
- 27/10/2017 1.51.1
- Correction des exemples pour tester la bonne configuration de Commanders.h
- Fix all samples to have a better check of Commanders.h configuration.
- 18/10/2017 1.51.0
- Mise en forme du num�ro de version en 'semver' (Semantic Versioning 2.0.0).
- Ajout de ArduiEmulator dans extras.
- Version number converted to 'semver' format (Semantic Versioning 2.0.0).
- ArduiEmulator added in extras folder.
- 10/08/2017 1.50
- Nouvelle doc en anglais dans extras/Doc .
- Retrait de DccCommanderClass.CheckIndex()
- Ajout de Commander.BeforeFirstLoop() et Commander.printCommanders()
- Renommage des fonctions de EventStack.
- Passage de statique classe � statique fichier de LastEventId dans I2CCommander
- New complete English documentation in extras/Doc
- Removing of DccCommanderClass.CheckIndex()
- Add Commander.BeforeFirstLoop() and Commander.printCommanders()
- Renaming of EventStack functions.
- Pass from static of class to file static of LastEventId in I2CCommander.
- 14/07/2017 1.40
- Nouvelles classes ButtonscommanderSwitchOnePin et ButtonscommanderSwitchTwoPins pour g�rer les cas les plus fr�quents sur des switchs...
- Nouvelle fonction virtuelle BeforeFirstLoop() dans ButtonsCommander et certains boutons.
- Ajout d'un param�tre MoveIncrement sur les encodeurs.
- Ajouts de messages de compilation 'No *** Commander' quand un NO_***COMMANDER a �t� d�clar�.
- New classes ButtonscommanderSwitchOnePin and ButtonscommanderSwitchTwoPins to handle the more common cases for switch usage.
- New function BeforeFirstLoop() for ButtonsCommander and some buttons.
- New parameter MoveIncrement for encoders.
- New compilation messages 'No *** Commander' when a NO_***COMMANDER has been defined.
- 21/04/2017 1.31
-
- 09/04/2017 1.30
- Ajout des macros PRINT_COMMANDERS, COMMANDERS_PRINT_EVENT et PRINT_EVENT_DCC.
- Ajout d'une EventStack pour pouvoir �mettre plusieurs events pendant un seul loop.
- Ajout d'un �v�nement COMMANDER_MOVE_OFF au basculement d'un switch.
- Initialisation d'un switch par la lecture de son �tat pendant le setup.
- Test sur la pr�sence d'au moins un �tat pour un switch.
- Retrait d'un pinMode inutile pour les switchs.
- Retrait d'une g�n�ration d'�v�nement inutile pour un encodeur.
- Ajout d'une fonction SetMiniMaxi pour les potentiom�tres.
- Test de la pr�sence de la biblioth�que mcp_can si le CAN commander est activ�.
- Macros PRINT_COMMANDERS, COMMANDERS_PRINT_EVENT and PRINT_EVENT_DCC added.
- EventStack sources added to be able to push more than one event during one loop() call.
- COMMANDER_MOVE_OFF event generated when a switch toggle.
- Initialisation of switch current value at startup, druing setup.
- Check state number for a switch.
- A overnumbered pinMode has been deleted for switch.
- A wrong event has benn removed for encoders.
- SetMiniMaxi function added for potentiometers.
- Check for mcp_can library installed if CAN commander is activated.
- 24/02/2017 1.25
- Correction de l'include "Dio2.h" en <Dio2.h>
- Fix "Dio2.h" include into <Dio2.h>
- 31/01/2017 1.24
- Ajout de DCC_Monitor_Accessories.zip dans extra.
- Ajout d'infpormartions sur extra dans readme.adoc .
- Renommage de CHAIN_ENUMERATE en CMDRSCHAIN_ENUMERATE
- DCC_Monitor_Accessories.zip added to extra.
- Information added about extra directory in readme.adoc file.
- CHAIN_ENUMERATE renamed in CMDRSCHAIN_ENUMERATE.
- 31/12/2016 1.23
- Mise � jour de DIO2
- Included library DIO2 updated
- 21/11/2016 1.22
-
- 19/11/2016 1.21
-
- 04/11/2016 1.20
- Correction de DccCommander qui ne marchait plus...
- Fix of DccCommander...
- 31/10/2016 1.11
- Changement de nom pour �viter des collisions de nom avec d'autres biblios : DEBUG_VERBOSE->COMMANDERS_DEBUG_VERBOSE.
- Ajout des biblioth�ques DIO2 et mcp-can dans 'extra'.
- event.h ne sera plus inclus dans un croquis utilisant Commanders.
- Name changed from DEBUG_VERBOSE to COMMANDERS_DEBUG_VERBOSE, to avoid confusion with other libraries.
- DIO2 and mcp_can libraries included in 'extra'.
- event.h will not be included anymore when Commanders will be used in a sketch.
- 28/09/2016 1.1
- D�claration de NO_CANCOMMANDER par d�faut.
- NO_CANCOMMANDER is the default
- 09/09/2016 1.0
- Inversion de la broche et de l'identifiant dans AddEvent du switch pour �tre homog�ne avec le poussoir. Idem pour l'encodeur et le potentiometre.
- Cr�ation du source 'Events.h' pour ne pas avoir � recopier les enums dans les exemples.
- Inverted pin and id in potentiometer, switch and encoder constructors
- Created 'Events.h' to avoid copying enums in samples.
- 04/09/2016 0.99
- Plus d'initialisation de Serial, pour le DUE, m�me dans SerialCommander . Serial.begin() doit �tre fait dans le .ino .
- Ajout de l'�v�nement COMMANDERS_EVENT_MOVEPOSITIONID.
- un begin() remplace SetEventHandler et SetStatusLedPin pour Commanders.
- sur une (fausse) intuition, retrait de tous les 'byte' remplac�s par des uint8_t .
- No more internal begin() of Serial class, to avoid problems with the DUE, even in SerialCommander. Serial.begin must be done, if necessary, in .ino file .
- Added event COMMANDERS_EVENT_MOVEPOSITIONID.
- A begin() function replace the old SetEventHandler and SetStatusLedPin for Commanders.
- Based on a false deduction, replacement of all 'byte' by 'uint8_t'. It is not wrong, but it could have been avoided...
- 21/08/2016 0.98
-
- 16/08/2016 0.97
-
- 12/06/2016 V0.96
- Retrait de StartSetup et EndSetup
- Correction des exemples.
- StartSetup and EndSetup removed
- Samples fixed.
- 05/06/2016 V0.95
-
- 25/05/2016 V0.94
- Ajout de STRAIGHT et DIVERGE dans les �v�nements
- Added events STRAIGHT and DIVERGE.
- 22/05/2016 V0.93
- Modification des �v�nements pour un MOVE multiple.
- Optimisation m�moire et code.
- #define NO_BUTTONSCOMMANDER qui marche...
- Events modified to add a MOVE with arguments.
- Code and central memory optimized.
- #define NO_BUTTONSCOMMANDER works now.
- 19/05/2016 V0.92
- Retrait des macros
- Simplification de l'�criture pour les utilisateurs par l'instanciation automatique des commanders et la suppression des arguments des constructeurs renvoy�s vers les begin(). Plus de pointeurs � manipuler !
- Ajout de test.bat pour compiler automatiquement les exemples et obtenir un rapport.
- Macros removed.
- Simplification of code writing for library users by automatic instanciation of commanders, and removing of all constructor arguments moved to the begin() functions. No more pointers in the .ino file !
- Added test.bat to check syntax of all examples and reading a final text report.
- 17/05/2016 V0.91
- Correction de DccCommander qui ne marchait pas du tout !
- Exemple DccMacro adapt�.
- Fix of DccCommander.
- 15/05/2016 V0.90
- Ajout de l'�v�nement CONFIG avec un octet pour l'adresse, et un autre pour la valeur.
- Added CONFIG event, with a byte for the address, and another one for the value.
- 03/05/2016 V0.82
- Correction de l'exemple CANCommander.
- Mise � jour de DIO2 dans extra.
- Renommage de AddId en AddEvent dans les switchs.
- Ajout des masques et des filtres dans CANCommander.
- Fixes of the sample CANCommander.
- Update of DIO2 library in extra.
- Rename of AddId by AddEvent in switches
- Added masks and filters in CANCommander.
- 03/05/2016 V0.81
- I2C fonctionne !
- Deux exemples simplissimes de r�cepteurs CAN et I2C ajout�s.
- I2C is working !
- Two new samples with basics CAN and I2C receptors.
- 02/05/2016 V0.80
- Utilisation de listes chain�es (avec le template Chain.hpp) pour �viter les dimensionnements inutiles.
- Ajout du type d'�v�nement et du data associ� dans les push et les switches.
- Ajout des �v�nements MOVELEFT, MOVERIGHT et MOVESTOP . SELECTED devient TOGGLE.
- Utilisation de la biblioth�que externe DIO2 au lieu de la version interne Arduino2.
- Pour �viter des conflits, DEBUG_MODE est renomm� en COMMANDERS_DEBUG_MODE.
- NULL est utilis� aussi souvent que possible.
- CANCommander fonctionne ! Mais seulement en r�ception. Un exemple d'�meteur a �t� ajout�.
- Use of chained lists (via the template Chain.hpp) instead of classic lists.
- Event types and associated data added for event lists in pushes and switches.
- New events MOVELEFT, MOVERIGHT and MOVESTOP added. SELECTED becomes TOGGLE.
- Using external DIO2 library instead of internal Arduino2.
- To avoid conflicts, DEBUG_MODE has been renamed in COMMANDERS_DEBUG_MOSE.
- NULL is now used as frequently as possible.
- CANCommander works, but in reception only. A sample of sender is added in examples folder.
- 27/04/2016 V0.72
- Renommage de Setup en begin dans les sources Dcc.
- Rename of Setup to begin in Dcc sources.
- 25/04/2016 V0.71
- Ajout de I2CCommander, en receveur uniquement pour des questions de timing.
- I2CCommander added. Only a receiver to avoid timing problems.
- 20/04/2016 V0.70
-
- 05/04/2016 V0.64
- Ajout d'une Led de statut commune � tous les Commanders.
- Renommage de tous les 'Setup' en 'begin' et 'Loop' en 'loop'.
- Added a global status Led for all the commanders.
- All 'Setup' have been renamed in 'begin' and 'Loop' in 'loop'.
- 02/04/2016 V0.63
- Correction du constructeur de ButtonsCommanderPush avec le nombre d'ids pass�s maintenant en argument du setup.
- Ajout d'une macro PUSH_BUTTON_IDS pour les ID multiples d'un poussoir.
- Ajout d'une macro ANALOGPUSH_BUTTON_TOL pour les boutons poussoir en Charlieplexing avec une tol�rance.
- Correction d'un probl�me de compilation de ButtonsCommanderButton
- Correction de SerialCommander dans l'interpr�tation du texte...
- ButtonsCommanderEncoder peut maintenant envoyer un �v�nement absolu avec une valeur entre mini et maxi, ou un �v�nement relatif avec +1 ou -1.
- Fix ButtonsCommanderPush constructor, number of multiple ids now passed to the setup function.
- Added PUSH_BUTTON_IDS macro for push button with multiple ids.
- Added ANALOGPUSH_BUTTON_TOL for charlieplexing pushes with tolerancy.
- Fix commpilation problem with ButtonsCommanderButton
- Fix SerialCommander in text parsing.
- ButtonsCommanderEncoder can now raise an Absolute event, with an associated value between mini and maxi, or a Relative event, with +1 or -1 as value.
- 29/03/2016 V0.62
- Changement de syntaxe des macros g�n�rales avec COMMANDERS au lieu de COMMANDER
- Suppression de point-virgules � la fin des macros.
- DCCACCESSORY devient DCCACTIVATION
- Correction de la macro ANALOGPUSH_BUTTON .
- Name change of global macros from COMMANDER to COMMANDERS
- Semi-colon removed at the end of macros.
- DCCACCESSORY changed to DCCACTIVATION
- Fix ANALOGPUSH_BUTTON macro.
- 25/03/2016 V0.61
- Correction de probl�mes de consommation m�moire.
- Fix memory Consumption in events.
- 19/03/2016 V0.60
- Correction et am�liorations du SerialCommander. Par macros, et compatible avec tous les types de serial class...
- Compatibilit� ajout�e avec l'Arduino Due, mais sans b�n�ficier de l'acc�l�ration promise par l'acc�s direct aux ports.
- Fix of SerialCommander, to be able to use any kind of serial class, from the hardware serials of Arduinos, to software emulations by AltSoftSerial or SoftwareSerial .
- Added Arduino Due compatibility, but by using the classic IDE functions to access the pins, not the fast direct addressing of processor ports.
- 18/03/2016 V0.50
- Nouveau nom 'Commanders' pour la biblioth�que. Les classes et les defines ont suivi le mouvement.
- Un moyen simple de programmer � l'aide de macros C a �t� ajout�.
- New name 'Commanders' for the library. All classes and defines have been adapted when necessary.
- An easy programming way have been added based on C macros.
- 20/02/2016 V0.40
- Correction des Ids multiples de PushButton.
- Ajout de la classe ButtonsCommanderAnalogPushes
- ButtonsCommander::Loop renvoie une structure avec l'id du bouton s�lectionn� ou UNDEFINED_ID. LastSelectedButton garde en m�moire le dernier, m�me pour un bouton composite comme ButtonsCommanderAnalogPushes. Dans ce cas c'est l'item qui est conserv�.
- Un exemple SimpleButtonsByIds a �t� ajout� pour tester cette fa�on de fonctionner.
- Fix multiple ids for push button.
- New class ButtonsCommanderAnalogPushes added.
- Now the ButtonsCommander::Loop function returns the selected id or UNDEFINED_ID. LastSelectedButton is the ... Last selected button ! Works also with composite buttons like ButtonsCommanderAnalogPushes. In this case, this is the item which is kept.
- A sample SimpleButtonsByIds has been added to test this mode.
- 22/12/2015 V0.30
- EventHandler impl�ment� et fonctionnel
- Simplification de la construction des commanders avec des listes chain�es
- Ajout du traitement clavier pour les tests PC-Windows.
- EventHandler is implemented and operational.
- Commander building in .ino file is more simpler with transparent linked lists.
- Keyboard handling added for PC-Windows tests.
- 20/12/2015 V0.20
- Gros gain de m�moire dynamique entre DccCommander avec sa liste de CVs trop longue, et surtout SerialCommander qui utilisait les Serial* du noyau, chacun allouant 150 octets de buffer interne en dur !
- Big fix on dynamic memory size, because of CV list in DccCommander, but mostly because of SerialCommander which reference the Serial* default classes from the kernel, each one allocating 150 bytes of internal buffer !
- 01/09/2015 V0.10
- Cr�ation de la librairie, extraite de ma librarie UniversalAccessoryDecoder.
- Creation, extracted from my UniversalAccessoryDecoder library v4.
Main include file of the library.
#define COMMANDERS_DEBUG_MODE |
If this is defined, the library will do many checks during setup and execution, and print errors, warnings and information messages on console. These messages can take a lot of memory, so be careful about the free memory of your program if you activate debug mode.
#define COMMANDERS_DEBUG_MODE |
If this is defined, the library will do many checks during setup and execution, and print errors, warnings and information messages on console. These messages can take a lot of memory, so be careful about the free memory of your program if you activate debug mode.
#define COMMANDERS_DEBUG_VERBOSE_MODE |
If this is defined, the Verbose mode lets you see all actions done by the library, but with a real flood of text to the console... It has no effect if COMMANDERS_DEBUG_MODE is not activated.
#define COMMANDERS_PRINT_COMMANDERS |
If this is defined, the function Commanders::printCommanders() will become available. This is useful to try to understand why a commander, or a commander item is not correctly defined. This function uses a lot of memory, so activate it only if necessary, and be careful about your program's memory. You can use the define PRINT_COMMANDERS() in your sketch instead of a call to Commanders::printCommanders(). If COMMANDERS_PRINT_COMMANDERS is not defined, PRINT_COMMANDERS is defined as empty, so you will not have a compilation error.
#define COMMANDERS_PRINT_COMMANDERS |
If this is defined, the function Commanders::printCommanders() will become available. This is useful to try to understand why a commander, or a commander item is not correctly defined. This function uses a lot of memory, so activate it only if necessary, and be careful about your program's memory. You can use the define PRINT_COMMANDERS() in your sketch instead of a call to Commanders::printCommanders(). If COMMANDERS_PRINT_COMMANDERS is not defined, PRINT_COMMANDERS is defined as empty, so you will not have a compilation error.
#define GPIO2_PREFER_SPEED 1 |
This is used internally by DIO2.h