Closed lshw closed 2 years ago
Care to explain what its intended purpose is? It doesn't seem to be a part of the official Arduino API, and your example doesn't quite show why it is useful.
This function can perform real-time operations, such as xon/xoff, or When avr uses multiple serial ports, use this function to realize that each serial port has a different size of receive buffer, or real-time mirroring from one serial port to another serial port, or can filter the received content first. refill the system's receive buffer,
Thanks for the explanation. Instead of submitting the PR here, please submit it to this repo instead. https://github.com/MCUdude/MCUdude_corefiles
MCUdude_corefiles are used as a submodule for MightyCore, MiniCore, MegaCore, and MajorCore.
example:
//return false drop char, bool rxcap(char ch) { if (ch == '1') { //if get char '1' Serial.println("callback!"); Serial.setRxCallBack(0); //disable CallBack return false; //del char '1' from rx buff } return true; }
void setup() { Serial.begin(115200); Serial.setRxCallBack(rxcap); }
void loop() { while(Serial.available()) Serial.write(Serial.read()); }
~