← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/LIDAR/sdk/src/hal/waiter.h
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-04-10 11:35:25 +0200
committerEdvin <[email protected]>2025-04-10 11:35:25 +0200
commitdcd2dd87ce8034a46e4150a89dc69f6ba1a22d8d (patch)
treebce00ff5029550f3bde1e83542d688dc3188e256 /LIDAR/sdk/src/hal/waiter.h
parent1a837cbe411b4522582d323454a03ef02e9dd292 (diff)
Implemented code for Slamtec rplidar C1
Diffstat (limited to 'LIDAR/sdk/src/hal/waiter.h')
-rw-r--r--LIDAR/sdk/src/hal/waiter.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/LIDAR/sdk/src/hal/waiter.h b/LIDAR/sdk/src/hal/waiter.h
new file mode 100644
index 0000000..7f83b9b
--- /dev/null
+++ b/LIDAR/sdk/src/hal/waiter.h
@@ -0,0 +1,44 @@
+/*
+ * For synchronize asynchrous operations
+ *
+ * Copyright 2010 Robopeak Team
+ */
+#pragma once
+
+#ifdef _AVR_
+#error there is no implementation for waiter.h on AVR platforms
+#else
+
+#include "hal/event.h"
+
+namespace rp{ namespace hal{
+
+ template<typename ResultT>
+ class Waiter : public Event
+ {
+ public:
+ Waiter()
+ : Event()
+ {
+ }
+
+ ~Waiter()
+ {}
+
+ ResultT waitForResult()
+ {
+ wait();
+ return result;
+ }
+
+ void setResult(ResultT result)
+ {
+ this->result = result;
+ set();
+ }
+
+ volatile ResultT result;
+ };
+}}
+
+#endif