summaryrefslogtreecommitdiff
path: root/src/laser.h
diff options
context:
space:
mode:
authorNikita Kostovsky <nikita@kostovsky.me>2025-01-14 18:04:32 +0100
committerNikita Kostovsky <nikita@kostovsky.me>2025-01-14 18:04:32 +0100
commit38acf876313c9bf28e41acd8bc29d6115c1e9285 (patch)
treedc59c6c26006f740e1990150f920f4032734fc13 /src/laser.h
parent201d98f63131242bb8871ed0c4a3ae9ebd4ef030 (diff)
refactoring
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;
+};