Skip to content

File RBCXStupidServo.h

File List > demo-projets > esp > RBCXStupidServo.h

Go to the documentation of this file.

#pragma once

#include <mutex>
#include <stdint.h>

#include "rbcx.pb.h"

namespace rb {

class Manager;

class StupidServo {
    friend class Manager;

public:
    uint8_t id() const { return m_id; }

    void setPosition(float positionFraction);

    float position() const { return m_lastPosition; }

    void disable();

private:
    StupidServo();
    ~StupidServo() {}
    StupidServo(const StupidServo&) = delete;

    void setId(uint8_t id) { m_id = id; }

    void sendServoMsg(float position);

    std::mutex m_mutex;
    float m_lastPosition;
    uint8_t m_id;
};

};