From 70fb8f677039f0c13323e713bfd5e22333847ee5 Mon Sep 17 00:00:00 2001 From: James Devine Date: Tue, 6 Aug 2019 02:19:09 +0200 Subject: [PATCH] Delete asyncSerial.cpp --- asyncSerial.cpp | 55 ------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 asyncSerial.cpp diff --git a/asyncSerial.cpp b/asyncSerial.cpp deleted file mode 100644 index 29b88ba..0000000 --- a/asyncSerial.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "asyncSerial.h" -#include - - -// Avoid being blocked in the serial write routine - -AsyncSerial::AsyncSerial(int baudRate){ - Serial.begin(baudRate); - txtw = 0; - txtr = 0; - tsze = 0; - terr = 0; - tmax = 0; -} - -// Copy text to the buffer for future printing -void AsyncSerial::print(char *txt) { - - int i, l = strlen(txt); - - // If this happens there is a programming bug - if (l > TBLEN) { // Can't handle more than TBLEN at a time - terr = TXT_TOOBIG; // say error and abort - return; - } - - // If the buffer is filling up to fast throw it away and return an error - if ((l + tsze) >= TBLEN) { // If there is no room in the buffer - terr = TXT_OVERFL; // Buffer overflow - return; // Simply stop printing when txt comming too fast - } - - // Copy the new text onto the ring buffer for later output - // from the loop idle function - for (i=0; i tmax) tmax = tsze; // track the max size -} - -// Take the next character from the ring buffer and print it, called from the main loop - -void AsyncSerial::PutChar() { - char c[2]; // One character zero terminated string - if ((tsze) && (!Serial.available())) { // If the buffer is not empty and not reading - //if ((tsze)) { // If the buffer is not empty and not reading - c[0] = txtb[txtr]; // Get the next character from the read pointer - c[1] = '\0'; // Build a zero terminated string - txtr = (txtr + 1) % TBLEN; // Get the next read pointer modulo TBLEN - tsze = (tsze - 1) % TBLEN; // Reduce the buffer size - Serial.print(c); // and print the character - } -}