@@ -56,12 +56,12 @@ Header file.
5656*/
5757class SCPI_String_Array {
5858 public:
59- char * operator [](const byte index); // Add indexing capability
59+ char * operator [](const byte index) const ; // Add indexing capability
6060 void Append (char * value); // Append new string (LIFO stack Push)
6161 char * Pop (); // LIFO stack Pop
62- char * First (); // Returns the first element of the array
63- char * Last (); // Returns the last element of the array
64- uint8_t Size (); // Array size
62+ char * First () const ; // Returns the first element of the array
63+ char * Last () const ; // Returns the last element of the array
64+ uint8_t Size () const ; // Array size
6565 bool overflow_error = false ; // Storage overflow error
6666 const uint8_t storage_size = SCPI_ARRAY_SYZE; // Max size of the array
6767 protected:
@@ -104,7 +104,7 @@ using SCPI_C = SCPI_Commands;
104104using SCPI_P = SCPI_Parameters;
105105
106106// /Void template used with SCPI_Parser::RegisterCommand.
107- using SCPI_caller_t = void (*)(SCPI_Commands, SCPI_Parameters, Stream&);
107+ using SCPI_caller_t = void (*)(SCPI_Commands, SCPI_Parameters, Stream&);
108108// /Void template used with SCPI_Parser::RegisterSpecialCommand.
109109using SCPI_special_caller_t = void (*)(SCPI_Commands, Stream&);
110110
@@ -234,8 +234,21 @@ class SCPI_Parser {
234234
235235// Include the implementation code here
236236// This allows Arduino IDE users to configure options with #define directives
237+ //
238+ // Important!!! Implement the library only once in the main.ino file. If you are
239+ // including the same file in other *.cpp files, write this instead:
240+ //
241+ // #define VREKRER_SCPI_PARSER_NO_IMPL
242+ // #include "Vrekrer_scpi_parser.h"
243+ //
244+ // Otherwise, the Arduino linker script will return this error:
245+ //
246+ // (.text+0x0): multiple definition of `SCPI_Parser::ProcessInput(Stream&, char const*)'
247+
248+ #ifdef VREKRER_SCPI_PARSER_NO_IMPL
237249#include " Vrekrer_scpi_arrays_code.h"
238250#include " Vrekrer_scpi_parser_code.h"
239251#include " Vrekrer_scpi_parser_special_code.h"
252+ #endif
240253
241254#endif // VREKRER_SCPI_PARSER_H_
0 commit comments