file0: Main.ino (it's arduino file):
#define AXIS_SERIAL Serial1
#include "header.h"
...
void setup(){...}
void loop() {...}
...
file1: header.h
...
#ifndef AXIS_SERIAL
#define AXIS_SERIAL Serial
#endif
...
file2: header.cpp
...
AXIS_SERIAL.print("Hello World")
...
Question: When I use function in header.cpp value inside of AXIS_SERIAL is still Serial (not Serial1). Is there a way to define a constant in main file, and use it in other header file(s)? If so, it will going to generalize my piece of code.
I do know that it's possible to declare a variable something like HardwareSerial Axis_serial = Serial1;
but I may use Software Serial in the future. So I need a thing that works both Hardware & Software Serial classes.