Browse Source

Use DPM where possible

pull/1/head
Scott Lahteine 8 years ago
parent
commit
9cbedab91b
  1. 2
      Marlin/fastio.h
  2. 8
      Marlin/temperature.cpp
  3. 23
      Marlin/ultralcd.cpp

2
Marlin/fastio.h

@ -93,6 +93,8 @@
/// set pin as input wrapper /// set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO) #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 /// set pin as output wrapper
#define SET_OUTPUT(IO) _SET_OUTPUT(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO)

8
Marlin/temperature.cpp

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

23
Marlin/ultralcd.cpp

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

Loading…
Cancel
Save