
//
// --------------- base definitions for all RBPXPLRTERM modules ---------------------------------------
//

#ifndef _RBPXPLRTERM_base_h
#define _RBPXPLRTERM_base_h

#include "Arduino.h"

//
// ---------------- common types ---------------------------------------------------------------------
//

typedef void (* DFuncPtr) ();         // this is a typedef to your functions void func(), DFuncPtr is a pointer to a function taking no parameters and returning nothing
typedef void (* DFuncParPtr) (int p); // this is a typedef to your functions void func(param), DFuncParPtr is a pointer to a function taking one int parameter returning nothing
typedef void (* DFuncIntParStrPtr) (int i, int param, String data); // a DFuncIntParStrPtr is a pointer to a function taking 2 int parameters and one String parameter returning nothing

#define STR(s) #s
#define XSTR(s) STR(s)

//
// --------------- determine target architecture variants --------------------------------------------
//
#ifdef ARDUINO_ARCH_AVR
#define ENV_NANO
#define ENV_AVR
#define ENV_ARCH AVR
#endif

#ifdef ARDUINO_ARCH_ESP32
#define ENV_ESP32
#define ENV_ARCH ESP32
#endif

#ifdef ARDUINO_ARCH_RP2040
#define ENV_RP2040
#define ENV_ARCH RP2040
#endif

#ifndef ENV_ARCH
#error No Environment architecture defined
#endif

//
// ============== utilities ====================================
//
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

#define LOGGING_ENABLED LOGENA
#define SW_VERSION "0.2"

// ============= wrappers for Serial ===========================

#define SERIAL_PRINT if (Serial) Serial.print
#define SERIAL_PRINTLN if (Serial) Serial.println
#define SERIAL_PRINTF if (Serial) Serial.printf


// end of RBPXPLRTERM_base_h
#endif
