|
TDuino
Convenient functionality for Arduino
|
Functions | |
| void | TDuino_Error (byte number, int extra, const char *token=NULL) |
| Print an error with extra info. More... | |
| void | TDuino_Error (byte number) |
| Print an error number only. | |
| void | TDuino_Warning (byte number, int extra, const char *token=NULL) |
| Print a warning with extra info. More... | |
| void | TDuino_Warning (byte number) |
| Print an warning number only. | |
| int | freeRam () |
| Method to check free memory. More... | |
Variables | |
| const PROGMEM byte | TDUINO_ERROR_BAD_LIST_INDEX = 1 |
| Error related to referencing a bad index in TList. | |
| const PROGMEM byte | TDUINO_ERROR_BAD_TIMER_INDEX = 2 |
| Error related to referencing a bad index in TTimer. | |
| const PROGMEM byte | TDUINO_ERROR_BAD_TIMELINE_INDEX = 3 |
| Error related to referencing a bad index in TTimeline. | |
| const PROGMEM byte | TDUINO_ERROR_OBJECT_DIED = 4 |
| Error caused by an object in TList which is unexpectedly destroyed. | |
| const PROGMEM byte | TDUINO_ERROR_BAD_PARAMETER = 5 |
| Error used when a parameter passed to a function is invalid. | |
| const PROGMEM byte | TDUINO_ERROR_INVALID_OPERATION = 6 |
| Error used when an invalid operation is being performed. | |
| const PROGMEM byte | TDUINO_ERROR_NOT_ENOUGH_MEMORY = 7 |
| Error used when trying to allocate more dynamic memory than possible (in TList, TTimer or TTimeline). | |
| const PROGMEM byte | TDUINO_ERROR_INVALID_PIN = 8 |
| Error used when trying to use an uninitialized instance of TPin or any derived classes (TPinInput, TPinOutput, TButton). Usually caused when the default constructor was used and TPin::attach() was not called. | |
| const PROGMEM byte | TDUINO_ERROR_ROLLOVER = 9 |
| Error used when an unintended rollover/overflow of data types happens. This is usually related to timing features, especially the TTimeline::hasOverlap() method, but it may be triggered elsewhere as well. | |
| const PROGMEM byte | TDUINO_WARNING_BAD_PINMODE = 100 |
| Warning used when reading an output pin or writing an input pin. | |
| const PROGMEM byte | TDUINO_WARNING_RESUME_ACTIVE = 101 |
| Warning used when resuming or restarting an active timer or timeline slot. | |
The TDuino library allows you to compile your sketch with debugging enabled. When debugging is enabled, extra code used for debugging and error handling will be added to the TDuino library. This will increase the size of your compiled sketch but it will also help you detect any errors or bugs caused by incorrect usage of the TDuino library.
In order to enable debugging, you must edit the file TDefs.h in the TDuino library folder and uncomment (remove //) the following line:
The debugging functionality will use "Serial" to print errors and warnings to the console, so you must remember to initialize serial communication when using the TDebug module.
An error message will be displayed as:
And a warning will be displayed as:
Where E is the error/warning number, M is a method name (where possible) and I is the bad index or pin-number (where possible).
Objects using dynamic memory (TList, TTimer & TTimeline) will check for available memory during initialization when debugging is enabled. If there is not enough memory for the amount of items requested, an error will be generated and the amount of items for the corresponding object will be reduced to one.
NOTE: In order to prevent flooding of the console, TDuino's debugging module will only allow repetition of the same error number once every ½ second. This means that some debugging related messages may be omitted.
| int freeRam | ( | ) |
Method to check free memory.
This method is used to check the amount of free dynamic memory on the arduino. In TDuino it is used in debugging mode in order to check if there is enough free memory when constructing lists, timers, timelines etc.
The method has been copied from here: https://playground.arduino.cc/Code/AvailableMemory and since improved with guards which will prevent a linkage error due to unfound external values.
For now the function should be compatible with: Uno, Nano, Micro, Leonardo, Mega and NodeMCU (ESP8266).
| void TDuino_Error | ( | byte | number, |
| int | extra, | ||
| const char * | token | ||
| ) |
Print an error with extra info.
| number | The error number. |
| extra | The index / pin number on which the error occurred. |
| token | The name of the method (or alike) where the error occurred. |
| void TDuino_Warning | ( | byte | number, |
| int | extra, | ||
| const char * | token | ||
| ) |
Print a warning with extra info.
Please check TDuino_Error() for information about the arguments.
1.8.15