Use SET_INPUT_PULLUP where appropriate

This commit is contained in:
Scott Lahteine 2017-03-07 23:43:33 -06:00
parent deb9d0dabd
commit 2defb1d748
4 changed files with 37 additions and 34 deletions

View File

@ -858,17 +858,17 @@ bool enqueue_and_echo_command(const char* cmd, bool say_ok/*=false*/) {
void setup_killpin() { void setup_killpin() {
#if HAS_KILL #if HAS_KILL
SET_INPUT(KILL_PIN); SET_INPUT_PULLUP(KILL_PIN);
WRITE(KILL_PIN, HIGH);
#endif #endif
} }
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
void setup_filrunoutpin() { void setup_filrunoutpin() {
SET_INPUT(FIL_RUNOUT_PIN);
#if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT) #if ENABLED(ENDSTOPPULLUP_FIL_RUNOUT)
WRITE(FIL_RUNOUT_PIN, HIGH); SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
#else
SET_INPUT(FIL_RUNOUT_PIN);
#endif #endif
} }
@ -877,8 +877,7 @@ void setup_killpin() {
// Set home pin // Set home pin
void setup_homepin(void) { void setup_homepin(void) {
#if HAS_HOME #if HAS_HOME
SET_INPUT(HOME_PIN); SET_INPUT_PULLUP(HOME_PIN);
WRITE(HOME_PIN, HIGH);
#endif #endif
} }

View File

@ -67,65 +67,74 @@ volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_P
void Endstops::init() { void Endstops::init() {
#if HAS_X_MIN #if HAS_X_MIN
SET_INPUT(X_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_XMIN) #if ENABLED(ENDSTOPPULLUP_XMIN)
WRITE(X_MIN_PIN,HIGH); SET_INPUT_PULLUP(X_MIN_PIN);
#else
SET_INPUT(X_MIN_PIN);
#endif #endif
#endif #endif
#if HAS_Y_MIN #if HAS_Y_MIN
SET_INPUT(Y_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_YMIN) #if ENABLED(ENDSTOPPULLUP_YMIN)
WRITE(Y_MIN_PIN,HIGH); SET_INPUT_PULLUP(Y_MIN_PIN);
#else
SET_INPUT(Y_MIN_PIN);
#endif #endif
#endif #endif
#if HAS_Z_MIN #if HAS_Z_MIN
SET_INPUT(Z_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMIN) #if ENABLED(ENDSTOPPULLUP_ZMIN)
WRITE(Z_MIN_PIN,HIGH); SET_INPUT_PULLUP(Z_MIN_PIN);
#else
SET_INPUT(Z_MIN_PIN);
#endif #endif
#endif #endif
#if HAS_Z2_MIN #if HAS_Z2_MIN
SET_INPUT(Z2_MIN_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMIN) #if ENABLED(ENDSTOPPULLUP_ZMIN)
WRITE(Z2_MIN_PIN,HIGH); SET_INPUT_PULLUP(Z2_MIN_PIN);
#else
SET_INPUT(Z2_MIN_PIN);
#endif #endif
#endif #endif
#if HAS_X_MAX #if HAS_X_MAX
SET_INPUT(X_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_XMAX) #if ENABLED(ENDSTOPPULLUP_XMAX)
WRITE(X_MAX_PIN,HIGH); SET_INPUT_PULLUP(X_MAX_PIN);
#else
SET_INPUT(X_MAX_PIN);
#endif #endif
#endif #endif
#if HAS_Y_MAX #if HAS_Y_MAX
SET_INPUT(Y_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_YMAX) #if ENABLED(ENDSTOPPULLUP_YMAX)
WRITE(Y_MAX_PIN,HIGH); SET_INPUT_PULLUP(Y_MAX_PIN);
#else
SET_INPUT(Y_MAX_PIN);
#endif #endif
#endif #endif
#if HAS_Z_MAX #if HAS_Z_MAX
SET_INPUT(Z_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMAX) #if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z_MAX_PIN,HIGH); SET_INPUT_PULLUP(Z_MAX_PIN);
#else
SET_INPUT(Z_MAX_PIN);
#endif #endif
#endif #endif
#if HAS_Z2_MAX #if HAS_Z2_MAX
SET_INPUT(Z2_MAX_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMAX) #if ENABLED(ENDSTOPPULLUP_ZMAX)
WRITE(Z2_MAX_PIN,HIGH); SET_INPUT_PULLUP(Z2_MAX_PIN);
#else
SET_INPUT(Z2_MAX_PIN);
#endif #endif
#endif #endif
#if ENABLED(Z_MIN_PROBE_ENDSTOP) #if ENABLED(Z_MIN_PROBE_ENDSTOP)
SET_INPUT(Z_MIN_PROBE_PIN);
#if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE) #if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
WRITE(Z_MIN_PROBE_PIN,HIGH); SET_INPUT_PULLUP(Z_MIN_PROBE_PIN);
#else
SET_INPUT(Z_MIN_PROBE_PIN);
#endif #endif
#endif #endif

View File

@ -998,8 +998,7 @@ void Temperature::init() {
OUT_WRITE(SCK_PIN, LOW); OUT_WRITE(SCK_PIN, LOW);
OUT_WRITE(MOSI_PIN, HIGH); OUT_WRITE(MOSI_PIN, HIGH);
SET_INPUT(MISO_PIN); SET_INPUT_PULLUP(MISO_PIN);
WRITE(MISO_PIN, HIGH);
OUT_WRITE(SS_PIN, HIGH); OUT_WRITE(SS_PIN, HIGH);
OUT_WRITE(MAX6675_SS, HIGH); OUT_WRITE(MAX6675_SS, HIGH);

View File

@ -2973,18 +2973,15 @@ void lcd_init() {
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
#if BUTTON_EXISTS(EN1) #if BUTTON_EXISTS(EN1)
SET_INPUT(BTN_EN1); SET_INPUT_PULLUP(BTN_EN1);
WRITE(BTN_EN1, HIGH);
#endif #endif
#if BUTTON_EXISTS(EN2) #if BUTTON_EXISTS(EN2)
SET_INPUT(BTN_EN2); SET_INPUT_PULLUP(BTN_EN2);
WRITE(BTN_EN2, HIGH);
#endif #endif
#if BUTTON_EXISTS(ENC) #if BUTTON_EXISTS(ENC)
SET_INPUT(BTN_ENC); SET_INPUT_PULLUP(BTN_ENC);
WRITE(BTN_ENC, HIGH);
#endif #endif
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
@ -3021,8 +3018,7 @@ void lcd_init() {
#endif // !NEWPANEL #endif // !NEWPANEL
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT(SD_DETECT_PIN); SET_INPUT_PULLUP(SD_DETECT_PIN);
WRITE(SD_DETECT_PIN, HIGH);
lcd_sd_status = 2; // UNKNOWN lcd_sd_status = 2; // UNKNOWN
#endif #endif