For the project that I am currently working on, I have some special requirement on Serial communication: extremely large RX receive buffer (1KB on UNO) and fairly small TX buffer. Also, I do not need a first in first out queue. Instead, I want to deal with the RX interrupt differently to fit other parts of my program.
Therefore, I would like to modify the default Arduino Hardware Serial library. It's probably not a good idea just to change the code in the Arduino IDE folder. So, I copied a couple of files (HardwareSerial.cpp + HardwareSerial.h + HardwareSerial_private.h + HardwareSerial0.cpp) from there and modified them a little bit. I changed the class name, file name, and deleted some content related to RX (However, I did not delete the functions. I just return -1 or do nothing for void functions).
But, I got tons of compiling errors. I am quite confused by how Arduino Hardware Serial library works (why there are so many files. Why rx_isr is not put in the same file as tx_isr??).
I don't want to deal with clock settings my self, and I would like to keep the default TX function.
Has anyone done this before? What do I have to be cautious about? What files are essential??
I am not completely new in C/C++. But all the programs I wrote before are mostly single file, or has a pretty simple relation between different headers/files. So, I am not familiar with how the compiler link different libraries together and am stuck here...
Thanks a lot!