1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-25 06:22:11 +03:00

Fix initialisation, fix HardwareSerial, add esptool.py flashing

This commit is contained in:
Ivan Grokhotkov
2014-11-25 09:58:14 +03:00
parent 66cac95b4b
commit 39e087a19e
5 changed files with 18 additions and 8 deletions

View File

@ -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)

View File

@ -80,7 +80,7 @@ class HardwareSerial : public Stream
unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE];
public:
HardwareSerial() : _uart(0) { }
HardwareSerial();
void begin(unsigned long baud) { begin(baud, 0); }
void begin(unsigned long, uint8_t);

View File

@ -114,7 +114,7 @@ void user_init(void)
g_loop_queue,
LOOP_QUEUE_SIZE);
system_init_done_cb(&esp_schedule);
system_init_done_cb(&init_done);
}
}