aboutsummaryrefslogtreecommitdiffstats
path: root/source/usbserial.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/usbserial.hpp')
-rw-r--r--source/usbserial.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/usbserial.hpp b/source/usbserial.hpp
new file mode 100644
index 0000000..a65190b
--- /dev/null
+++ b/source/usbserial.hpp
@@ -0,0 +1,28 @@
+#ifndef STMDSP_USBSERIAL_HPP_
+#define STMDSP_USBSERIAL_HPP_
+
+#include "usbcfg.h"
+
+#include <cstddef>
+
+class USBSeriald
+{
+public:
+ constexpr explicit USBSeriald(SerialUSBDriver& driver) :
+ m_driver(&driver) {}
+
+ void start();
+
+ bool active() const;
+
+ std::size_t read(void *buffer, std::size_t count = 1);
+ std::size_t write(const void *buffer, std::size_t count = 1);
+
+private:
+ SerialUSBDriver *m_driver;
+
+ void initPins();
+};
+
+#endif // STMDSP_USBSERIAL_HPP_
+