summaryrefslogtreecommitdiff
path: root/src/laser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/laser.h')
-rw-r--r--src/laser.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/laser.h b/src/laser.h
new file mode 100644
index 0000000..31fe7e3
--- /dev/null
+++ b/src/laser.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <string>
+
+class ILaser
+{
+public:
+ virtual ~ILaser() = default;
+
+public:
+ virtual bool init() = 0;
+ virtual bool setEnabled(bool enabled) = 0;
+ virtual bool setLaserLevel(std::size_t level) = 0;
+
+public:
+ bool enable() { return setEnabled(true); }
+ bool disable() { return setEnabled(false); }
+};
+
+class PwmLaser : public ILaser
+{
+public:
+ explicit PwmLaser(const std::string& pwmChip, const std::string& pwm);
+ ~PwmLaser() override = default;
+
+ // ILaser
+public:
+ bool init() override;
+
+private:
+ std::string m_pwmChip;
+ std::string m_pwm;
+};