├── del_htm.bat ├── html ├── bc_s.png ├── nav_f.png ├── nav_h.png ├── open.png ├── tab_a.png ├── tab_b.png ├── tab_h.png ├── tab_s.png ├── closed.png ├── doxygen.png ├── search │ ├── close.png │ ├── mag_sel.png │ ├── search_l.png │ ├── search_m.png │ ├── search_r.png │ ├── nomatches.html │ ├── classes_75.html │ ├── all_69.html │ ├── all_74.html │ ├── functions_69.html │ ├── all_63.html │ ├── functions_63.html │ ├── functions_73.html │ ├── variables_74.html │ ├── typedefs_62.html │ ├── defines_61.html │ ├── defines_73.html │ ├── defines_65.html │ ├── classes_73.html │ ├── files_73.html │ ├── functions_65.html │ ├── variables_72.html │ ├── defines_62.html │ ├── functions_72.html │ ├── functions_61.html │ ├── all_65.html │ ├── all_67.html │ ├── functions_67.html │ ├── all_61.html │ ├── functions_62.html │ ├── all_66.html │ ├── functions_66.html │ ├── all_72.html │ ├── defines_75.html │ ├── all_70.html │ ├── functions_70.html │ ├── variables_75.html │ ├── all_62.html │ ├── all_77.html │ ├── functions_77.html │ ├── search.css │ ├── all_75.html │ ├── variables_73.html │ └── all_73.html ├── tabs.css ├── installdox ├── functions_type.html ├── a00004.html ├── annotated.html ├── files.html ├── globals_func.html ├── classes.html ├── functions_vars.html ├── a00011.html ├── globals_defs.html ├── a00006_source.html ├── a00010.html ├── globals_vars.html └── functions_func.html ├── SerialPort ├── examples │ ├── ArduinoSize │ │ ├── ArduinoSize.ino │ │ └── FreeRam.h │ ├── HelloWorld │ │ └── HelloWorld.ino │ ├── BufferedSize │ │ ├── FreeRam.h │ │ └── BufferedSize.ino │ ├── UnbufferedSize │ │ ├── FreeRam.h │ │ └── UnbufferedSize.ino │ ├── WriteFlash │ │ └── WriteFlash.ino │ ├── ArduinoTest │ │ └── ArduinoTest.ino │ ├── UnbufferedTest │ │ └── UnbufferedTest.ino │ ├── BufferedTest │ │ └── BufferedTest.ino │ ├── ReadWriteTest │ │ └── ReadWriteTest.ino │ ├── MegaTestArduino │ │ └── MegaTestArduino.ino │ └── MegaTest │ │ └── MegaTest.ino └── SerialPort.cpp ├── SerialPort.html ├── readme.txt ├── .gitattributes ├── SerialPortLogger ├── SerialDataSource.ino ├── readme.txt └── SerialPortLogger.ino ├── changes.txt ├── .gitignore └── MainPage └── SerialPortMainPage.h /del_htm.bat: -------------------------------------------------------------------------------- 1 | rm -R html/* 2 | pause -------------------------------------------------------------------------------- /html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/bc_s.png -------------------------------------------------------------------------------- /html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/nav_f.png -------------------------------------------------------------------------------- /html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/nav_h.png -------------------------------------------------------------------------------- /html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/open.png -------------------------------------------------------------------------------- /html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/tab_a.png -------------------------------------------------------------------------------- /html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/tab_b.png -------------------------------------------------------------------------------- /html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/tab_h.png -------------------------------------------------------------------------------- /html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/tab_s.png -------------------------------------------------------------------------------- /html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/closed.png -------------------------------------------------------------------------------- /html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/doxygen.png -------------------------------------------------------------------------------- /html/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/search/close.png -------------------------------------------------------------------------------- /html/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/search/mag_sel.png -------------------------------------------------------------------------------- /html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/search/search_l.png -------------------------------------------------------------------------------- /html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/search/search_m.png -------------------------------------------------------------------------------- /html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/greiman/SerialPort/HEAD/html/search/search_r.png -------------------------------------------------------------------------------- /SerialPort/examples/ArduinoSize/ArduinoSize.ino: -------------------------------------------------------------------------------- 1 | // Print free RAM for Arduino HardwareSerial 2 | // 3 | #include "FreeRam.h" 4 | 5 | void setup() { 6 | Serial.begin(9600); 7 | Serial.println(FreeRam()); 8 | } 9 | void loop() { 10 | } 11 | -------------------------------------------------------------------------------- /SerialPort/examples/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // Simple usage with buffering like Arduino 1.0. 2 | #include 3 | 4 | // use NewSerial for port 0 5 | USE_NEW_SERIAL; 6 | 7 | void setup() { 8 | NewSerial.begin(9600); 9 | NewSerial.println("Hello World!"); 10 | } 11 | void loop() {} -------------------------------------------------------------------------------- /SerialPort/examples/ArduinoSize/FreeRam.h: -------------------------------------------------------------------------------- 1 | #include 2 | static inline int FreeRam() { 3 | extern char *__brkval; 4 | char top; 5 | #if defined(CORE_TEENSY) 6 | return &top - __brkval; 7 | #else // malloc type 8 | return __brkval ? &top - __brkval : &top - __malloc_heap_start; 9 | #endif // malloc type 10 | } 11 | -------------------------------------------------------------------------------- /SerialPort/examples/BufferedSize/FreeRam.h: -------------------------------------------------------------------------------- 1 | #include 2 | static inline int FreeRam() { 3 | extern char *__brkval; 4 | char top; 5 | #if defined(CORE_TEENSY) 6 | return &top - __brkval; 7 | #else // malloc type 8 | return __brkval ? &top - __brkval : &top - __malloc_heap_start; 9 | #endif // malloc type 10 | } 11 | -------------------------------------------------------------------------------- /SerialPort/examples/UnbufferedSize/FreeRam.h: -------------------------------------------------------------------------------- 1 | #include 2 | static inline int FreeRam() { 3 | extern char *__brkval; 4 | char top; 5 | #if defined(CORE_TEENSY) 6 | return &top - __brkval; 7 | #else // malloc type 8 | return __brkval ? &top - __brkval : &top - __malloc_heap_start; 9 | #endif // malloc type 10 | } 11 | -------------------------------------------------------------------------------- /SerialPort.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | A web page that points a browser to a different page 4 | 5 | 6 | 7 | 8 | Your browser didn't automatically redirect. Open html/index.html manually. 9 | 10 | 11 | -------------------------------------------------------------------------------- /SerialPort/examples/BufferedSize/BufferedSize.ino: -------------------------------------------------------------------------------- 1 | // Print free RAM for Arduino 1.0 style buffering. 2 | // 3 | #include 4 | #include "FreeRam.h" 5 | 6 | SerialPort<0, 63, 63> NewSerial; 7 | 8 | // for Arduino 0022 style buffering use this 9 | //SerialPort<0, 127, 0> NewSerial; 10 | 11 | void setup() { 12 | NewSerial.begin(9600); 13 | NewSerial.println(FreeRam()); 14 | } 15 | void loop() {} -------------------------------------------------------------------------------- /SerialPort/examples/UnbufferedSize/UnbufferedSize.ino: -------------------------------------------------------------------------------- 1 | // Print free RAM for unbuffered mode. 2 | // 3 | // You can reduce flash and RAM use more by setting 4 | // BUFFERED_TX and BUFFERED_RX zero in SerialPort.h 5 | // to always disable buffering. 6 | // 7 | #include 8 | #include "FreeRam.h" 9 | 10 | // no buffers 11 | SerialPort<0, 0, 0> NewSerial; 12 | 13 | void setup() { 14 | NewSerial.begin(9600); 15 | NewSerial.println(FreeRam()); 16 | } 17 | void loop() {} -------------------------------------------------------------------------------- /html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
No Matches
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | The SerialPort library provide more options for buffering, character size, 2 | parity and error checking than the standard Arduino HardwareSerial 3 | class for AVR Arduino boards. 4 | 5 | An example high speed serial data-logger is included. 6 | 7 | To install the this library, copy the SerialPort folder to the 8 | your libraries directory. 9 | 10 | Try the HelloWorld example first. 11 | 12 | The API was designed to be backward compatible with Arduino Serial. 13 | A number of functions have been added to the API. 14 | 15 | Read the html files for more information. 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /SerialPort/examples/WriteFlash/WriteFlash.ino: -------------------------------------------------------------------------------- 1 | // Test write() time for a flash string. 2 | #include 3 | 4 | SerialPort<0, 0, 32> port; 5 | 6 | void setup(void) { 7 | port.begin(9600); 8 | 9 | for (int route = 0; route < 11; route++) { 10 | uint32_t start = micros(); 11 | port.writeln(F("Selecting passenger route x")); 12 | uint32_t stop = micros(); 13 | port.write(F("Message time: ")); 14 | port.print(stop - start, DEC); 15 | port.writeln(F(" us")); 16 | delay(400); 17 | } 18 | port.println(F("Done!")); 19 | } 20 | void loop(void) {} 21 | -------------------------------------------------------------------------------- /SerialPort/examples/ArduinoTest/ArduinoTest.ino: -------------------------------------------------------------------------------- 1 | 2 | void setup() { 3 | Serial.begin(9600); 4 | uint32_t t = micros(); 5 | Serial.write("This string is used to measure the time to buffer data.\r\n"); 6 | t = micros() - t; 7 | Serial.write("Time: "); 8 | Serial.print(t); 9 | Serial.write(" us\r\n"); 10 | } 11 | void loop() { 12 | Serial.write("\r\nenter a string\r\n"); 13 | while (!Serial.available()) {} 14 | do { 15 | Serial.write(Serial.read()); 16 | uint32_t m = millis(); 17 | while (!Serial.available() && (millis() - m) < 3) {} 18 | } while(Serial.available()); 19 | Serial.write("\r\n"); 20 | } -------------------------------------------------------------------------------- /SerialPort/examples/UnbufferedTest/UnbufferedTest.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // serial port zero with no RX or TX buffering 4 | SerialPort<0, 0, 0> NewSerial; 5 | 6 | void setup() { 7 | NewSerial.begin(9600); 8 | uint32_t t = micros(); 9 | NewSerial.write("This string is used to measure the time to buffer data.\r\n"); 10 | t = micros() - t; 11 | NewSerial.write("Time: "); 12 | NewSerial.print(t); 13 | NewSerial.write(" us\r\n"); 14 | } 15 | void loop() { 16 | NewSerial.write("\r\nenter a string\r\n"); 17 | while (!NewSerial.available()) {} 18 | do { 19 | NewSerial.write(NewSerial.read()); 20 | uint32_t m = millis(); 21 | while (!NewSerial.available() && (millis() - m) < 3) {} 22 | } while(NewSerial.available()); 23 | NewSerial.write("\r\n"); 24 | } -------------------------------------------------------------------------------- /SerialPort/examples/BufferedTest/BufferedTest.ino: -------------------------------------------------------------------------------- 1 | // Check time to buffer data and function of available(). 2 | #include 3 | 4 | // port zero, 63 character RX and TX buffers 5 | SerialPort<0, 63, 63> NewSerial; 6 | 7 | void setup() { 8 | NewSerial.begin(9600); 9 | uint32_t t = micros(); 10 | NewSerial.write("This string is used to measure the time to buffer data.\r\n"); 11 | t = micros() - t; 12 | NewSerial.write("Time: "); 13 | NewSerial.print(t); 14 | NewSerial.write(" us\r\n"); 15 | } 16 | void loop() { 17 | NewSerial.write("\r\nenter a string\r\n"); 18 | while (!NewSerial.available()) {} 19 | do { 20 | NewSerial.write(NewSerial.read()); 21 | uint32_t m = millis(); 22 | while (!NewSerial.available() && (millis() - m) < 3) {} 23 | } while(NewSerial.available()); 24 | NewSerial.write("\r\n"); 25 | } -------------------------------------------------------------------------------- /SerialPortLogger/SerialDataSource.ino: -------------------------------------------------------------------------------- 1 | // This program sends 280000 bytes over serial port zero. 2 | // Maximum baud rate for a 328 Arduino is 57600. 3 | // Maximum baud rate for a Mega Arduino is 115200 4 | const uint32_t BAUD_RATE = 57600; 5 | 6 | #include 7 | 8 | // Define NewSerial as serial port zero. 9 | USE_NEW_SERIAL; 10 | 11 | void setup() { 12 | NewSerial.begin(BAUD_RATE); 13 | pinMode(13, OUTPUT); 14 | // light pin 13 LED on Arduino Board 15 | digitalWrite(13, HIGH); 16 | 17 | // write start time 18 | NewSerial.println(millis()); 19 | 20 | for (uint16_t i = 0; i < 10000; i++) { 21 | NewSerial.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); 22 | } 23 | // write end time 24 | NewSerial.println(millis()); 25 | 26 | // turn off pin 13 LED 27 | digitalWrite(13, LOW); 28 | } 29 | void loop() {} 30 | -------------------------------------------------------------------------------- /SerialPort/examples/ReadWriteTest/ReadWriteTest.ino: -------------------------------------------------------------------------------- 1 | // Test that ring buffer overrun can be detected. 2 | #include 3 | // port 0, 16 byte RX and TX buffers 4 | SerialPort<0, 16, 16> port0; 5 | 6 | void setup() { 7 | port0.begin(9600); 8 | port0.write("SerialPort version: "); 9 | port0.println(SERIAL_PORT_VERSION); 10 | } 11 | void loop() { 12 | uint8_t buffer[10]; 13 | port0.writeln("Enter a string. Overrun error for more than 16 bytes."); 14 | while (!port0.available()) {} 15 | // delay so an ring buffer overrun will occur for long strings 16 | delay(50); 17 | uint32_t m = millis(); 18 | do { 19 | size_t n = port0.read(buffer, sizeof (buffer)); 20 | if (n) { 21 | m = millis(); 22 | port0.write(buffer, n); 23 | } 24 | } while ((millis() - m) < 4); 25 | port0.writeln(); 26 | uint8_t e = port0.getRxError(); 27 | if (e) { 28 | port0.write("Error: "); 29 | port0.println(e, HEX); 30 | port0.clearRxError(); 31 | } 32 | } -------------------------------------------------------------------------------- /SerialPort/examples/MegaTestArduino/MegaTestArduino.ino: -------------------------------------------------------------------------------- 1 | // Test all ports on the Mega. 2 | // 3 | // 4 | // A string read on port zero will be sent to port one, 5 | // it will then be read from port one and sent to port 6 | // two, next it will be read from port two and sent to 7 | // port three, and finally it will be read from port 8 | // three and sent to port zero. 9 | // 10 | // Place a loopback jumper connecting 11 | // RX1 to TX1, RX2 to TX2, RX3 to TX3 on ports 1, 2, and 3. 12 | // Do not place a jumper on port zero. 13 | // 14 | void transfer(Stream* in, Stream* out) { 15 | while(!in->available()) {} 16 | do { 17 | out->write(in->read()); 18 | uint32_t m = millis(); 19 | while (!in->available() && (millis() - m) < 3) {} 20 | } while (in->available()); 21 | } 22 | void setup() { 23 | Serial.begin(9600); 24 | Serial1.begin(9600); 25 | Serial2.begin(9600); 26 | Serial3.begin(9600); 27 | } 28 | void loop() { 29 | Serial.write("type a string\r\n"); 30 | transfer(&Serial, &Serial1); 31 | transfer(&Serial1, &Serial2); 32 | transfer(&Serial2, &Serial3); 33 | transfer(&Serial3, &Serial); 34 | Serial.write("\r\n\r\n"); 35 | } 36 | -------------------------------------------------------------------------------- /html/search/classes_75.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | UsartRegister 13 |
14 |
15 |
Searching...
16 |
No Matches
17 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /html/search/all_69.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | init 13 | SerialRingBuffer 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/all_74.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | txRingBuf 13 | SerialPort.h 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/functions_69.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | init 13 | SerialRingBuffer 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/all_63.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | clearRxError 13 | SerialPort 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/functions_63.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | clearRxError 13 | SerialPort 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/functions_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SerialPort 13 | SerialPort 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/variables_74.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | txRingBuf 13 | SerialPort.h 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/typedefs_62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | buf_size_t 13 | SerialRingBuffer 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/defines_61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | ALLOW_LARGE_BUFFERS 13 | SerialPort.h 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/defines_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SERIAL_PORT_VERSION 13 | SerialPort.h 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/search/defines_65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | ENABLE_RX_ERROR_CHECKING 13 | SerialPort.h 14 |
15 |
16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /html/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | } 7 | 8 | .tabs2 { 9 | font-size: 10px; 10 | } 11 | .tabs3 { 12 | font-size: 9px; 13 | } 14 | 15 | .tablist { 16 | margin: 0; 17 | padding: 0; 18 | display: table; 19 | } 20 | 21 | .tablist li { 22 | float: left; 23 | display: table-cell; 24 | background-image: url('tab_b.png'); 25 | line-height: 36px; 26 | list-style: none; 27 | } 28 | 29 | .tablist a { 30 | display: block; 31 | padding: 0 20px; 32 | font-weight: bold; 33 | background-image:url('tab_s.png'); 34 | background-repeat:no-repeat; 35 | background-position:right; 36 | color: #283A5D; 37 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 38 | text-decoration: none; 39 | outline: none; 40 | } 41 | 42 | .tabs3 .tablist a { 43 | padding: 0 10px; 44 | } 45 | 46 | .tablist a:hover { 47 | background-image: url('tab_h.png'); 48 | background-repeat:repeat-x; 49 | color: #fff; 50 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 51 | text-decoration: none; 52 | } 53 | 54 | .tablist li.current a { 55 | background-image: url('tab_a.png'); 56 | background-repeat:repeat-x; 57 | color: #fff; 58 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 59 | } 60 | -------------------------------------------------------------------------------- /SerialPort/examples/MegaTest/MegaTest.ino: -------------------------------------------------------------------------------- 1 | // Test all ports on the Mega. 2 | // 3 | // A string read on port zero will be sent to port one, 4 | // it will then be read from port one and sent to port 5 | // two, next it will be read from port two and sent to 6 | // port three, and finally it will be read from port 7 | // three and sent to port zero. 8 | // 9 | // Place a loopback jumper connecting 10 | // RX1 to TX1, RX2 to TX2, RX3 to TX3 on ports 1, 2, and 3. 11 | // Do not place a jumper on port zero. 12 | // 13 | #include 14 | // port 0 unbuffered 15 | SerialPort<0, 0, 0> port0; 16 | 17 | // port 1 buffered RX 18 | SerialPort<1, 32, 0> port1; 19 | 20 | // port 2 buffered RX and TX 21 | SerialPort<2, 32, 32> port2; 22 | 23 | // port 3 buffered RX and TX 24 | SerialPort<3, 32, 32> port3; 25 | 26 | void transfer(Stream* in, Stream* out) { 27 | while(!in->available()) {} 28 | do { 29 | out->write(in->read()); 30 | uint32_t m = millis(); 31 | while (!in->available() && (millis() -m) < 3) {} 32 | } while (in->available()); 33 | } 34 | 35 | void setup() { 36 | port0.begin(9600); 37 | port1.begin(9600); 38 | port2.begin(9600); 39 | port3.begin(9600); 40 | } 41 | void loop() { 42 | port0.write("type a string\r\n"); 43 | transfer(&port0, &port1); 44 | transfer(&port1, &port2); 45 | transfer(&port2, &port3); 46 | transfer(&port3, &port0); 47 | port0.write("\r\n\r\n"); 48 | } 49 | -------------------------------------------------------------------------------- /html/search/classes_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SerialPort 13 |
14 |
15 |
16 |
17 | SerialRingBuffer 18 |
19 |
20 |
Searching...
21 |
No Matches
22 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /html/search/files_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SerialPort.cpp 13 |
14 |
15 |
16 |
17 | SerialPort.h 18 |
19 |
20 |
Searching...
21 |
No Matches
22 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /html/search/functions_65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | empty 13 | SerialRingBuffer 14 |
15 |
16 |
17 |
18 | end 19 | SerialPort 20 |
21 |
22 |
Searching...
23 |
No Matches
24 | 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /html/search/variables_72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | rxErrorBits 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | rxRingBuf 19 | SerialPort.h 20 |
21 |
22 |
Searching...
23 |
No Matches
24 | 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /html/search/defines_62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | BUFFERED_RX 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | BUFFERED_TX 19 | SerialPort.h 20 |
21 |
22 |
Searching...
23 |
No Matches
24 | 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /html/search/functions_72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 | 18 |
19 |
Searching...
20 |
No Matches
21 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /html/search/functions_61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 | 18 |
19 |
Searching...
20 |
No Matches
21 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /html/search/all_65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | empty 13 | SerialRingBuffer 14 |
15 |
16 |
17 |
18 | ENABLE_RX_ERROR_CHECKING 19 | SerialPort.h 20 |
21 |
22 |
23 |
24 | end 25 | SerialPort 26 |
27 |
28 |
Searching...
29 |
No Matches
30 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /html/search/all_67.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 | 19 |
20 |
21 | getRxError 22 | SerialPort 23 |
24 |
25 |
Searching...
26 |
No Matches
27 | 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /html/search/functions_67.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 | 19 |
20 |
21 | getRxError 22 | SerialPort 23 |
24 |
25 |
Searching...
26 |
No Matches
27 | 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /html/search/all_61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | ALLOW_LARGE_BUFFERS 13 | SerialPort.h 14 |
15 |
16 |
17 | 24 |
25 |
Searching...
26 |
No Matches
27 | 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /html/search/functions_62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | badPortNumber 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | badRxBufSize 19 | SerialPort.h 20 |
21 |
22 |
23 |
24 | badTxBufSize 25 | SerialPort.h 26 |
27 |
28 |
29 |
30 | begin 31 | SerialPort 32 |
33 |
34 |
Searching...
35 |
No Matches
36 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /html/search/all_66.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | flush 13 | 17 |
18 |
19 |
20 |
21 | flushRx 22 | SerialPort 23 |
24 |
25 |
26 |
27 | flushTx 28 | SerialPort 29 |
30 |
31 |
Searching...
32 |
No Matches
33 | 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /html/search/functions_66.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | flush 13 | 17 |
18 |
19 |
20 |
21 | flushRx 22 | SerialPort 23 |
24 |
25 |
26 |
27 | flushTx 28 | SerialPort 29 |
30 |
31 |
Searching...
32 |
No Matches
33 | 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /html/search/all_72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 | 18 |
19 |
20 |
21 | rxErrorBits 22 | SerialPort.h 23 |
24 |
25 |
26 |
27 | rxRingBuf 28 | SerialPort.h 29 |
30 |
31 |
Searching...
32 |
No Matches
33 | 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /SerialPortLogger/readme.txt: -------------------------------------------------------------------------------- 1 | This is a demo of a data logging sketch that is capable of logging serial 2 | data to an SD card at up to 115200 baud. 3 | 4 | You must install the SdFat library to use the SerialPortLogger. SdFat 5 | can be downloaded from: 6 | 7 | http://code.google.com/p/sdfatlib/downloads/list 8 | 9 | Normally the maximum rate for a 328 Arduino is 57600 baud. 10 | 11 | It is possible to log data at 115200 baud with a 328 Arduino if you use a high 12 | quality SD card. 13 | 14 | Lower quality cards can have an occasional write latency of over 100 15 | milliseconds. This will cause a receive data overrun at 115200 baud since 16 | the RX buffer on a 328 Arduino is 1024 bytes. You need to reduce the baud 17 | rate to 57600 if your SD card causes receive overruns. 18 | 19 | Most SD cards will work with a Mega Arduino at 115200 baud since the RX 20 | buffer is set to 4096 bytes. 21 | 22 | It is possible to use software SPI on a Mega by setting MEGA_SOFT_SPI nonzero 23 | in SdFatConfig.h. This will allow a shield like the Adafruit Data Logging 24 | shield to be used on a Mega without jumper wires. 25 | 26 | The two programs, SerialPortLogger.ino and SerialDataSource.ino, demonstrate 27 | high speed logging of serial data. 28 | 29 | To run this demo, you need two Arduino boards and an SD shield or SD module. 30 | 31 | The board with the SD shield should have an LED and series resistor connected 32 | from pin 3 to ground. This LED will blink an error code if an error occurs. 33 | 34 | Make sure BAUD_RATE has the same value in SerialPortLogger.ino and 35 | SerialDataSource.ino. 36 | 37 | Load SerialPortLogger.ino into the board with an SD shield or module and 38 | SerialDataSource.ino into the second board. 39 | 40 | Connect a wire between GND pins on the two boards. 41 | 42 | Connect a wire between the serial RX pin (Pin 0) on the SD board and the 43 | serial TX pin (pin 1) on the data source board. 44 | 45 | It is best to power the two boards with an external 9V supply. 46 | 47 | After the boards are powered up, wait until the pin 13 LED on the data source 48 | board goes out. This will take up to 50 seconds. 49 | 50 | Insert an SD into the logger board. press reset on the logger board. The 51 | error LED connected to pin 3 should not light. 52 | 53 | Press reset on the data source board. The pin 13 LED on the data source 54 | board should light for about 50 seconds at 57600 baud or 25 seconds at 55 | 115200 baud while 280,000 bytes are transferred. 56 | 57 | If an error occurs, the error LED on the SD board will flash an error code. 58 | See the SerialPortLogger.ino source for definitions of error codes. 59 | 60 | Remove the SD and check the file SERIAL.BIN. In this case it is a text file. -------------------------------------------------------------------------------- /SerialPortLogger/SerialPortLogger.ino: -------------------------------------------------------------------------------- 1 | // Serial data logger example. 2 | // Maximum baud rate for a 328 Arduino is 57600. 3 | // Maximum baud rate for a Mega Arduino is 115200. 4 | const uint32_t BAUD_RATE = 57600; 5 | 6 | // Maximum time between sync() calls in milliseconds. If Serial is always 7 | // active, you must provide a way to stop the program and close the file. 8 | const uint32_t MAX_SYNC_TIME_MSEC = 1000; 9 | 10 | // Pin number for error blink LED. 11 | // Set ERROR_LED_PIN to -1 for no error LED. 12 | const int8_t ERROR_LED_PIN = 3; 13 | 14 | #include 15 | #include 16 | 17 | #if defined(__AVR_ATmega1280__)\ 18 | || defined(__AVR_ATmega2560__) 19 | // Mega, use 4096 byte RX buffer 20 | SerialPort<0, 4096, 0> NewSerial; 21 | #else // Mega 22 | // not a Mega, use 1024 RX byte buffer 23 | SerialPort<0, 1024, 0> NewSerial; 24 | #endif 25 | 26 | SdFat sd; 27 | SdFile file; 28 | 29 | //------------------------------------------------------------------------------ 30 | // Error codes repeat as errno short blinks with a delay between codes. 31 | const uint8_t ERROR_INIT = 1; // SD init error 32 | const uint8_t ERROR_OPEN = 2; // file open error 33 | const uint8_t ERROR_SERIAL = 3; // serial error 34 | const uint8_t ERROR_WRITE = 4; // SD write or sync error 35 | void errorBlink(uint8_t errno) { 36 | uint8_t i; 37 | while (ERROR_LED_PIN < 0); 38 | while (1) { 39 | for (i = 0; i < errno; i++) { 40 | digitalWrite(ERROR_LED_PIN, HIGH); 41 | delay(200); 42 | digitalWrite(ERROR_LED_PIN, LOW); 43 | delay(200); 44 | } 45 | delay(1600); 46 | } 47 | } 48 | //------------------------------------------------------------------------------ 49 | void setup() { 50 | pinMode(ERROR_LED_PIN, OUTPUT); 51 | NewSerial.begin(BAUD_RATE); 52 | 53 | if (!sd.begin()) { 54 | errorBlink(ERROR_INIT); 55 | } 56 | if (!file.open("SERIAL.BIN", O_WRITE | O_CREAT | O_AT_END)) { 57 | errorBlink(ERROR_OPEN); 58 | } 59 | if (file.fileSize() == 0) { 60 | // Make sure first cluster is allocated. 61 | file.write((uint8_t)0); 62 | file.rewind(); 63 | file.sync(); 64 | } 65 | } 66 | //------------------------------------------------------------------------------ 67 | // Time of last sync call. 68 | uint32_t syncTime = 0; 69 | 70 | uint8_t buf[32]; 71 | void loop() { 72 | if (NewSerial.getRxError()) { 73 | errorBlink(ERROR_SERIAL); 74 | } 75 | uint8_t n = NewSerial.read(buf, sizeof(buf)); 76 | if (n > 0) { 77 | if (file.write(buf, n) != n) { 78 | errorBlink(ERROR_WRITE); 79 | } 80 | // Don't sync if active. 81 | return; 82 | } 83 | if ((millis() - syncTime) < MAX_SYNC_TIME_MSEC) return; 84 | 85 | if (!file.sync()) { 86 | errorBlink(ERROR_WRITE); 87 | } 88 | syncTime = millis(); 89 | } 90 | -------------------------------------------------------------------------------- /changes.txt: -------------------------------------------------------------------------------- 1 | 16 Feb 2014 2 | 3 | Fix 300 baud problem. 4 | 5 | Fix FreeMem() 6 | 7 | 22 Feb 2013 8 | 9 | Fixed problems with newer versions of avr-gcc. 10 | 11 | Fixed compatibility problems with Arduino 1.5.2 beta. 12 | 13 | Added documentation. 14 | 15 | Code cleanup. 16 | 17 | 6 Jan 2012 18 | 19 | Made buffer indice type an option (uint8_t or uint16_t) with 20 | #define ALLOW_LARGE_BUFFERS 21 | 22 | Added defines to hide templates: 23 | /** Define NewSerial with buffering like Arduino 1.0. */ 24 | #define USE_NEW_SERIAL SerialPort<0, 63, 63> NewSerial 25 | /** Define NewSerial1 with buffering like Arduino 1.0. */ 26 | #define USE_NEW_SERIAL1 SerialPort<1, 63, 63> NewSerial1 27 | /** Define NewSerial2 with buffering like Arduino 1.0. */ 28 | #define USE_NEW_SERIAL2 SerialPort<2, 63, 63> NewSerial2 29 | /** Define NewSerial3 with buffering like Arduino 1.0. */ 30 | #define USE_NEW_SERIAL3 SerialPort<3, 63, 63> NewSerial3 31 | 32 | Added HelloWorld example. 33 | 34 | Modified several examples. 35 | 36 | Internal changes based on running Google's style program cpplint.py. 37 | 38 | 4 Jan 2012 39 | 40 | Added examples: 41 | 42 | ReadWriteTest 43 | WriteFlash 44 | 45 | Added functions: 46 | 47 | size_t write_P(PGM_P b, size_t n); 48 | size_t write(const __FlashStringHelper* s); 49 | size_t writeln(const __FlashStringHelper* s); 50 | 51 | fixed bug in size_t read(uint8_t* b, size_t n) 52 | 53 | 54 | 3 Jan 2012 55 | 56 | Almost total rewrite so expect bugs! Be sure to tell me about bugs. 57 | 58 | See html for more details about the following functions. 59 | 60 | Changed begin() to have a optional second argument to set parity, 61 | character size, and number of stop bits. 62 | 63 | void begin (long baud, uint8_t options = SP_8_BIT_CHAR) 64 | 65 | The following can be ORed together for options: 66 | 67 | Choose one stop bit option. 68 | static const uint8_t SP_1_STOP_BIT = 0 (default) 69 | static const uint8_t SP_2_STOP_BIT = M_USBS 70 | 71 | Choose one character size. 72 | static const uint8_t SP_5_BIT_CHAR = 0 73 | static const uint8_t SP_6_BIT_CHAR = M_UCSZ0 74 | static const uint8_t SP_7_BIT_CHAR = M_UCSZ1 75 | static const uint8_t SP_8_BIT_CHAR = M_UCSZ0 | M_UCSZ1 76 | 77 | Choose one parity option. 78 | static const uint8_t SP_EVEN_PARITY = M_UPM1 79 | static const uint8_t SP_NO_PARITY = 0 80 | static const uint8_t SP_ODD_PARITY = M_UPM0 | M_UPM1 81 | 82 | Added RX error checking. 83 | 84 | The following error bits are returned: 85 | static const uint8_t SP_FRAMING_ERROR = M_FE 86 | static const uint8_t SP_PARITY_ERROR = M_UPE 87 | static const uint8_t SP_RX_BUF_OVERRUN = 1 88 | static const uint8_t SP_RX_DATA_OVERRUN = M_DOR 89 | 90 | Added the following functions: 91 | 92 | void clearRxError() 93 | uint8_t getRxError() 94 | size_t read (uint8_t *b, size_t n) 95 | size_t write (const char *s) - overrides version in Stream 96 | size_t write (uint8_t *b, size_t n) - overrides version in Stream 97 | size_t writeln (const char *s) 98 | size_t writeln () 99 | -------------------------------------------------------------------------------- /html/search/defines_75.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | USE_NEW_SERIAL 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | USE_NEW_SERIAL1 19 | SerialPort.h 20 |
21 |
22 |
23 |
24 | USE_NEW_SERIAL2 25 | SerialPort.h 26 |
27 |
28 |
29 |
30 | USE_NEW_SERIAL3 31 | SerialPort.h 32 |
33 |
34 |
35 |
36 | USE_WRITE_OVERRIDES 37 | SerialPort.h 38 |
39 |
40 |
Searching...
41 |
No Matches
42 | 48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /html/installdox: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | %subst = ( ); 4 | $quiet = 0; 5 | 6 | while ( @ARGV ) { 7 | $_ = shift @ARGV; 8 | if ( s/^-// ) { 9 | if ( /^l(.*)/ ) { 10 | $v = ($1 eq "") ? shift @ARGV : $1; 11 | ($v =~ /\/$/) || ($v .= "/"); 12 | $_ = $v; 13 | if ( /(.+)\@(.+)/ ) { 14 | if ( exists $subst{$1} ) { 15 | $subst{$1} = $2; 16 | } else { 17 | print STDERR "Unknown tag file $1 given with option -l\n"; 18 | &usage(); 19 | } 20 | } else { 21 | print STDERR "Argument $_ is invalid for option -l\n"; 22 | &usage(); 23 | } 24 | } 25 | elsif ( /^q/ ) { 26 | $quiet = 1; 27 | } 28 | elsif ( /^\?|^h/ ) { 29 | &usage(); 30 | } 31 | else { 32 | print STDERR "Illegal option -$_\n"; 33 | &usage(); 34 | } 35 | } 36 | else { 37 | push (@files, $_ ); 38 | } 39 | } 40 | 41 | foreach $sub (keys %subst) 42 | { 43 | if ( $subst{$sub} eq "" ) 44 | { 45 | print STDERR "No substitute given for tag file `$sub'\n"; 46 | &usage(); 47 | } 48 | elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) 49 | { 50 | print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; 51 | } 52 | } 53 | 54 | if ( ! @files ) { 55 | if (opendir(D,".")) { 56 | foreach $file ( readdir(D) ) { 57 | $match = ".html"; 58 | next if ( $file =~ /^\.\.?$/ ); 59 | ($file =~ /$match/) && (push @files, $file); 60 | ($file =~ /\.svg/) && (push @files, $file); 61 | ($file =~ "navtree.js") && (push @files, $file); 62 | } 63 | closedir(D); 64 | } 65 | } 66 | 67 | if ( ! @files ) { 68 | print STDERR "Warning: No input files given and none found!\n"; 69 | } 70 | 71 | foreach $f (@files) 72 | { 73 | if ( ! $quiet ) { 74 | print "Editing: $f...\n"; 75 | } 76 | $oldf = $f; 77 | $f .= ".bak"; 78 | unless (rename $oldf,$f) { 79 | print STDERR "Error: cannot rename file $oldf\n"; 80 | exit 1; 81 | } 82 | if (open(F,"<$f")) { 83 | unless (open(G,">$oldf")) { 84 | print STDERR "Error: opening file $oldf for writing\n"; 85 | exit 1; 86 | } 87 | if ($oldf ne "tree.js") { 88 | while () { 89 | s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; 90 | print G "$_"; 91 | } 92 | } 93 | else { 94 | while () { 95 | s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; 96 | print G "$_"; 97 | } 98 | } 99 | } 100 | else { 101 | print STDERR "Warning file $f does not exist\n"; 102 | } 103 | unlink $f; 104 | } 105 | 106 | sub usage { 107 | print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; 108 | print STDERR "Options:\n"; 109 | print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; 110 | print STDERR " -q Quiet mode\n\n"; 111 | exit 1; 112 | } 113 | -------------------------------------------------------------------------------- /html/search/all_70.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | peek 13 | 17 |
18 |
19 | 28 |
29 |
30 | put_P 31 | SerialRingBuffer 32 |
33 |
34 |
Searching...
35 |
No Matches
36 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /html/search/functions_70.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | peek 13 | 17 |
18 |
19 | 28 |
29 |
30 | put_P 31 | SerialRingBuffer 32 |
33 |
34 |
Searching...
35 |
No Matches
36 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /html/search/variables_75.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | ubrrh 13 | UsartRegister 14 |
15 |
16 |
17 |
18 | ubrrl 19 | UsartRegister 20 |
21 |
22 |
23 |
24 | ucsra 25 | UsartRegister 26 |
27 |
28 |
29 |
30 | ucsrb 31 | UsartRegister 32 |
33 |
34 |
35 |
36 | ucsrc 37 | UsartRegister 38 |
39 |
40 |
41 |
42 | udr 43 | UsartRegister 44 |
45 |
46 |
47 |
48 | usart 49 | SerialPort.h 50 |
51 |
52 |
Searching...
53 |
No Matches
54 | 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /html/search/all_62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | badPortNumber 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | badRxBufSize 19 | SerialPort.h 20 |
21 |
22 |
23 |
24 | badTxBufSize 25 | SerialPort.h 26 |
27 |
28 |
29 |
30 | begin 31 | SerialPort 32 |
33 |
34 |
35 |
36 | buf_size_t 37 | SerialRingBuffer 38 |
39 |
40 |
41 |
42 | BUFFERED_RX 43 | SerialPort.h 44 |
45 |
46 |
47 |
48 | BUFFERED_TX 49 | SerialPort.h 50 |
51 |
52 |
Searching...
53 |
No Matches
54 | 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /html/search/all_77.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 | 21 |
22 |
23 | write_P 24 | SerialPort 25 |
26 |
27 | 37 |
Searching...
38 |
No Matches
39 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /html/search/functions_77.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 | 21 |
22 |
23 | write_P 24 | SerialPort 25 |
26 |
27 | 37 |
Searching...
38 |
No Matches
39 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /html/functions_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Class Members - Typedefs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   72 |
73 | 74 | 79 | 80 | 81 |
82 | 85 |
86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /html/a00004.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Arduino/libraries/SerialPort/SerialPort.cpp File Reference 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
Arduino/libraries/SerialPort/SerialPort.cpp File Reference
61 |
62 |
63 | 64 |

Serial Port class. 65 | More...

66 |
#include <SerialPort.h>
67 |
68 |

Go to the source code of this file.

69 | 70 |
71 |

Detailed Description

72 |

Serial Port class.

73 | 74 |

Definition in file SerialPort.cpp.

75 |
76 | 77 | 82 | 83 | 84 |
85 | 88 |
89 | 90 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Class List 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
Class List
61 |
62 |
63 |
Here are the classes, structs, unions and interfaces with brief descriptions:
64 | 65 | 66 | 67 |
SerialPort< PortNumber, RxBufSize, TxBufSize >Class for avr hardware USART ports
SerialRingBufferRing buffer for RX and TX data
UsartRegisterAddresses of USART registers
68 |
69 | 70 | 75 | 76 | 77 |
78 | 81 |
82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /html/files.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: File List 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
File List
61 |
62 |
63 |
Here is a list of all documented files with brief descriptions:
64 | 65 | 66 | 67 |
Arduino/libraries/SerialPort/SerialPort.cpp [code]Serial Port class
Arduino/libraries/SerialPort/SerialPort.h [code]Serial Port class
SerialPortDoc/MainPage/SerialPortMainPage.h [code]
68 |
69 | 70 | 75 | 76 | 77 |
78 | 81 |
82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /html/globals_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: File Members 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   78 |
79 | 80 | 85 | 86 | 87 |
88 | 91 |
92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /html/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Class Index 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
Class Index
61 |
62 |
63 |
S | U
64 | 65 |
  S  
66 |
SerialPort   SerialRingBuffer   
  U  
67 |
UsartRegister   
S | U
68 |
69 | 70 | 75 | 76 | 77 |
78 | 81 |
82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /html/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | #FSearchBox { 4 | float: left; 5 | } 6 | 7 | #searchli { 8 | float: right; 9 | display: block; 10 | width: 170px; 11 | height: 36px; 12 | } 13 | 14 | #MSearchBox { 15 | white-space : nowrap; 16 | position: absolute; 17 | float: none; 18 | display: inline; 19 | margin-top: 8px; 20 | right: 0px; 21 | width: 170px; 22 | z-index: 102; 23 | } 24 | 25 | #MSearchBox .left 26 | { 27 | display:block; 28 | position:absolute; 29 | left:10px; 30 | width:20px; 31 | height:19px; 32 | background:url('search_l.png') no-repeat; 33 | background-position:right; 34 | } 35 | 36 | #MSearchSelect { 37 | display:block; 38 | position:absolute; 39 | width:20px; 40 | height:19px; 41 | } 42 | 43 | .left #MSearchSelect { 44 | left:4px; 45 | } 46 | 47 | .right #MSearchSelect { 48 | right:5px; 49 | } 50 | 51 | #MSearchField { 52 | display:block; 53 | position:absolute; 54 | height:19px; 55 | background:url('search_m.png') repeat-x; 56 | border:none; 57 | width:116px; 58 | margin-left:20px; 59 | padding-left:4px; 60 | color: #909090; 61 | outline: none; 62 | font: 9pt Arial, Verdana, sans-serif; 63 | } 64 | 65 | #FSearchBox #MSearchField { 66 | margin-left:15px; 67 | } 68 | 69 | #MSearchBox .right { 70 | display:block; 71 | position:absolute; 72 | right:10px; 73 | top:0px; 74 | width:20px; 75 | height:19px; 76 | background:url('search_r.png') no-repeat; 77 | background-position:left; 78 | } 79 | 80 | #MSearchClose { 81 | display: none; 82 | position: absolute; 83 | top: 4px; 84 | background : none; 85 | border: none; 86 | margin: 0px 4px 0px 0px; 87 | padding: 0px 0px; 88 | outline: none; 89 | } 90 | 91 | .left #MSearchClose { 92 | left: 6px; 93 | } 94 | 95 | .right #MSearchClose { 96 | right: 2px; 97 | } 98 | 99 | .MSearchBoxActive #MSearchField { 100 | color: #000000; 101 | } 102 | 103 | /*---------------- Search filter selection */ 104 | 105 | #MSearchSelectWindow { 106 | display: none; 107 | position: absolute; 108 | left: 0; top: 0; 109 | border: 1px solid #90A5CE; 110 | background-color: #F9FAFC; 111 | z-index: 1; 112 | padding-top: 4px; 113 | padding-bottom: 4px; 114 | -moz-border-radius: 4px; 115 | -webkit-border-top-left-radius: 4px; 116 | -webkit-border-top-right-radius: 4px; 117 | -webkit-border-bottom-left-radius: 4px; 118 | -webkit-border-bottom-right-radius: 4px; 119 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 120 | } 121 | 122 | .SelectItem { 123 | font: 8pt Arial, Verdana, sans-serif; 124 | padding-left: 2px; 125 | padding-right: 12px; 126 | border: 0px; 127 | } 128 | 129 | span.SelectionMark { 130 | margin-right: 4px; 131 | font-family: monospace; 132 | outline-style: none; 133 | text-decoration: none; 134 | } 135 | 136 | a.SelectItem { 137 | display: block; 138 | outline-style: none; 139 | color: #000000; 140 | text-decoration: none; 141 | padding-left: 6px; 142 | padding-right: 12px; 143 | } 144 | 145 | a.SelectItem:focus, 146 | a.SelectItem:active { 147 | color: #000000; 148 | outline-style: none; 149 | text-decoration: none; 150 | } 151 | 152 | a.SelectItem:hover { 153 | color: #FFFFFF; 154 | background-color: #3D578C; 155 | outline-style: none; 156 | text-decoration: none; 157 | cursor: pointer; 158 | display: block; 159 | } 160 | 161 | /*---------------- Search results window */ 162 | 163 | iframe#MSearchResults { 164 | width: 60ex; 165 | height: 15em; 166 | } 167 | 168 | #MSearchResultsWindow { 169 | display: none; 170 | position: absolute; 171 | left: 0; top: 0; 172 | border: 1px solid #000; 173 | background-color: #EEF1F7; 174 | } 175 | 176 | /* ----------------------------------- */ 177 | 178 | 179 | #SRIndex { 180 | clear:both; 181 | padding-bottom: 15px; 182 | } 183 | 184 | .SREntry { 185 | font-size: 10pt; 186 | padding-left: 1ex; 187 | } 188 | 189 | .SRPage .SREntry { 190 | font-size: 8pt; 191 | padding: 1px 5px; 192 | } 193 | 194 | body.SRPage { 195 | margin: 5px 2px; 196 | } 197 | 198 | .SRChildren { 199 | padding-left: 3ex; padding-bottom: .5em 200 | } 201 | 202 | .SRPage .SRChildren { 203 | display: none; 204 | } 205 | 206 | .SRSymbol { 207 | font-weight: bold; 208 | color: #425E97; 209 | font-family: Arial, Verdana, sans-serif; 210 | text-decoration: none; 211 | outline: none; 212 | } 213 | 214 | a.SRScope { 215 | display: block; 216 | color: #425E97; 217 | font-family: Arial, Verdana, sans-serif; 218 | text-decoration: none; 219 | outline: none; 220 | } 221 | 222 | a.SRSymbol:focus, a.SRSymbol:active, 223 | a.SRScope:focus, a.SRScope:active { 224 | text-decoration: underline; 225 | } 226 | 227 | .SRPage .SRStatus { 228 | padding: 2px 5px; 229 | font-size: 8pt; 230 | font-style: italic; 231 | } 232 | 233 | .SRResult { 234 | display: none; 235 | } 236 | 237 | DIV.searchresults { 238 | margin-left: 10px; 239 | margin-right: 10px; 240 | } 241 | -------------------------------------------------------------------------------- /html/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Class Members - Variables 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   87 |
88 | 89 | 94 | 95 | 96 |
97 | 100 |
101 | 102 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /html/a00011.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Member List 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
UsartRegister Member List
61 |
62 |
63 | This is the complete list of members for UsartRegister, including all inherited members. 64 | 65 | 66 | 67 | 68 | 69 | 70 |
ubrrhUsartRegister
ubrrlUsartRegister
ucsraUsartRegister
ucsrbUsartRegister
ucsrcUsartRegister
udrUsartRegister
71 | 72 | 77 | 78 | 79 |
80 | 83 |
84 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /html/search/all_75.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | ubrrh 13 | UsartRegister 14 |
15 |
16 |
17 |
18 | ubrrl 19 | UsartRegister 20 |
21 |
22 |
23 |
24 | ucsra 25 | UsartRegister 26 |
27 |
28 |
29 |
30 | ucsrb 31 | UsartRegister 32 |
33 |
34 |
35 |
36 | ucsrc 37 | UsartRegister 38 |
39 |
40 |
41 |
42 | udr 43 | UsartRegister 44 |
45 |
46 |
47 |
48 | usart 49 | SerialPort.h 50 |
51 |
52 |
53 |
54 | UsartRegister 55 |
56 |
57 |
58 |
59 | USE_NEW_SERIAL 60 | SerialPort.h 61 |
62 |
63 |
64 |
65 | USE_NEW_SERIAL1 66 | SerialPort.h 67 |
68 |
69 |
70 |
71 | USE_NEW_SERIAL2 72 | SerialPort.h 73 |
74 |
75 |
76 |
77 | USE_NEW_SERIAL3 78 | SerialPort.h 79 |
80 |
81 |
82 |
83 | USE_WRITE_OVERRIDES 84 | SerialPort.h 85 |
86 |
87 |
Searching...
88 |
No Matches
89 | 95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: File Members 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   99 |
100 | 101 | 106 | 107 | 108 |
109 | 112 |
113 | 114 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /MainPage/SerialPortMainPage.h: -------------------------------------------------------------------------------- 1 | /* Arduino SerialPort Library 2 | * Copyright (C) 2011 by William Greiman 3 | * 4 | * This file is part of the Arduino SerialPort Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SerialPort Library. If not, see 18 | * . 19 | */ 20 | /** 21 | \mainpage Arduino %SerialPort Library 22 |
Copyright © 2011 by William Greiman 23 |
24 | 25 | \section Intro Introduction 26 | This library provide more options for buffering, character size, parity and 27 | error checking than the standard Arduino HardwareSerial class for AVR Arduino 28 | boards. 29 | 30 | The API was designed to be backward compatible with Arduino Serial. 31 | A number of functions have been added to the API. 32 | 33 | To install the this library, copy the SerialPort folder to the 34 | your libraries folder. 35 | 36 | Please explore the above tabs for detailed documentation. 37 | 38 | @section howto Quick How To 39 | 40 | This was posted in the Arduino forum by user sixeyes. 41 | It is a nice introduction to to the SerialPort library. 42 | 43 | The core Arduino based serial code looks like this: 44 | 45 | @code 46 | void setup() 47 | { 48 | Serial.begin(9600); 49 | Serial.println("Using Arduino supplied HardwareSerial"); 50 | } 51 | 52 | void loop() 53 | { 54 | } 55 | @endcode 56 | 57 | So if you've copied the SerialPort folder from the zip file into your 58 | libraries folder (So you have Arduino/libraries/SerialPort/SerialPort.h 59 | and Arduino/libraries/SerialPort/SerialPort.cpp) 60 | you can write the following code instead 61 | 62 | @code 63 | #include 64 | 65 | SerialPort<0, 32, 256> port; 66 | 67 | void setup() 68 | { 69 | port.begin(9600); 70 | port.println("Using SerialPort class"); 71 | } 72 | 73 | void loop() 74 | { 75 | } 76 | @endcode 77 | 78 | Just remember to do the following and you should be alright: 79 | 80 | - Include 81 | - Declare new Serial port including its parameters 82 | - Initialise (call begin()) and use the new serial port (NOT Serial) 83 | . 84 | The configuration of the serial port looks odd to anyone not familiar with 85 | C++ templates, but it's easy to explain. The first parameter inside the 86 | angle brackets is the serial port number. Unless you've got a board with 87 | more than one serial port (e.g. Arduino Mega) this will always be 0. The 88 | second parameter is the size of the receive buffer in bytes and the third 89 | is the size of the transmit buffer in bytes. 90 | 91 | You can ignore the stuff about editing SerialPort.h. You'll only need this 92 | if you're short of flash memory at which point you can come back and ask 93 | more questions. 94 | 95 | If you do by chance refer to both the new SerialPort and HardwareSerial in 96 | the same sketch you'll get some error messages about duplicate interrupt 97 | vectors. 98 | 99 | Hope that helps. 100 | 101 | Iain 102 | 103 | @section logger SerialPort Sd Logger 104 | 105 | The folder, SerialPortLogger, contains a demo data logging sketch that is 106 | capable of logging serial data to an SD card at up to 115200 baud. 107 | 108 | The two programs, SerialPortLogger.ino and SerialDataSource.ino, demonstrate 109 | high speed logging of serial data. 110 | 111 | For more information see the readme.txt file in the SerialPortLogger folder. 112 | 113 | @section examples Examples 114 | 115 | A number of examples are included in the SerialPort/examples folder. 116 | 117 | ArduinoSize - Print the amount of free RAM using Arduino HardwareSerial. 118 | 119 | ArduinoTest - Arduino HardwareSerial version of test sketch. 120 | 121 | BufferedSize - Print the amount of free RAM using SerialPort with 122 | buffered RX and TX. 123 | 124 | BufferedTest - Test SerialPort with buffered RX and TX. 125 | 126 | HelloWorld - Simple first example. 127 | 128 | MegaTest - Test all ports on a Mega using SerialPort. 129 | 130 | MegaTestArduino - Test all ports on a Mega using Arduino HardwareSerial. 131 | 132 | ReadWriteTest - Test that ring buffer overrun can be detected. 133 | 134 | UnbufferedSize - Print the amount of free RAM using SerialPort with no buffers. 135 | 136 | UnbufferedTest - Test SerialPort with no buffering. 137 | 138 | WriteFlash - Test write() for a flash string. 139 | 140 | @section config Configuration Options 141 | 142 | You can can save flash if your buffers are always smaller than 254 bytes 143 | by setting ALLOW_LARGE_BUFFERS zero in SerialPort.h. This will also 144 | increase performance slightly. 145 | 146 | You can save substantial flash by disabling the faster versions of 147 | write(const char*) and write(const uint8_t*, size_t) by setting 148 | USE_WRITE_OVERRIDES zero in SerialPort.h. 149 | 150 | If you only use unbuffered TX, edit SerialPort.h and set BUFFERED_TX zero. 151 | This will save some flash and RAM by preventing the TX ISR from being 152 | loaded. TxBufSize must always be zero in SerialPort constructors if 153 | BUFFERED_TX is zero. 154 | 155 | If you only do output or if input buffering is not required, edit 156 | SerialPort.h and set BUFFERED_RX zero. This will save some flash 157 | and RAM by preventing the RX ISR from being loaded. RxBufSize must 158 | always be zero in SerialPort constructors if BUFFERED_RX is zero. 159 | 160 | You can disable RX error functions by setting ENABLE_RX_ERROR_CHECKING 161 | zero in SerialPort.h This will save a tiny bit of flash, RAM, and 162 | speedup receive a little. 163 | */ -------------------------------------------------------------------------------- /html/a00006_source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: SerialPortDoc/MainPage/SerialPortMainPage.h Source File 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
SerialPortDoc/MainPage/SerialPortMainPage.h
60 |
61 |
62 |
00001 /* Arduino SerialPort Library
 63 | 00002  * Copyright (C) 2011 by William Greiman
 64 | 00003  *
 65 | 00004  * This file is part of the Arduino SerialPort Library
 66 | 00005  *
 67 | 00006  * This Library is free software: you can redistribute it and/or modify
 68 | 00007  * it under the terms of the GNU General Public License as published by
 69 | 00008  * the Free Software Foundation, either version 3 of the License, or
 70 | 00009  * (at your option) any later version.
 71 | 00010  *
 72 | 00011  * This Library is distributed in the hope that it will be useful,
 73 | 00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 74 | 00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 75 | 00014  * GNU General Public License for more details.
 76 | 00015  *
 77 | 00016  * You should have received a copy of the GNU General Public License
 78 | 00017  * along with the Arduino SerialPort Library.  If not, see
 79 | 00018  * <http://www.gnu.org/licenses/>.
 80 | 00019  */
 81 | 
82 |
83 | 84 | 89 | 90 | 91 |
92 | 95 |
96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /html/a00010.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Member List 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 |
58 |
59 |
60 |
SerialRingBuffer Member List
61 |
62 |
63 | This is the complete list of members for SerialRingBuffer, including all inherited members. 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
available()SerialRingBuffer
buf_size_t typedefSerialRingBuffer
empty()SerialRingBuffer [inline]
flush()SerialRingBuffer
get(uint8_t *b)SerialRingBuffer
get(uint8_t *b, buf_size_t n)SerialRingBuffer
init(uint8_t *b, buf_size_t s)SerialRingBuffer
peek()SerialRingBuffer
put(uint8_t b)SerialRingBuffer
put(const uint8_t *b, buf_size_t n)SerialRingBuffer
put_P(PGM_P b, buf_size_t n)SerialRingBuffer
76 | 77 | 82 | 83 | 84 |
85 | 88 |
89 | 90 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /html/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: File Members 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   126 |
127 | 128 | 133 | 134 | 135 |
136 | 139 |
140 | 141 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /html/search/variables_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SP_1_STOP_BIT 13 | SerialPort.h 14 |
15 |
16 |
17 |
18 | SP_2_STOP_BIT 19 | SerialPort.h 20 |
21 |
22 |
23 |
24 | SP_5_BIT_CHAR 25 | SerialPort.h 26 |
27 |
28 |
29 |
30 | SP_6_BIT_CHAR 31 | SerialPort.h 32 |
33 |
34 |
35 |
36 | SP_7_BIT_CHAR 37 | SerialPort.h 38 |
39 |
40 |
41 |
42 | SP_8_BIT_CHAR 43 | SerialPort.h 44 |
45 |
46 |
47 |
48 | SP_EVEN_PARITY 49 | SerialPort.h 50 |
51 |
52 |
53 |
54 | SP_FRAMING_ERROR 55 | SerialPort.h 56 |
57 |
58 |
59 |
60 | SP_NO_PARITY 61 | SerialPort.h 62 |
63 |
64 |
65 |
66 | SP_ODD_PARITY 67 | SerialPort.h 68 |
69 |
70 |
71 |
72 | SP_OPT_MASK 73 | SerialPort.h 74 |
75 |
76 |
77 |
78 | SP_PARITY_ERROR 79 | SerialPort.h 80 |
81 |
82 |
83 |
84 | SP_RX_BUF_OVERRUN 85 | SerialPort.h 86 |
87 |
88 |
89 |
90 | SP_RX_DATA_OVERRUN 91 | SerialPort.h 92 |
93 |
94 |
95 |
96 | SP_UCSRA_ERROR_MASK 97 | SerialPort.h 98 |
99 |
100 |
Searching...
101 |
No Matches
102 | 108 |
109 | 110 | 111 | -------------------------------------------------------------------------------- /html/functions_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Serial Port: Class Members - Functions 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 |
17 |
18 | 19 | 20 | 21 | 24 | 25 | 26 |
22 |
Serial Port
23 |
27 |
28 | 51 | 57 | 65 |
66 |
67 |   129 |
130 | 131 | 136 | 137 | 138 |
139 | 142 |
143 | 144 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /SerialPort/SerialPort.cpp: -------------------------------------------------------------------------------- 1 | /* Arduino SerialPort Library 2 | * Copyright (C) 2011 by William Greiman 3 | * 4 | * This file is part of the Arduino SerialPort Library 5 | * 6 | * This Library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This Library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with the Arduino SerialPort Library. If not, see 18 | * . 19 | */ 20 | /** 21 | * @file 22 | * @brief Serial Port class 23 | */ 24 | #include 25 | //------------------------------------------------------------------------------ 26 | /** @return The number of bytes in the ring buffer. 27 | * 28 | * @note This function must not be called with interrupts disabled. 29 | */ 30 | int SerialRingBuffer::available() { 31 | uint8_t s = SREG; 32 | cli(); 33 | int n = head_ - tail_; 34 | SREG = s; 35 | return n < 0 ? size_ + n : n; 36 | } 37 | //------------------------------------------------------------------------------ 38 | /** Discard all data in the ring buffer. 39 | * 40 | * @note This function must not be called with interrupts disabled. 41 | */ 42 | void SerialRingBuffer::flush() { 43 | uint8_t s = SREG; 44 | cli(); 45 | head_ = tail_ = 0; 46 | SREG = s; 47 | } 48 | //------------------------------------------------------------------------------ 49 | /** Get the next byte from the ring buffer. 50 | * 51 | * @param[in] b location for the returned byte 52 | * @return @c true if a byte was returned or @c false if the ring buffer is empty 53 | */ 54 | bool SerialRingBuffer::get(uint8_t* b) { 55 | buf_size_t t = tail_; 56 | if (head_ == t) return false; 57 | *b = buf_[t++]; 58 | tail_ = t < size_ ? t : 0; 59 | return true; 60 | } 61 | //------------------------------------------------------------------------------ 62 | /** 63 | * Get the maximum number of contiguous bytes from the ring buffer 64 | * with one call to memcpy. 65 | * 66 | * @note This function must not be called with interrupts disabled. 67 | * 68 | * @param[in] b Pointer to the data. 69 | * @param[in] n Number of bytes to transfer from the ring buffer. 70 | * @return Number of bytes transferred. 71 | */ 72 | SerialRingBuffer::buf_size_t SerialRingBuffer::get(uint8_t* b, buf_size_t n) { 73 | buf_size_t nr; 74 | cli(); 75 | buf_size_t h = head_; 76 | sei(); 77 | buf_size_t t = tail_; 78 | if (h < t) { 79 | nr = size_ - t; 80 | } else if (t < h) { 81 | nr = h - t; 82 | } else { 83 | return 0; 84 | } 85 | if (nr > n) nr = n; 86 | memcpy(b, &buf_[t], nr); 87 | t += nr; 88 | tail_ = t < size_ ? t : t - size_; 89 | return nr; 90 | } 91 | //------------------------------------------------------------------------------ 92 | /** Initialize the ring buffer. 93 | * @param[in] b Buffer for the data. 94 | * @param[in] s Size of the buffer. 95 | */ 96 | void SerialRingBuffer::init(uint8_t* b, buf_size_t s) { 97 | buf_ = b; 98 | size_ = s; 99 | head_ = tail_ = 0; 100 | } 101 | //------------------------------------------------------------------------------ 102 | /** Peek at the next byte in the ring buffer. 103 | * @return The next byte that would be read or -1 if the ring buffer is empty. 104 | */ 105 | int SerialRingBuffer::peek() { 106 | return empty() ? -1 : buf_[tail_]; 107 | } 108 | //------------------------------------------------------------------------------ 109 | /** Put a byte into the ring buffer. 110 | * 111 | * @param[in] b the byte 112 | * @return @c true if byte was transferred or 113 | * @c false if the ring buffer is full. 114 | */ 115 | bool SerialRingBuffer::put(uint8_t b) { 116 | buf_size_t h = head_; 117 | // OK to store here even if ring is full. 118 | buf_[h++] = b; 119 | if (h >= size_) h = 0; 120 | if (h == tail_) return false; 121 | head_ = h; 122 | return true; 123 | } 124 | //------------------------------------------------------------------------------ 125 | /** 126 | * Put the maximum number of contiguous bytes into the ring buffer. 127 | * with one call to memcpy. 128 | * 129 | * @note This function must not be called with interrupts disabled. 130 | * 131 | * @param[in] b pointer to data. 132 | * @param[in] n number of bytes to transfer to the ring buffer. 133 | * @return number of bytes transferred. 134 | */ 135 | SerialRingBuffer::buf_size_t 136 | SerialRingBuffer::put(const uint8_t* b, buf_size_t n) { 137 | cli(); 138 | buf_size_t t = tail_; 139 | sei(); 140 | buf_size_t space; // space in ring buffer 141 | buf_size_t h = head_; 142 | if (h < t) { 143 | space = t - h - 1; 144 | } else { 145 | space = size_ - h; 146 | if (t == 0) space -= 1; 147 | } 148 | if (n > space) n = space; 149 | memcpy(&buf_[h], b, n); 150 | h += n; 151 | head_ = h < size_ ? h : h - size_; 152 | return n; 153 | } 154 | //------------------------------------------------------------------------------ 155 | /** 156 | * Put the maximum number of contiguous bytes into the ring buffer. 157 | * with one call to memcpy. 158 | * 159 | * @note This function must not be called with interrupts disabled. 160 | * 161 | * @param[in] b pointer to data. 162 | * @param[in] n number of bytes to transfer to the ring buffer. 163 | * @return number of bytes transferred. 164 | */ 165 | SerialRingBuffer::buf_size_t SerialRingBuffer::put_P(PGM_P b, buf_size_t n) { 166 | cli(); 167 | buf_size_t t = tail_; 168 | sei(); 169 | buf_size_t space; // space in ring buffer 170 | buf_size_t h = head_; 171 | if (h < t) { 172 | space = t - h - 1; 173 | } else { 174 | space = size_ - h; 175 | if (t == 0) space -= 1; 176 | } 177 | if (n > space) n = space; 178 | memcpy_P(&buf_[h], b, n); 179 | h += n; 180 | head_ = h < size_ ? h : h - size_; 181 | return n; 182 | } 183 | //============================================================================== 184 | // global data and ISRs 185 | #if ENABLE_RX_ERROR_CHECKING 186 | // 187 | uint8_t rxErrorBits[SERIAL_PORT_COUNT]; 188 | #endif // ENABLE_RX_ERROR_CHECKING 189 | //------------------------------------------------------------------------------ 190 | #if BUFFERED_RX 191 | //------------------------------------------------------------------------------ 192 | SerialRingBuffer rxRingBuf[SERIAL_PORT_COUNT]; 193 | //------------------------------------------------------------------------------ 194 | #if ENABLE_RX_ERROR_CHECKING 195 | inline static void rx_isr(uint8_t n) { 196 | uint8_t e = *usart[n].ucsra & SP_UCSRA_ERROR_MASK; 197 | uint8_t b = *usart[n].udr; 198 | if (!rxRingBuf[n].put(b)) e |= SP_RX_BUF_OVERRUN; 199 | rxErrorBits[n] |= e; 200 | } 201 | #else // ENABLE_RX_ERROR_CHECKING 202 | inline static void rx_isr(uint8_t n) { 203 | uint8_t b = *usart[n].udr; 204 | rxRingBuf[n].put(b); 205 | } 206 | #endif // ENABLE_RX_ERROR_CHECKING 207 | //------------------------------------------------------------------------------ 208 | // SerialRingBuffer rxbuf0; 209 | #if defined(USART_RX_vect) 210 | ISR(USART_RX_vect) { 211 | rx_isr(0); 212 | } 213 | #elif defined(USART0_RX_vect) 214 | ISR(USART0_RX_vect) { 215 | rx_isr(0); 216 | } 217 | #endif // vector USART0 218 | 219 | #ifdef USART1_RX_vect 220 | ISR(USART1_RX_vect) { 221 | rx_isr(1); 222 | } 223 | #endif // USART1_RX_vect 224 | 225 | #ifdef USART2_RX_vect 226 | ISR(USART2_RX_vect) { 227 | rx_isr(2); 228 | } 229 | #endif // USART2_RX_vect 230 | 231 | #ifdef USART3_RX_vect 232 | ISR(USART3_RX_vect) { 233 | rx_isr(3); 234 | } 235 | #endif // USART3_RX_vect 236 | #endif // BUFFERED_RX 237 | //------------------------------------------------------------------------------ 238 | #if BUFFERED_TX 239 | //------------------------------------------------------------------------------ 240 | SerialRingBuffer txRingBuf[SERIAL_PORT_COUNT]; 241 | //------------------------------------------------------------------------------ 242 | inline static void tx_isr(uint8_t n) { 243 | uint8_t b; 244 | if (txRingBuf[n].get(&b)) { 245 | *usart[n].udr = b; 246 | } else { 247 | // no data - disable interrupts 248 | *usart[n].ucsrb &= ~M_UDRIE; 249 | } 250 | } 251 | #if defined(UART0_UDRE_vect) 252 | ISR(UART0_UDRE_vect) { 253 | tx_isr(0); 254 | } 255 | #elif defined(UART_UDRE_vect) 256 | ISR(UART_UDRE_vect) { 257 | tx_isr(0); 258 | } 259 | #elif defined(USART0_UDRE_vect) 260 | ISR(USART0_UDRE_vect) { 261 | tx_isr(0); 262 | } 263 | #elif defined(USART_UDRE_vect) 264 | ISR(USART_UDRE_vect) { 265 | tx_isr(0); 266 | } 267 | #endif // USART0 TX 268 | 269 | #ifdef USART1_UDRE_vect 270 | ISR(USART1_UDRE_vect) { 271 | tx_isr(1); 272 | } 273 | #endif // USART1_UDRE_vect 274 | 275 | #ifdef USART2_UDRE_vect 276 | ISR(USART2_UDRE_vect) { 277 | tx_isr(2); 278 | } 279 | #endif // USART2_UDRE_vect 280 | 281 | #ifdef USART3_UDRE_vect 282 | ISR(USART3_UDRE_vect) { 283 | tx_isr(3); 284 | } 285 | #endif // USART3_UDRE_vect 286 | #endif // BUFFERED_TX 287 | -------------------------------------------------------------------------------- /html/search/all_73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
Loading...
10 |
11 |
12 | SERIAL_PORT_VERSION 13 | SerialPort.h 14 |
15 |
16 | 25 |
26 |
27 | SerialPort.cpp 28 |
29 |
30 |
31 |
32 | SerialPort.h 33 |
34 |
35 |
36 |
37 | SerialRingBuffer 38 |
39 |
40 |
41 |
42 | SP_1_STOP_BIT 43 | SerialPort.h 44 |
45 |
46 |
47 |
48 | SP_2_STOP_BIT 49 | SerialPort.h 50 |
51 |
52 |
53 |
54 | SP_5_BIT_CHAR 55 | SerialPort.h 56 |
57 |
58 |
59 |
60 | SP_6_BIT_CHAR 61 | SerialPort.h 62 |
63 |
64 |
65 |
66 | SP_7_BIT_CHAR 67 | SerialPort.h 68 |
69 |
70 |
71 |
72 | SP_8_BIT_CHAR 73 | SerialPort.h 74 |
75 |
76 |
77 |
78 | SP_EVEN_PARITY 79 | SerialPort.h 80 |
81 |
82 |
83 |
84 | SP_FRAMING_ERROR 85 | SerialPort.h 86 |
87 |
88 |
89 |
90 | SP_NO_PARITY 91 | SerialPort.h 92 |
93 |
94 |
95 |
96 | SP_ODD_PARITY 97 | SerialPort.h 98 |
99 |
100 |
101 |
102 | SP_OPT_MASK 103 | SerialPort.h 104 |
105 |
106 |
107 |
108 | SP_PARITY_ERROR 109 | SerialPort.h 110 |
111 |
112 |
113 |
114 | SP_RX_BUF_OVERRUN 115 | SerialPort.h 116 |
117 |
118 |
119 |
120 | SP_RX_DATA_OVERRUN 121 | SerialPort.h 122 |
123 |
124 |
125 |
126 | SP_UCSRA_ERROR_MASK 127 | SerialPort.h 128 |
129 |
130 |
Searching...
131 |
No Matches
132 | 138 |
139 | 140 | 141 | --------------------------------------------------------------------------------