mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Merge branch 'new-extension' of github.com:arduino/Arduino into new-extension
This commit is contained in:
commit
a1648c0775
@ -421,7 +421,7 @@ void SoftwareSerial::end()
|
|||||||
// Read data from buffer
|
// Read data from buffer
|
||||||
int SoftwareSerial::read()
|
int SoftwareSerial::read()
|
||||||
{
|
{
|
||||||
if (!is_listening())
|
if (!isListening())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Empty buffer?
|
// Empty buffer?
|
||||||
@ -436,7 +436,7 @@ int SoftwareSerial::read()
|
|||||||
|
|
||||||
int SoftwareSerial::available()
|
int SoftwareSerial::available()
|
||||||
{
|
{
|
||||||
if (!is_listening())
|
if (!isListening())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
|
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);
|
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()
|
void SoftwareSerial::flush()
|
||||||
{
|
{
|
||||||
if (!is_listening())
|
if (!isListening())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t oldSREG = SREG;
|
uint8_t oldSREG = SREG;
|
||||||
@ -522,7 +501,7 @@ void SoftwareSerial::flush()
|
|||||||
|
|
||||||
int SoftwareSerial::peek()
|
int SoftwareSerial::peek()
|
||||||
{
|
{
|
||||||
if (!is_listening())
|
if (!isListening())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Empty buffer?
|
// Empty buffer?
|
||||||
|
@ -40,7 +40,6 @@ http://arduiniana.org.
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#define _SS_MAX_RX_BUFF 64 // RX buffer size
|
#define _SS_MAX_RX_BUFF 64 // RX buffer size
|
||||||
#define _SS_VERSION 11 // software version of this library
|
|
||||||
#ifndef GCC_VERSION
|
#ifndef GCC_VERSION
|
||||||
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
#endif
|
#endif
|
||||||
@ -86,10 +85,8 @@ public:
|
|||||||
void begin(long speed);
|
void begin(long speed);
|
||||||
bool listen();
|
bool listen();
|
||||||
void end();
|
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; }
|
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();
|
int peek();
|
||||||
|
|
||||||
virtual void write(uint8_t byte);
|
virtual void write(uint8_t byte);
|
||||||
|
@ -58,7 +58,7 @@ http://arduiniana.org.
|
|||||||
( ((p) == 50) ? 3 : \
|
( ((p) == 50) ? 3 : \
|
||||||
( ((p) == 51) ? 2 : \
|
( ((p) == 51) ? 2 : \
|
||||||
( ((p) == 52) ? 1 : \
|
( ((p) == 52) ? 1 : \
|
||||||
( ((p) ==53) ? 0 : \
|
( ((p) == 53) ? 0 : \
|
||||||
( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \
|
( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \
|
||||||
0 ) ) ) ) ) )
|
0 ) ) ) ) ) )
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@ begin KEYWORD2
|
|||||||
end KEYWORD2
|
end KEYWORD2
|
||||||
read KEYWORD2
|
read KEYWORD2
|
||||||
available KEYWORD2
|
available KEYWORD2
|
||||||
is_listening KEYWORD2
|
isListening KEYWORD2
|
||||||
overflow KEYWORD2
|
overflow KEYWORD2
|
||||||
library_version KEYWORD2
|
|
||||||
enable_timer0 KEYWORD2
|
|
||||||
flush KEYWORD2
|
flush KEYWORD2
|
||||||
listen KEYWORD2
|
listen KEYWORD2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user