Skip to content

File gatein.h

File List > external-docs > libDaisy > src > hid > gatein.h

Go to the documentation of this file

Source Code

#pragma once
#ifndef DSY_GATEIN_H
#define DSY_GATEIN_H
#include "per/gpio.h"

namespace daisy
{
class GateIn
{
  public:
    GateIn() {}

    ~GateIn() {}

    void Init(Pin pin, bool invert = true);

    bool Trig();

    inline bool State() { return invert_ ? !pin_.Read() : pin_.Read(); }

  private:
    GPIO pin_;
    bool prev_state_, state_;
    bool invert_;
};
} // namespace daisy
#endif