Merged with dev0.2_uart1

This commit is contained in:
klassents committed 2024-09-05 05:48:33 +03:00
1 parent 87e881aea1
commit 0ea1ec5b97
7 files changed
+131 -35

No files matched your search

+11 -1
View File
@@ -27,6 +27,7 @@
#include <inttypes.h>
#include "stdint.h"
#include "Stream.h"
#include "pins_arduino.h"
// Define constants and variables for buffering incoming serial data. We're
// using a ring buffer (I think), in which head is the index of the location
@@ -73,9 +74,14 @@ class HardwareSerial : public Stream
private:
bool isInited = false;
uint8_t uartNum;
public:
inline HardwareSerial(){};
inline HardwareSerial(uint8_t num)
{
// Set the UART to be used
uartNum = (num < SERIAL_PORT_QTY) ? num : 0; // UART0 by default
}
void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void begin(unsigned long, uint8_t);
@@ -98,6 +104,10 @@ class HardwareSerial : public Stream
};
extern HardwareSerial Serial;
#if SERIAL_PORT_QTY > 1
extern HardwareSerial Serial1;
#endif
extern void serialEventRun(void) __attribute__((weak));
#endif