Use DPM where possible

This commit is contained in:
Scott Lahteine 2016-10-24 05:26:30 -05:00
parent ad38d91692
commit 9cbedab91b
3 changed files with 15 additions and 18 deletions

View File

@ -93,6 +93,8 @@
/// set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO)
/// set pin as input with pullup wrapper
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0)
/// set pin as output wrapper
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)

View File

@ -1049,7 +1049,7 @@ void Temperature::init() {
setPwmFrequency(E0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#else
pinMode(E0_AUTO_FAN_PIN, OUTPUT);
SET_OUTPUT(E0_AUTO_FAN_PIN);
#endif
#endif
#if HAS_AUTO_FAN_1 && !AUTO_1_IS_0
@ -1059,7 +1059,7 @@ void Temperature::init() {
setPwmFrequency(E1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#else
pinMode(E1_AUTO_FAN_PIN, OUTPUT);
SET_OUTPUT(E1_AUTO_FAN_PIN);
#endif
#endif
#if HAS_AUTO_FAN_2 && !AUTO_2_IS_0 && !AUTO_2_IS_1
@ -1069,7 +1069,7 @@ void Temperature::init() {
setPwmFrequency(E2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#else
pinMode(E2_AUTO_FAN_PIN, OUTPUT);
SET_OUTPUT(E2_AUTO_FAN_PIN);
#endif
#endif
#if HAS_AUTO_FAN_3 && !AUTO_3_IS_0 && !AUTO_3_IS_1 && !AUTO_3_IS_2
@ -1079,7 +1079,7 @@ void Temperature::init() {
setPwmFrequency(E3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#else
pinMode(E3_AUTO_FAN_PIN, OUTPUT);
SET_OUTPUT(E3_AUTO_FAN_PIN);
#endif
#endif

View File

@ -2491,11 +2491,9 @@ void lcd_init() {
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
pinMode(SHIFT_CLK, OUTPUT);
pinMode(SHIFT_LD, OUTPUT);
pinMode(SHIFT_OUT, INPUT);
WRITE(SHIFT_OUT, HIGH);
WRITE(SHIFT_LD, HIGH);
SET_OUTPUT(SHIFT_CLK);
OUT_WRITE(SHIFT_LD, HIGH);
SET_INPUT_PULLUP(SHIFT_OUT);
#endif
#if BUTTON_EXISTS(UP)
@ -2514,16 +2512,13 @@ void lcd_init() {
#else // !NEWPANEL
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
pinMode(SR_DATA_PIN, OUTPUT);
pinMode(SR_CLK_PIN, OUTPUT);
SET_OUTPUT(SR_DATA_PIN);
SET_OUTPUT(SR_CLK_PIN);
#elif defined(SHIFT_CLK)
pinMode(SHIFT_CLK, OUTPUT);
pinMode(SHIFT_LD, OUTPUT);
pinMode(SHIFT_EN, OUTPUT);
pinMode(SHIFT_OUT, INPUT);
WRITE(SHIFT_OUT, HIGH);
WRITE(SHIFT_LD, HIGH);
WRITE(SHIFT_EN, LOW);
SET_OUTPUT(SHIFT_CLK);
OUT_WRITE(SHIFT_LD, HIGH);
OUT_WRITE(SHIFT_EN, LOW);
SET_INPUT_PULLUP(SHIFT_OUT);
#endif // SR_LCD_2W_NL
#endif // !NEWPANEL