mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-21 21:22:31 +03:00
Fix initialisation, fix HardwareSerial, add esptool.py flashing
This commit is contained in:
@ -208,15 +208,25 @@ void serial_rx_handler(char c)
|
||||
{
|
||||
Serial._rx_complete_irq(c);
|
||||
}
|
||||
extern "C" size_t ets_printf(const char*, ...);
|
||||
|
||||
HardwareSerial::HardwareSerial() :
|
||||
_rx_buffer_head(0), _rx_buffer_tail(0),
|
||||
_tx_buffer_head(0), _tx_buffer_tail(0),
|
||||
_uart(0)
|
||||
{
|
||||
}
|
||||
|
||||
void HardwareSerial::begin(unsigned long baud, byte config)
|
||||
{
|
||||
_uart = uart0_init(baud, &serial_rx_handler);
|
||||
_written = false;
|
||||
}
|
||||
|
||||
void HardwareSerial::end()
|
||||
{
|
||||
uart0_uninit(_uart);
|
||||
_uart = 0;
|
||||
}
|
||||
|
||||
int HardwareSerial::available(void)
|
||||
@ -263,7 +273,7 @@ void HardwareSerial::flush()
|
||||
|
||||
size_t HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
WRITE_PERI_REG(UART_FIFO(0), c);
|
||||
uart0_transmit_char(_uart, c);
|
||||
// // If the buffer and the data register is empty, just write the byte
|
||||
// // to the data register and be done. This shortcut helps
|
||||
// // significantly improve the effective datarate at high (>
|
||||
@ -294,9 +304,9 @@ size_t HardwareSerial::write(uint8_t c)
|
||||
// _tx_buffer_head = i;
|
||||
|
||||
// sbi(*_ucsrb, UDRIE0);
|
||||
// _written = true;
|
||||
_written = true;
|
||||
|
||||
// return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void HardwareSerial::_rx_complete_irq(char c)
|
||||
|
Reference in New Issue
Block a user