libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
gatein.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_GATEIN_H
3#define DSY_GATEIN_H
4#include "per/gpio.h"
5
6namespace daisy
7{
14class GateIn
15{
16 public:
18 GateIn() {}
19
22
32 void Init(Pin pin, bool invert = true);
33
47 void Init(dsy_gpio_pin *pin_cfg, bool invert = true);
48
52 bool Trig();
53
57 inline bool State() { return invert_ ? !pin_.Read() : pin_.Read(); }
58
59 private:
60 GPIO pin_;
61 bool prev_state_, state_;
62 bool invert_;
63};
64} // namespace daisy
65#endif
General Purpose I/O control.
Definition gpio.h:22
bool Read()
Reads the state of the GPIO.
Generic Class for handling gate inputs through GPIO.
Definition gatein.h:15
bool State()
Definition gatein.h:57
GateIn()
Definition gatein.h:18
void Init(Pin pin, bool invert=true)
Initializes the gate input with specified hardware pin.
~GateIn()
Definition gatein.h:21
void Init(dsy_gpio_pin *pin_cfg, bool invert=true)
Initializes the gate input with specified hardware pin.
Definition leddriver.h:33
Hardware defines and helpers for daisy field platform.
Definition index.h:2
representation of hardware port/pin combination
Definition daisy_core.h:261
Definition daisy_core.h:205