From b8dadd82d4afff0e5e6b6a8a00df948045d31503 Mon Sep 17 00:00:00 2001 From: Simon Gagne Date: Thu, 16 Mar 2023 10:06:04 -0400 Subject: Commit pour deplacement vers VSStudio --- include/serial/SerialPort.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/serial/SerialPort.hpp (limited to 'include/serial/SerialPort.hpp') diff --git a/include/serial/SerialPort.hpp b/include/serial/SerialPort.hpp new file mode 100644 index 0000000..a207d0c --- /dev/null +++ b/include/serial/SerialPort.hpp @@ -0,0 +1,31 @@ +/* +* Author: Manash Kumar Mandal +* Modified Library introduced in Arduino Playground which does not work +* This works perfectly +* LICENSE: MIT +*/ + +#pragma once + +#define ARDUINO_WAIT_TIME 2000 +#define MAX_DATA_LENGTH 255 + +#include +#include + +class SerialPort +{ +private: + HANDLE handler; + bool connected; + COMSTAT status; + DWORD errors; +public: + explicit SerialPort(const char *portName, int BAUD); + ~SerialPort(); + + int readSerialPort(const char *buffer, unsigned int buf_size); + bool writeSerialPort(const char *buffer, unsigned int buf_size); + bool isConnected(); + void closeSerial(); +}; \ No newline at end of file -- cgit v1.2.3