mirror of
https://github.com/cosmic-pi-deprecated/cosmicpi-arduino_V1.6.git
synced 2026-05-12 16:09:25 +00:00
Delete asyncSerial.h
This commit is contained in:
parent
04fa13dd9e
commit
4fac378f9a
1 changed files with 0 additions and 36 deletions
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef __ASYNCSERIAL__
|
||||
#define __ASYNCSERIAL__
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// These two routines are needed because the Serial.print method prints without using interrupts.
|
||||
// Calls to Serial.print block interrupts and use a wait in kernel space causing all ISRs to
|
||||
// be blocked and hence we could miss some timer interrupts.
|
||||
// To avoid this problem call PushTxt to have stuff delivered to the serial line, PushTxt simply
|
||||
// stores your text for future print out by PutChar. The PutChar routine removes one character
|
||||
// from the stored text each time its called. By placing a call to PutChar in the outermost loop
|
||||
// of the Arduino loop function, then for each loop one character is printed, avoiding blocking
|
||||
// of interrupts and vastly improving the loops real time behaviour.
|
||||
|
||||
class AsyncSerial {
|
||||
// This is the text ring buffer for real time output to serial line with interrupt on
|
||||
static const int TBLEN = 1024; // Serial line output ring buffer size, 8K
|
||||
char txtb[TBLEN]; // Text ring buffer
|
||||
uint32_t txtw, txtr, // Write and Read indexes
|
||||
tsze, terr, // Buffer size and error code
|
||||
tmax; // The maximum size the buffer reached
|
||||
|
||||
typedef enum { TXT_NOERR=0, TXT_TOOBIG=1, TXT_OVERFL=2 } TxtErr;
|
||||
|
||||
public:
|
||||
AsyncSerial(int baudRate);
|
||||
// Copy text to the buffer for future printing
|
||||
void print(char *txt);
|
||||
// Take the next character from the ring buffer and print it, called from the main loop
|
||||
void PutChar();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue