first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
/*---------------------
*
* ArduinoSTL Core Library
*
* This header has some glue to make STL and Streams work from a sketch.
*
*/
#ifndef ARDUINOSTL_M_H
#define ARDUINOSTL_M_H
#include <Arduino.h>
#include "serstream"
// Create cout and cin.. there doesn't seem to be a way
// to control what serial device at runtime. Grr.
namespace std
{
extern ohserialstream cout;
extern ihserialstream cin;
}
#if defined(ARDUINO_ARCH_AVR)
class ArduinoSTL_STDIO {
public:
// Initialize STDIO using a pointer to whatever Serial is.
// Serial.begin() must be called at some point.
ArduinoSTL_STDIO(Stream *u) : file(NULL) {
connect(u);
}
ArduinoSTL_STDIO(Stream &u) : file(NULL) {
connect(u);
}
Stream *getUart() {
return uart;
}
void connect(Stream *u);
inline void connect(Stream &u) {
connect(static_cast<Stream*>(&u));
}
private:
Stream *uart;
FILE *file;
};
extern ArduinoSTL_STDIO ArduinoSTL_Serial;
#endif // ARDUINO_ARCH_AVR
#endif // ARDUINOSTL_M_H