Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small changes to compile on raspberry pi #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/clickButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,22 @@ ClickButton::ClickButton(uint8_t buttonPin, boolean activeType, boolean internal
multiclickTime = 250; // Time limit for multi clicks
longClickTime = 1000; // time until "long" click register

// Particle devices
#if defined PLATFORM_ID
// Turn on internal pullup resistor if applicable
if (_activeHigh == LOW && internalPullup == CLICKBTN_PULLUP)
pinMode(_pin, INPUT_PULLUP);
else
pinMode(_pin, INPUT_PULLDOWN);
// Raspberry Pi
#else
pinMode(_pin, INPUT);
// Turn on internal pullup resistor if applicable
if (_activeHigh == LOW && internalPullup == CLICKBTN_PULLUP)
pullUpDnControl(_pin, PUD_UP);
else
pullUpDnControl(_pin, PUD_DOWN);
#endif
}


Expand Down Expand Up @@ -144,4 +155,3 @@ void ClickButton::Update()

_lastState = _btnState;
}

14 changes: 13 additions & 1 deletion src/clickButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ NOTE!
*/

// -------- clickButton.h --------
#include "Particle.h"

// Particle devices
#if defined PLATFORM_ID
#include "Particle.h"
// Raspberry Pi
#else
// for uint8_t
#include "stdint.h"
// for GPIO functionality
#include <wiringPi.h>

typedef uint8_t boolean;
#endif

#define CLICKBTN_PULLUP HIGH

Expand Down