объявляются два экземпляра serial по номеру железного uart, по дефолту используется тот, что задан для каждой платы
This commit is contained in:
1 parent
7e32e92845
commit
2a561ad0ed
6 files changed
+12
-3
No files matched your search
@@ -8,10 +8,13 @@
|
||||
#include "wiring_LL.h"
|
||||
|
||||
// HardwareSerial class objects for use in Arduino IDE
|
||||
HardwareSerial Serial(0);
|
||||
HardwareSerial Serial0(0);
|
||||
#if SERIAL_PORT_QTY > 1
|
||||
HardwareSerial Serial1(1);
|
||||
#endif
|
||||
// default interface
|
||||
HardwareSerial& Serial = DEFAULT_SERIAL;
|
||||
|
||||
|
||||
void serialEvent() __attribute__((weak));
|
||||
bool Serial0_available() __attribute__((weak));
|
||||
@@ -144,7 +147,7 @@ extern "C" void __attribute__((optimize("O3"))) serial_interrupt_handler(uint8_t
|
||||
{
|
||||
if (uartNumInt == 0)
|
||||
{
|
||||
Serial.rx_complete_irq();
|
||||
Serial0.rx_complete_irq();
|
||||
}
|
||||
else if ((uartNumInt == 1) && (SERIAL_PORT_QTY > 1))
|
||||
{
|
||||
|
||||
@@ -103,10 +103,12 @@ class HardwareSerial : public Stream
|
||||
inline void rx_complete_irq(void) __attribute__((always_inline, optimize("O3")));
|
||||
};
|
||||
|
||||
extern HardwareSerial Serial;
|
||||
extern HardwareSerial Serial0;
|
||||
#if SERIAL_PORT_QTY > 1
|
||||
extern HardwareSerial Serial1;
|
||||
#endif
|
||||
// default interface
|
||||
extern HardwareSerial& Serial;
|
||||
|
||||
extern void serialEventRun(void) __attribute__((weak));
|
||||
|
||||
|
||||
Reference in new issue
Block a user