Browse Source

fix missing GET_TIMER (used by PWM for Ex_AUTO_FAN)

Unknown 6 years ago
parent
commit
d1f11e9c10
1 changed files with 14 additions and 5 deletions
  1. 14
    5
      Marlin/src/HAL/HAL_LPC1768/fastio.h

+ 14
- 5
Marlin/src/HAL/HAL_LPC1768/fastio.h View File

@@ -85,13 +85,22 @@ bool useable_hardware_PWM(pin_t pin);
85 85
 /// set pin as input with pullup mode
86 86
 #define _PULLUP(IO, v) (pinMode(IO, (v!=LOW ? INPUT_PULLUP : INPUT)))
87 87
 
88
+// hg42: all pins can be input or output (I hope)
89
+// hg42: undefined pins create compile error (IO, is no pin)
90
+// hg42: currently not used, but was used by pinsDebug
91
+
88 92
 /// check if pin is an input
89
-#define _GET_INPUT(IO)
93
+#define _GET_INPUT(IO)        (LPC1768_PIN_PIN(IO)>=0)
94
+
90 95
 /// check if pin is an output
91
-#define _GET_OUTPUT(IO)
96
+#define _GET_OUTPUT(IO)       (LPC1768_PIN_PIN(IO)>=0)
97
+
98
+// hg42: GET_TIMER is used only to check if it's a PWM pin
99
+// hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
100
+// hg42: instead use PWM bit from the #define
92 101
 
93 102
 /// check if pin is an timer
94
-#define _GET_TIMER(IO)
103
+#define _GET_TIMER(IO)        LPC1768_PIN_PWM(IO)
95 104
 
96 105
 /// Read a pin wrapper
97 106
 #define READ(IO)  _READ(IO)
@@ -111,9 +120,9 @@ bool useable_hardware_PWM(pin_t pin);
111 120
 #define SET_OUTPUT(IO)  do{ _SET_OUTPUT(IO); _WRITE(IO, LOW); }while(0)
112 121
 
113 122
 /// check if pin is an input wrapper
114
-#define GET_INPUT(IO)  _GET_INPUT(IO) // todo: Never used?
123
+#define GET_INPUT(IO)  _GET_INPUT(IO)
115 124
 /// check if pin is an output wrapper
116
-#define GET_OUTPUT(IO)  _GET_OUTPUT(IO) //todo: Never Used?
125
+#define GET_OUTPUT(IO)  _GET_OUTPUT(IO)
117 126
 
118 127
 /// check if pin is an timer wrapper
119 128
 #define GET_TIMER(IO)  _GET_TIMER(IO)

Loading…
Cancel
Save