mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
fix uart receive
This commit is contained in:
parent
bacc0b1f8b
commit
669609f3d7
@ -118,24 +118,14 @@ int uart_get_debug();
|
|||||||
void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
|
void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
|
||||||
|
|
||||||
// -------------- UART 0 --------------
|
// -------------- UART 0 --------------
|
||||||
uint32_t status = U0IS;
|
|
||||||
if(Serial.isRxEnabled()) {
|
if(Serial.isRxEnabled()) {
|
||||||
if(status & (1 << UIFF)) {
|
while(U0IS & (1 << UIFF)) {
|
||||||
while(true) {
|
Serial._rx_complete_irq((char)(U0F & 0xff));
|
||||||
int rx_count = (U0S >> USTXC) & 0xff;
|
|
||||||
if(!rx_count)
|
|
||||||
break;
|
|
||||||
|
|
||||||
while(rx_count--) {
|
|
||||||
char c = U0F & 0xff;
|
|
||||||
Serial._rx_complete_irq(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
U0IC = (1 << UIFF);
|
U0IC = (1 << UIFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Serial.isTxEnabled()) {
|
if(Serial.isTxEnabled()) {
|
||||||
if(status & (1 << UIFE)) {
|
if(U0IS & (1 << UIFE)) {
|
||||||
U0IC = (1 << UIFE);
|
U0IC = (1 << UIFE);
|
||||||
Serial._tx_empty_irq();
|
Serial._tx_empty_irq();
|
||||||
}
|
}
|
||||||
@ -143,25 +133,14 @@ void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
|
|||||||
|
|
||||||
// -------------- UART 1 --------------
|
// -------------- UART 1 --------------
|
||||||
|
|
||||||
status = U1IS;
|
|
||||||
if(Serial1.isRxEnabled()) {
|
if(Serial1.isRxEnabled()) {
|
||||||
if(status & (1 << UIFF)) {
|
while(U1IS & (1 << UIFF)) {
|
||||||
while(true) {
|
Serial1._rx_complete_irq((char)(U1F & 0xff));
|
||||||
int rx_count = (U1S >> USTXC) & 0xff;
|
|
||||||
if(!rx_count)
|
|
||||||
break;
|
|
||||||
|
|
||||||
while(rx_count--) {
|
|
||||||
char c = U1F & 0xff;
|
|
||||||
Serial1._rx_complete_irq(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
U1IC = (1 << UIFF);
|
U1IC = (1 << UIFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Serial1.isTxEnabled()) {
|
if(Serial1.isTxEnabled()) {
|
||||||
status = U1IS;
|
if(U1IS & (1 << UIFE)) {
|
||||||
if(status & (1 << UIFE)) {
|
|
||||||
U1IC = (1 << UIFE);
|
U1IC = (1 << UIFE);
|
||||||
Serial1._tx_empty_irq();
|
Serial1._tx_empty_irq();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user