1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Merge branch 'new-extension' of github.com:arduino/Arduino into new-extension

This commit is contained in:
David A. Mellis 2011-02-18 10:45:25 -05:00
commit a1648c0775
4 changed files with 7 additions and 33 deletions

View File

@ -421,7 +421,7 @@ void SoftwareSerial::end()
// Read data from buffer
int SoftwareSerial::read()
{
if (!is_listening())
if (!isListening())
return -1;
// Empty buffer?
@ -436,7 +436,7 @@ int SoftwareSerial::read()
int SoftwareSerial::available()
{
if (!is_listening())
if (!isListening())
return 0;
return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
@ -488,30 +488,9 @@ void SoftwareSerial::write(uint8_t b)
tunedDelay(_tx_delay);
}
#if !defined(cbi)
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
void SoftwareSerial::enable_timer0(bool enable)
{
if (enable)
#if defined(__AVR_ATmega8__)
sbi(TIMSK, TOIE0);
#else
sbi(TIMSK0, TOIE0);
#endif
else
#if defined(__AVR_ATmega8__)
cbi(TIMSK, TOIE0);
#else
cbi(TIMSK0, TOIE0);
#endif
}
void SoftwareSerial::flush()
{
if (!is_listening())
if (!isListening())
return;
uint8_t oldSREG = SREG;
@ -522,7 +501,7 @@ void SoftwareSerial::flush()
int SoftwareSerial::peek()
{
if (!is_listening())
if (!isListening())
return -1;
// Empty buffer?

View File

@ -40,7 +40,6 @@ http://arduiniana.org.
******************************************************************************/
#define _SS_MAX_RX_BUFF 64 // RX buffer size
#define _SS_VERSION 11 // software version of this library
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
@ -86,10 +85,8 @@ public:
void begin(long speed);
bool listen();
void end();
bool is_listening() { return this == active_object; }
bool isListening() { return this == active_object; }
bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; }
static int library_version() { return _SS_VERSION; }
static void enable_timer0(bool enable);
int peek();
virtual void write(uint8_t byte);

View File

@ -58,7 +58,7 @@ http://arduiniana.org.
( ((p) == 50) ? 3 : \
( ((p) == 51) ? 2 : \
( ((p) == 52) ? 1 : \
( ((p) ==53) ? 0 : \
( ((p) == 53) ? 0 : \
( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \
0 ) ) ) ) ) )

View File

@ -16,10 +16,8 @@ begin KEYWORD2
end KEYWORD2
read KEYWORD2
available KEYWORD2
is_listening KEYWORD2
isListening KEYWORD2
overflow KEYWORD2
library_version KEYWORD2
enable_timer0 KEYWORD2
flush KEYWORD2
listen KEYWORD2