Skip to content

Commit

Permalink
fix DigitalOut callback
Browse files Browse the repository at this point in the history
  • Loading branch information
cotestatnt committed Nov 19, 2023
1 parent cf3f138 commit b030ca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=DigitalSignals Arduino
version=0.1.2
name=DigitalSignalsArduino
version=0.0.6
author=Tolentino Cotesta <[email protected]>
maintainer=Tolentino Cotesta <[email protected]>
sentence=Arduino Digital Signal library
sentence=Digital Signal library for Arduino platform
paragraph=Arduino Digital Signal let you to configure and control in clear and easy way digital signals with your Arduino board like push buttons, switches, relays (active low or active high), leds etc etc.
category=Signal Input/Output
url=https://github.com/cotestatnt/DigitalSignal
architectures=*
architectures=*
12 changes: 8 additions & 4 deletions src/DigitalOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ uint32_t DigitalOut::set() {
m_isActive = true;

// Execute callback function on rising edge
if (!m_lastState && (fn_rise != nullptr)) {
if (!m_lastState) {
m_lastState = true;
fn_rise(this);
if (fn_rise != nullptr) {
fn_rise(this);
}
}
return millis();
}
Expand All @@ -165,9 +167,11 @@ uint32_t DigitalOut::reset() {
m_isActive = false;

// Execute callback function on falling edge
if (m_lastState && (fn_fall != nullptr)) {
if (m_lastState ) {
m_lastState = false;
fn_fall(this);
if (fn_fall != nullptr) {
fn_fall(this);
}
}
m_runState = RunStates::OFF;
return millis();
Expand Down

0 comments on commit b030ca7

Please sign in to comment.