semin ahn / Mbed OS zeta_stm_kinetic

Dependencies:   BufferedSerial

HCSR04/SONAR_MANAGER.hpp

Committer:
_seminahn
Date:
2021-06-10
Revision:
2:0de4854743f7
Child:
3:a4677501ae87

File content as of revision 2:0de4854743f7:

#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