semin ahn / Mbed OS zeta_stm_kinetic

Dependencies:   BufferedSerial

Revision:
2:0de4854743f7
Child:
3:a4677501ae87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04/SONAR_MANAGER.hpp	Thu Jun 10 01:23:00 2021 +0000
@@ -0,0 +1,27 @@
+#ifndef ZETA_BOT_MODULE_SONAR_MANAGER_HPP_
+#define ZETA_BOT_MODULE_SONAR_MANAGER_HPP_
+#include "HCSR04.h"
+#include "mbed.h"
+#include <vector>
+class SONAR_MANAGER
+{
+    public:
+        SONAR_MANAGER(PinName, HCSR04*, size_t);
+        void GetDistance(volatile float dest[]);
+        void PrintReady();
+        void Begin(float);
+    private:
+        DigitalOut trigger;
+        HCSR04* sonar;
+        size_t num_sonar;
+        float control_freq;
+        vector<float> distance;
+        Ticker scheduler;
+        Timeout triggerTimeout;
+        int ready[10];
+
+        void Loop();
+        void turnOffTrigger();
+};
+#endif
+