36 #if defined(HAVE_HWSERIAL0) || defined(HAVE_HWSERIAL1) || defined(HAVE_HWSERIAL2) || defined(HAVE_HWSERIAL3) 43 #if defined(HAVE_HWSERIAL0) 44 void serialEvent() __attribute__((weak));
45 bool Serial0_available() __attribute__((weak));
48 #if defined(HAVE_HWSERIAL1) 49 void serialEvent1() __attribute__((weak));
50 bool Serial1_available() __attribute__((weak));
53 #if defined(HAVE_HWSERIAL2) 54 void serialEvent2() __attribute__((weak));
55 bool Serial2_available() __attribute__((weak));
58 #if defined(HAVE_HWSERIAL3) 59 void serialEvent3() __attribute__((weak));
60 bool Serial3_available() __attribute__((weak));
65 #if defined(HAVE_HWSERIAL0) 66 if (Serial0_available && serialEvent && Serial0_available()) serialEvent();
68 #if defined(HAVE_HWSERIAL1) 69 if (Serial1_available && serialEvent1 && Serial1_available()) serialEvent1();
71 #if defined(HAVE_HWSERIAL2) 72 if (Serial2_available && serialEvent2 && Serial2_available()) serialEvent2();
74 #if defined(HAVE_HWSERIAL3) 75 if (Serial3_available && serialEvent3 && Serial3_available()) serialEvent3();
106 uint16_t baud_setting = (F_CPU / 4 / baud - 1) / 2;
114 if (((F_CPU == 16000000UL) && (baud == 57600)) || (baud_setting >4095))
117 baud_setting = (F_CPU / 8 / baud - 1) / 2;
121 *
_ubrrh = baud_setting >> 8;
127 #if defined(__AVR_ATmega8__) 180 #if (SERIAL_TX_BUFFER_SIZE>256) 181 uint8_t oldSREG = SREG;
186 #if (SERIAL_TX_BUFFER_SIZE>256) 190 return tail - head - 1;
201 while (bit_is_set(*
_ucsrb, UDRIE0) || bit_is_clear(*
_ucsra, TXC0)) {
202 if (bit_is_clear(SREG, SREG_I) && bit_is_set(*
_ucsrb, UDRIE0))
206 if (bit_is_set(*
_ucsra, UDRE0))
230 if (bit_is_clear(SREG, SREG_I)) {
235 if(bit_is_set(*
_ucsra, UDRE0))
volatile uint8_t *const _ucsrb
virtual size_t write(uint8_t)
volatile rx_buffer_index_t _rx_buffer_head
volatile uint8_t *const _ubrrh
volatile tx_buffer_index_t _tx_buffer_head
volatile uint8_t *const _ucsrc
uint8_t rx_buffer_index_t
virtual int availableForWrite(void)
#define SERIAL_TX_BUFFER_SIZE
virtual int available(void)
volatile rx_buffer_index_t _rx_buffer_tail
#define SERIAL_RX_BUFFER_SIZE
void serialEventRun(void) __attribute__((weak))
volatile tx_buffer_index_t _tx_buffer_tail
uint8_t tx_buffer_index_t
unsigned char _rx_buffer[SERIAL_RX_BUFFER_SIZE]
volatile uint8_t *const _udr
volatile uint8_t *const _ubrrl
unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE]
void _tx_udr_empty_irq(void)
volatile uint8_t *const _ucsra
void begin(unsigned long baud)