Pat Hickey
8577a0c7a1
MultiFastSerial example sketch: notes on fatal error in avr-gcc 4.5.x
2012-10-15 20:42:19 -07:00
Pat Hickey
2dace5cf5f
FastSerial example sketch: Depend on AP_Common for PSTR definitions
2012-10-15 20:42:18 -07:00
Pat Hickey
def4ffbe86
AP_Common: PSTR def has specific version for avr-gcc 4.6 compatibility
...
* Also a small change in FastSerial/vprintf.cpp, which duplicates the
PSTR definition
* Won't effect others using earlier versions of avr-gcc
2012-10-15 20:42:18 -07:00
Pat Hickey
2c9678bf01
MultiFastSerial test: make it easier to observe which serial port causes crash
2012-10-14 21:08:33 -07:00
Pat Hickey
afcc3c735a
FastSerial: add extra example sketch MultiFastSerial to test multiple ports
2012-10-14 18:58:12 -07:00
Andrew Tridgell
a2f802e5da
build: fixed more build warnings
2012-08-09 16:19:39 +10:00
Andrew Tridgell
b7e807cd58
FastSerial: added tx_pending() method
...
this allows the caller to wait for the tx buffer to drain
2012-06-15 15:53:27 +10:00
Andrew Tridgell
04a71197f9
FastSerial: avoid buffer re-allocation on re-open if possible
...
we commonly re-open serial ports a lot in the AUTO GPS driver
2012-06-09 07:43:22 +10:00
Andrew Tridgell
08b66e18b7
FastSerial: added set_blocking_writes() interface
...
this allows us to put a serial port into non-blocking mode, so that
writes that don't fit in the transmit buffer are dropped. This will be
used in flight to prevent stray printf() calls from causing large time
delays in the code
2012-03-30 17:46:20 +11:00
Randy Mackay
8bcc567406
AP_PID, AP_RC_Channel, FastSerial - small changes to make example sketches compile again
2012-01-28 17:54:20 +09:00
Randy Mackay
98f3386ea0
Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
...
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Mike Smith
ac3f7512cc
Fix issue #423 - FastSerial flush bug.
2011-12-26 15:52:21 -08:00
Andrew Tridgell
f073837ea7
desktop: use the libc printf engine
...
getting ftoa_engine right was too much work
2011-11-08 11:59:30 +11:00
Andrew Tridgell
ab755ab11f
use ifdef for DESKTOP_BUILD
2011-10-09 22:16:14 +11:00
Andrew Tridgell
cb8f8ec083
fastserial: allow vprintf() to build without assembler
2011-10-09 22:08:59 +11:00
James Goppert
ac3e73f5c0
Optional recursion added.
2011-09-30 17:17:51 -04:00
James Goppert
112d5e9531
Improvements to cmake.
2011-09-29 21:23:26 -04:00
James Goppert
e6e94837e9
Added APO branch.
2011-09-28 20:51:12 -04:00
unknown
9f028bb5a0
Adding CMake support
2011-09-14 15:44:55 +02:00
tridge60@gmail.com
6cfb9a9c2b
replace space() with txspace()
...
space() was actually intended to be tx buffer space, it just had a
bug. The name txspace() is clearer however, and should prevent
confusion as to which buffer its for
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3247 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 22:52:11 +00:00
tridge60@gmail.com
85a8d1b5c5
added txspace() method to FastSerial
...
this returns the number of bytes available in the transmit buffer
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3245 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-09-04 21:23:15 +00:00
DrZiplok
4d6637389a
Add a method to BetterStream and FastSerial that can be used to report
...
the amount of data that can be written without blocking.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2549 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-12 22:26:39 +00:00
james.goppert
e6c4595d3c
Massive warning fixes.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2089 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-04 19:12:27 +00:00
james.goppert
a840314b97
APO merge.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1935 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-01 02:05:17 +00:00
james.goppert@gmail.com
90676903ba
Eclipse makefile support for examples.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1861 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-04-09 19:39:27 +00:00
mich146@hotmail.com
bff541a8a6
FastSerial Fix
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1826 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-29 00:08:27 +00:00
tridge60@gmail.com
211de598c3
implemented typesafe PSTR()
...
This makes PSTR() type safe by using a 1 byte wrapper
structure. Attempts to use the wrong varient of a print function will
generate a compilation error.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1797 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-03-21 07:25:48 +00:00
DrZiplok@gmail.com
b88cfe92f4
Extend the logic that preserves buffer sizing on re-begin by also avoiding freeing and re-allocating buffers when they don't change in size.
...
This can make re-opening a port faster (as the free/malloc pair can be avoided) and possibly more robust (in the case where e.g. the heap has been corrupted).
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1479 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 08:17:31 +00:00
DrZiplok@gmail.com
c2c663a188
Add documentation and reformat closer to our current code standard.
...
Add support for re-opening a port without changing the baudrate or buffer sizes. By passing zero for the parameters that aren't to be changed, code can reconfigure a port without needing to know how it was originally configured.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1462 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-10 01:17:03 +00:00
DrZiplok
6ff11ea1fd
Simplify FastSerial::begin baudrate calculations in line with the changes made in Arduino-0022
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1424 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-01-04 18:41:27 +00:00
DrZiplok
efd0f2dc57
Improve documentation re: macros used to define serial ports.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1335 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-28 23:26:10 +00:00
DrZiplok
47bb4d22c6
Use the presence of UDRx as an indication that the serial port x might need to be supported.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1200 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-19 19:57:34 +00:00
rmackay9@yahoo.com
a257c51a09
Some changes to fix compile errors when using ATmega2560.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1187 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-19 13:05:02 +00:00
DrZiplok@gmail.com
363d9156d1
Change the way that we do board-to-board portability to avoid knowing about specific AVR devices; use the availability of registers/vectors instead. This lets us reduce the overall macro evil as well.
...
Drop some unused, old vector code.
Strip the UDR pointer from the class instance, since it's never used.
Fix up the comment describing RAM savings.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1145 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-16 08:48:20 +00:00
DrZiplok@gmail.com
0fd1228e27
Add ::peek for compatibility with trunk Arduino.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@943 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-27 01:49:10 +00:00
DrZiplok@gmail.com
70baf31139
Resurrect lf -> crlf translation that was lost when I dropped the stdio support.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@921 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-25 03:41:52 +00:00
DrZiplok@gmail.com
aa2bbe9131
A better workaround for the PSTR warning bug. This seems to work correctly.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@919 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-25 02:59:15 +00:00
DrZiplok@gmail.com
2dfb44907f
Add a test case for printf_P
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@918 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-25 01:55:21 +00:00
DrZiplok
c473af0082
Back out the "workaround" for PSTR() warnings; it doesn't.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@913 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-24 08:07:04 +00:00
DrZiplok@gmail.com
f30bf9cab7
Add format attributes to printf and printf_P. The latter is a bit wishful as gcc isn't smart enough to deal with what PSTR does, but with some other hackery this can be used to generate useful warnings.
...
Add a workaround for a GCC bug that generates spurious warnings when PSTR() is used.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@901 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-23 09:09:52 +00:00
DrZiplok@gmail.com
43262a573f
Bring in floating point support for BetterStream::printf, courtesy of the avr-libc implementation.
...
Strip the stdio integration from FastSerial as we aren't using it and it just wastes space.
Note that this does not attempt to fix the bogus floating point handling in ::print(ln). That's an issue for another day.
BetterStream::printf(_P) aka FastSerial::printf(_P) support is now as documented for avr-libc printf with floating point support enabled.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@895 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-23 00:38:16 +00:00
DrZiplok@gmail.com
c833182dbe
Duplicate include protection for BetterStream.h
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@761 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-01 07:42:51 +00:00
DrZiplok@gmail.com
271d4736a8
Factor the Stream-related enhancements out from FastSerial proper, so that we could use them on other Stream subclasses if that seemed worthwhile.
...
Add print_P and println_P implementations to give folks wedded to the vanilla Stream methods a way to print PROGMEM strings.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@715 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-23 05:59:40 +00:00
DrZiplok
84697f4111
Fix ::printf_P to transmit to the correct interface. Fixes the XBee test.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@685 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-18 04:40:33 +00:00
DrZiplok@gmail.com
ca6d51cddb
If ::begin() is called on a port that is already open, preserve the previous buffer settings. This makes it easy to change serial speeds without having to know how the port buffers were set up originally.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@672 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-10-17 06:15:47 +00:00
DrZiplok@gmail.com
5ba0c7328f
Hook up stdio input, for the heck of it. We seem to be moving away from it, but there are things it can do that are hard to do with the Stream interfaces.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@555 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-25 18:15:56 +00:00
DrZiplok@gmail.com
d45f67b3ef
Add a carriage return before printing a newline when we are called as stdout/stderr.
...
git-svn-id: https://arducopter.googlecode.com/svn/trunk@547 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-24 07:32:38 +00:00
DrZiplok@gmail.com
f72129bdb3
Clean up the bitrate calculations per the Atmel datasheet.
...
Verified that when configured for 115200, the actual output as seen on a scope is around 117600Hz consistent with the +2.1% error in the datasheet.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@542 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-23 05:41:30 +00:00
DrZiplok@gmail.com
9db013e648
Stop trying to be so clever in the tx interrupt handler. We may race with the code stuffing bytes into the ring such that we consume the last byte and empty the ring before they set the UDRE interrupt.
...
If that happens since we weren't checking the ring for emptiness we would loop and spit out the whole ring again. It's cheaper in terms of interrupt latency to just check the ring at interrupt time than it is to futz with ATOMIC_BLOCKs in the ::write code.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@535 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-22 06:56:27 +00:00
DrZiplok@gmail.com
6d31545b8d
Per Jose, fix the interrupt vectors to work for non-1280-based Arduino.
...
Make Serial0 also stdin and stderr.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@534 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-22 03:00:10 +00:00