Final touches, surely…
This commit is contained in:
parent
fd3625aa74
commit
7b66e05f67
4 changed files with 17 additions and 10 deletions
|
|
@ -163,6 +163,9 @@
|
||||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||||
// Set pin as input with pullup (wrapper)
|
// Set pin as input with pullup (wrapper)
|
||||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||||
|
// Set pin as input with pulldown (substitution)
|
||||||
|
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||||
|
|
||||||
// Set pin as output (wrapper) - reads the pin and sets the output to that value
|
// Set pin as output (wrapper) - reads the pin and sets the output to that value
|
||||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
||||||
// Set pin as PWM
|
// Set pin as PWM
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@
|
||||||
// Set pin as input with pullup wrapper
|
// Set pin as input with pullup wrapper
|
||||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||||
|
|
||||||
|
// Set pin as input with pulldown (substitution)
|
||||||
|
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||||
|
|
||||||
// Set pin as output wrapper
|
// Set pin as output wrapper
|
||||||
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,31 +149,31 @@ class FilamentSensorBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline void setup() {
|
static inline void setup() {
|
||||||
#define _INIT_RUNOUT_PIN(N,P) do{ if (DISABLED(FIL_RUNOUT##N##_PULL)) SET_INPUT(P) else if (FIL_RUNOUT##N##_STATE) SET_INPUT_PULLDOWN(P); else SET_INPUT_PULLUP(P); }while(0)
|
#define _INIT_RUNOUT_PIN(P,S,U) do{ if (DISABLED(U)) SET_INPUT(P); else if (S) SET_INPUT_PULLDOWN(P); else SET_INPUT_PULLUP(P); }while(0)
|
||||||
#define INIT_RUNOUT_PIN(N,P) _INIT_RUNOUT_PIN(N,P)
|
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
|
||||||
#if NUM_RUNOUT_SENSORS >= 1
|
#if NUM_RUNOUT_SENSORS >= 1
|
||||||
INIT_RUNOUT_PIN(1, P)
|
INIT_RUNOUT_PIN(1);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 2
|
#if NUM_RUNOUT_SENSORS >= 2
|
||||||
INIT_RUNOUT_PIN(2, P)
|
INIT_RUNOUT_PIN(2);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 3
|
#if NUM_RUNOUT_SENSORS >= 3
|
||||||
INIT_RUNOUT_PIN(3, P)
|
INIT_RUNOUT_PIN(3);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 4
|
#if NUM_RUNOUT_SENSORS >= 4
|
||||||
INIT_RUNOUT_PIN(4, P)
|
INIT_RUNOUT_PIN(4);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 5
|
#if NUM_RUNOUT_SENSORS >= 5
|
||||||
INIT_RUNOUT_PIN(5, P)
|
INIT_RUNOUT_PIN(5);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 6
|
#if NUM_RUNOUT_SENSORS >= 6
|
||||||
INIT_RUNOUT_PIN(6, P)
|
INIT_RUNOUT_PIN(6);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 7
|
#if NUM_RUNOUT_SENSORS >= 7
|
||||||
INIT_RUNOUT_PIN(7, P)
|
INIT_RUNOUT_PIN(7);
|
||||||
#endif
|
#endif
|
||||||
#if NUM_RUNOUT_SENSORS >= 8
|
#if NUM_RUNOUT_SENSORS >= 8
|
||||||
INIT_RUNOUT_PIN(8, P)
|
INIT_RUNOUT_PIN(8);
|
||||||
#endif
|
#endif
|
||||||
#undef _INIT_RUNOUT_PIN
|
#undef _INIT_RUNOUT_PIN
|
||||||
#undef INIT_RUNOUT_PIN
|
#undef INIT_RUNOUT_PIN
|
||||||
|
|
|
||||||
|
|
@ -677,6 +677,7 @@
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
#if NUM_RUNOUT_SENSORS >= 1
|
#if NUM_RUNOUT_SENSORS >= 1
|
||||||
|
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
|
||||||
#ifndef FIL_RUNOUT1_STATE
|
#ifndef FIL_RUNOUT1_STATE
|
||||||
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
|
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue