I have several Teensy4 projects that work with HardwareSerial.h NOT edited with SERIAL_9BIT_SUPPORT. I do not want to change anything to them. They're out in the field and if needed I should be able to recompile them without issues.
I now have a new project that needs SERIAL_9BIT_SUPPORT.
So I have to edit HardwareSerial.h. But if I do that while it's in my PC's C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4 folder, then I likely corrupt things for my other projects that do not want or need the 9 bit UART support (which eats up more buffer RAM bytes if 9bit mode is enabled).
So I tried making a local copy of HardwareSerial.h in the Arduino new project folder.
Added
#include "HardwareSerial.h"
as the first line in my new Arduino project .ino file.
But that does not do the trick.
Problem is that by default the original library file gets used, like it or not, it then does already
#define HardwareSerial_h
way before anything that I could do in my Arduino .ino code.
What is the workaround? How do I tell my new project to stay away from the default libraries - without having to change names for HardwareSerial, so that I can compile a sketch that uses Serial1.begin(115200, SERIAL_9N1); without errors? WITHOUT possibly corrupting things for my other sketches maintained on the same PC that will not want it.
I now have a new project that needs SERIAL_9BIT_SUPPORT.
So I have to edit HardwareSerial.h. But if I do that while it's in my PC's C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4 folder, then I likely corrupt things for my other projects that do not want or need the 9 bit UART support (which eats up more buffer RAM bytes if 9bit mode is enabled).
So I tried making a local copy of HardwareSerial.h in the Arduino new project folder.
Added
#include "HardwareSerial.h"
as the first line in my new Arduino project .ino file.
But that does not do the trick.
Problem is that by default the original library file gets used, like it or not, it then does already
#define HardwareSerial_h
way before anything that I could do in my Arduino .ino code.
What is the workaround? How do I tell my new project to stay away from the default libraries - without having to change names for HardwareSerial, so that I can compile a sketch that uses Serial1.begin(115200, SERIAL_9N1); without errors? WITHOUT possibly corrupting things for my other sketches maintained on the same PC that will not want it.