Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
pinio.h: support USE_INTERNAL_PULLDOWNS.
Browse files Browse the repository at this point in the history
That's the counterpart to USE_INTERNAL_PULLUPS and needed on the
Gen7-ARM board.
  • Loading branch information
Traumflug committed Sep 30, 2016
1 parent aed6f5a commit b47e625
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion pinio.h
Expand Up @@ -7,6 +7,13 @@

#include "config_wrapper.h"

// Configuration tests.
#ifdef USE_INTERNAL_PULLDOWNS
#ifdef USE_INTERNAL_PULLUPS
#error Cant use USE_INTERNAL_PULLUPS and ..._PULLDOWNS at the same time.
#endif
#endif

#ifndef MASK
/// MASKING- returns \f$2^PIN\f$
#define MASK(PIN) (1 << PIN)
Expand Down Expand Up @@ -380,11 +387,32 @@ inline void endstops_on(void) {
PULLUP_ON(Z_MAX_PIN);
#endif
#endif

#ifdef USE_INTERNAL_PULLDOWNS
#ifdef X_MIN_PIN
PULLDOWN_ON(X_MIN_PIN);
#endif
#ifdef X_MAX_PIN
PULLDOWN_ON(X_MAX_PIN);
#endif
#ifdef Y_MIN_PIN
PULLDOWN_ON(Y_MIN_PIN);
#endif
#ifdef Y_MAX_PIN
PULLDOWN_ON(Y_MAX_PIN);
#endif
#ifdef Z_MIN_PIN
PULLDOWN_ON(Z_MIN_PIN);
#endif
#ifdef Z_MAX_PIN
PULLDOWN_ON(Z_MAX_PIN);
#endif
#endif
}

static void endstops_off(void) __attribute__ ((always_inline));
inline void endstops_off(void) {
#ifdef USE_INTERNAL_PULLUPS
#if (defined USE_INTERNAL_PULLUPS) || (defined USE_INTERNAL_PULLDOWNS)
#ifdef X_MIN_PIN
PULL_OFF(X_MIN_PIN);
#endif
Expand Down

0 comments on commit b47e625

Please sign in to comment.