semf
digitalinint.cpp
Go to the documentation of this file.
1
12
13namespace semf
14{
15DigitalInInt::DigitalInInt(ExternalInterrupt& extInterrupt, Gpio& gpio, bool inverted)
16: DigitalIn(gpio, inverted),
17 m_extInterrupt(&extInterrupt)
18{
19 m_extInterrupt->changed.connect(m_onChanged);
20}
21
22void DigitalInInt::onChanged()
23{
24 if (state() == State::High)
25 {
26 SEMF_INFO("changed to high");
28 }
29 else
30 {
31 SEMF_INFO("changed to low");
33 }
34}
35} /* namespace semf */
Base class for having access to the level state of a digital input.
Definition: digitalin.h:23
State state() const override
Returns the level status of the hardware pin.
Definition: digitalin.cpp:32
DigitalInInt(ExternalInterrupt &extInterrupt, Gpio &gpio, bool inverted=false)
Constructor.
Interface for using a external interrupt.
Interface class for using a GPIO pin of the microcontroller.
Definition: gpio.h:23
void connect(SlotBase< Arguments... > &slot)
Connect a method to the signal.
Definition: signal.h:94
#define SEMF_INFO(...)
Definition: debug.h:41