Skip to content

Commit 2335a3d

Browse files
committed
Cleanup
1 parent 3de1dfb commit 2335a3d

File tree

8 files changed

+20
-15
lines changed

8 files changed

+20
-15
lines changed

ArduinoCore-Linux/cores/arduino/Arduino.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "PluggableUSB.h"
2525
#include "deprecated-avr-comp/avr/dtostrf.h"
2626
#include "ArduinoLogger.h"
27-
#include "ArdStdio.h"
27+
#include "StdioDevice.h"
2828
#include "Serial.h"
2929

3030
namespace arduino {
@@ -34,11 +34,6 @@ WifiMock WiFi; // So that we can use the WiFi
3434
#endif
3535

3636

37-
#if PROVIDE_SERIALLIB
38-
SerialImpl Serial1("/dev/ttyACM0"); // output to serial port
39-
#endif
40-
41-
4237
//static PluggableUSB_ obj;
4338
PluggableUSB_::PluggableUSB_(){}
4439

ArduinoCore-Linux/cores/arduino/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#endif
3535

3636
#include "Serial.h"
37-
#include "ArdStdio.h"
37+
#include "StdioDevice.h"
3838
#include "ArduinoLogger.h"
3939
#include "ArduinoAPI.h"
4040
#include "RemoteSerial.h"

ArduinoCore-Linux/cores/arduino/ArduinoLogger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "ArdStdio.h"
3+
#include "StdioDevice.h"
44
#include "Stream.h"
55

66
namespace arduino {

ArduinoCore-Linux/cores/arduino/ArdFileStream.h renamed to ArduinoCore-Linux/cores/arduino/FileStream.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace arduino {
99
/**
1010
* @brief We use the SerialDef class to be able to provide Serail, Serial1 and Serial2 outside of the
1111
* Arduino environment;
12-
*
1312
*/
1413
class FileStream : public Stream {
1514
public:
@@ -91,8 +90,18 @@ class FileStream : public Stream {
9190
protected:
9291
std::fstream out;
9392
std::fstream in;
94-
9593
};
96-
94+
95+
/**
96+
* @brief Global Serial1 instance for secondary serial communication.
97+
*
98+
* This object provides access to the /dev/ttyACM0 device, typically used for USB serial or secondary UART on Linux systems.
99+
* Use this instance in your sketches to perform serial communication, similar to the standard Arduino Serial1 object.
100+
* Example:
101+
* Serial1.begin(9600);
102+
* Serial1.println("Hello from Serial1");
103+
*/
104+
static FileStream Serial1("/dev/ttyACM0");
105+
97106
}
98107

ArduinoCore-Linux/cores/arduino/Serial.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#if PROVIDE_SERIALLIB
3+
#if USE_SERIALLIB
44

55
#include "serialib.h"
66
#include "HardwareSerial.h"
@@ -87,7 +87,6 @@ class SerialImpl : public HardwareSerial {
8787

8888
};
8989

90-
extern SerialImpl Serial1;
9190

9291
} // namespace
9392

File renamed without changes.

ArduinoCore-Linux/cores/arduino/serialib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1414
This is a licence-free software, it can be used by anyone who try to build a better world.
1515
*/
1616

17-
#if PROVIDE_SERIALLIB
17+
#if USE_SERIALLIB
1818

1919
// Used for TimeOut operations
2020
#include <sys/time.h>

ArduinoCore-Linux/cores/rasperry_pi/HardwareSetupRPI.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ static HardwareSetupRPI RPI;
6767
static auto& Wire = *Hardware.i2c;
6868
static auto& SPI = *Hardware.spi;
6969

70+
7071
/**
7172
* @brief Second hardware serial port for Raspberry Pi.
7273
*
@@ -76,7 +77,8 @@ static auto& SPI = *Hardware.spi;
7677
* Serial2.begin(9600);
7778
* Serial2.println("Hello from Serial2");
7879
*/
79-
static SerialImpl Serial2("/dev/serial0");
80+
static FileStream Serial2("/dev/serial0");
81+
8082

8183
} // namespace arduino
8284

0 commit comments

Comments
 (0)