Update to take advantage of the new Stream class in Arduino 0019.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@387 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
DrZiplok@gmail.com 2010-09-05 19:43:08 +00:00
parent 2913b74b3a
commit 009ef940c6
3 changed files with 9 additions and 6 deletions

View File

@ -150,7 +150,7 @@ void FastSerial::end()
}
uint8_t
int
FastSerial::available(void)
{
return((RX_BUFFER_SIZE + _rxBuffer.head - _rxBuffer.tail) % RX_BUFFER_SIZE);

View File

@ -45,11 +45,14 @@
#define FastSerial_h
// disable the stock Arduino serial driver
#ifdef HardwareSerial_h
# error Must include FastSerial.h before the Arduino serial driver is defined.
#endif
#define HardwareSerial_h
#include <inttypes.h>
#include <stdio.h>
#include <Print.h>
#include <Stream.h>
#include <avr/interrupt.h>
//
@ -82,7 +85,7 @@ extern class FastSerial Serial2;
extern class FastSerial Serial3;
class FastSerial : public Print {
class FastSerial : public Stream {
public:
FastSerial(const uint8_t portNumber,
volatile uint8_t *ubrrh,
@ -97,12 +100,12 @@ public:
// Serial API
void begin(long baud);
void end(void);
uint8_t available(void);
int available(void);
int read(void);
void flush(void);
void write(uint8_t c);
void write(const uint8_t *buffer, int count);
using Print::write;
using Stream::write;
// stdio extensions
int printf(const char *fmt, ...);

View File

@ -18,7 +18,7 @@
// Create a FastSerial driver that looks just like the stock Arduino
// driver.
//
FastSerial Serial;
FastSerialPort0(Serial);
//
// To create a driver for a different serial port, on a board that