Browse Source

Clean up fastIO ahead of PWM patch

Scott Lahteine 6 years ago
parent
commit
51ff5b68fa

+ 10
- 13
Marlin/src/HAL/HAL_AVR/fastio_AVR.h View File

30
 #include <avr/io.h>
30
 #include <avr/io.h>
31
 #include "../../core/macros.h"
31
 #include "../../core/macros.h"
32
 
32
 
33
-#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__)  || defined(__AVR_AT90USB647__))
33
+#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
34
 #define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
34
 #define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
35
 #define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
35
 #define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
36
 #define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
36
 #define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
273
 #define SET_FOCB(T,V) SET_FOC(T,B,V)
273
 #define SET_FOCB(T,V) SET_FOC(T,B,V)
274
 #define SET_FOCC(T,V) SET_FOC(T,C,V)
274
 #define SET_FOCC(T,V) SET_FOC(T,C,V)
275
 
275
 
276
-
277
 /**
276
 /**
278
  * PWM availability macros
277
  * PWM availability macros
279
  */
278
  */
280
 
279
 
281
 // Determine which harware PWMs are already in use
280
 // Determine which harware PWMs are already in use
282
 #if PIN_EXISTS(CONTROLLER_FAN)
281
 #if PIN_EXISTS(CONTROLLER_FAN)
283
-  #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p ==  E1_AUTO_FAN_PIN || p ==  E2_AUTO_FAN_PIN || p ==  E3_AUTO_FAN_PIN || p ==  E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
282
+  #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == E5_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
284
 #else
283
 #else
285
-  #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p ==  E1_AUTO_FAN_PIN || p ==  E2_AUTO_FAN_PIN || p ==  E3_AUTO_FAN_PIN || p ==  E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
284
+  #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == E5_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
286
 #endif
285
 #endif
287
 
286
 
288
 #if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
287
 #if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
335
     #define PWM_CHK_HEATER(p) false
334
     #define PWM_CHK_HEATER(p) false
336
 #endif
335
 #endif
337
 
336
 
338
-#define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p)  || PWM_CHK_MOTOR_CURRENT(p)\
339
-                     || PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p))
337
+#define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p) || PWM_CHK_MOTOR_CURRENT(p) || PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p))
340
 
338
 
341
 // define which hardware PWMs are available for the current CPU
339
 // define which hardware PWMs are available for the current CPU
342
 // all timer 1 PWMS deleted from this list because they are never available
340
 // all timer 1 PWMS deleted from this list because they are never available
343
 #if AVR_ATmega2560_FAMILY
341
 #if AVR_ATmega2560_FAMILY
344
-  #define PWM_PINS(p)  ((p >= 2 && p <= 10) || p == 13 || p == 44 || p == 45 || p == 46)
342
+  #define PWM_PIN(p)  ((p >= 2 && p <= 10) || p == 13 || p == 44 || p == 45 || p == 46)
345
 #elif AVR_ATmega2561_FAMILY
343
 #elif AVR_ATmega2561_FAMILY
346
-  #define PWM_PINS(p)  ((p >= 2 && p <= 6) || p == 9)
344
+  #define PWM_PIN(p)  ((p >= 2 && p <= 6) || p == 9)
347
 #elif AVR_ATmega1284_FAMILY
345
 #elif AVR_ATmega1284_FAMILY
348
-  #define PWM_PINS(p)  (p == 3 || p == 4 || p == 14 || p == 15)
346
+  #define PWM_PIN(p)  (p == 3 || p == 4 || p == 14 || p == 15)
349
 #elif AVR_AT90USB1286_FAMILY
347
 #elif AVR_AT90USB1286_FAMILY
350
-  #define PWM_PINS(p)  (p == 0 || p == 1 || p == 14 || p == 15 || p == 16 || p == 24)
348
+  #define PWM_PIN(p)  (p == 0 || p == 1 || p == 14 || p == 15 || p == 16 || p == 24)
351
 #elif AVR_ATmega328_FAMILY
349
 #elif AVR_ATmega328_FAMILY
352
-  #define PWM_PINS(p)  (p == 3 || p == 5 || p == 6 || p == 11)
350
+  #define PWM_PIN(p)  (p == 3 || p == 5 || p == 6 || p == 11)
353
 #else
351
 #else
354
   #error "unknown CPU"
352
   #error "unknown CPU"
355
 #endif
353
 #endif
356
 
354
 
357
-// finally - the macro that tells us if a pin is an available hardware PWM
358
-#define USEABLE_HARDWARE_PWM(p) (PWM_PINS(p) && !PWM_CHK(p))
355
+#define USEABLE_HARDWARE_PWM(P) (PWM_PIN(P) && !PWM_CHK(p))

+ 11
- 11
Marlin/src/HAL/HAL_DUE/fastio_Due.h View File

154
 #endif
154
 #endif
155
 
155
 
156
 // Set pin as input with pullup mode
156
 // Set pin as input with pullup mode
157
-#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
157
+#define _PULLUP(IO,V)        pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
158
 
158
 
159
 // Read a pin (wrapper)
159
 // Read a pin (wrapper)
160
-#define READ(IO) _READ(IO)
160
+#define READ(IO)             _READ(IO)
161
 
161
 
162
 // Write to a pin (wrapper)
162
 // Write to a pin (wrapper)
163
-#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V)
164
-#define WRITE(IO,V) _WRITE(IO,V)
163
+#define WRITE_VAR(IO,V)      _WRITE_VAR(IO,V)
164
+#define WRITE(IO,V)          _WRITE(IO,V)
165
 
165
 
166
 // Toggle a pin (wrapper)
166
 // Toggle a pin (wrapper)
167
-#define TOGGLE(IO) _TOGGLE(IO)
167
+#define TOGGLE(IO)           _TOGGLE(IO)
168
 
168
 
169
 // Set pin as input (wrapper)
169
 // Set pin as input (wrapper)
170
-#define SET_INPUT(IO) _SET_INPUT(IO)
170
+#define SET_INPUT(IO)        _SET_INPUT(IO)
171
 // Set pin as input with pullup (wrapper)
171
 // Set pin as input with pullup (wrapper)
172
 #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
172
 #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
173
 // Set pin as output (wrapper) -  reads the pin and sets the output to that value
173
 // Set pin as output (wrapper) -  reads the pin and sets the output to that value
174
-#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
174
+#define SET_OUTPUT(IO)       _SET_OUTPUT(IO)
175
 
175
 
176
 // Check if pin is an input
176
 // Check if pin is an input
177
-#define GET_INPUT(IO) !(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO))
177
+#define GET_INPUT(IO)        ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
178
 // Check if pin is an output
178
 // Check if pin is an output
179
-#define GET_OUTPUT(IO) !!(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO))
179
+#define GET_OUTPUT(IO)       ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
180
 // Check if pin is a timer - Must be a constexpr
180
 // Check if pin is a timer - Must be a constexpr
181
-#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
181
+#define GET_TIMER(IO)         ((IO) >= 2 && (IO) <= 13)
182
 
182
 
183
 // Shorthand
183
 // Shorthand
184
-#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); }
184
+#define OUT_WRITE(IO,V)       { SET_OUTPUT(IO); WRITE(IO,V); }
185
 
185
 
186
 // digitalRead/Write wrappers
186
 // digitalRead/Write wrappers
187
 #define extDigitalRead(IO)    digitalRead(IO)
187
 #define extDigitalRead(IO)    digitalRead(IO)

+ 30
- 30
Marlin/src/HAL/HAL_LINUX/fastio.h View File

30
 
30
 
31
 #define USEABLE_HARDWARE_PWM(pin) false
31
 #define USEABLE_HARDWARE_PWM(pin) false
32
 
32
 
33
-#define SET_DIR_INPUT(IO)   Gpio::setDir(IO, 1)
34
-#define SET_DIR_OUTPUT(IO)  Gpio::setDir(IO, 0)
33
+#define SET_DIR_INPUT(IO)     Gpio::setDir(IO, 1)
34
+#define SET_DIR_OUTPUT(IO)    Gpio::setDir(IO, 0)
35
 
35
 
36
-#define SET_MODE(IO, mode)  Gpio::setMode(IO, mode)
36
+#define SET_MODE(IO, mode)    Gpio::setMode(IO, mode)
37
 
37
 
38
-#define WRITE_PIN_SET(IO)   Gpio::set(IO)
39
-#define WRITE_PIN_CLR(IO)   Gpio::clear(IO)
38
+#define WRITE_PIN_SET(IO)     Gpio::set(IO)
39
+#define WRITE_PIN_CLR(IO)     Gpio::clear(IO)
40
 
40
 
41
-#define READ_PIN(IO)        Gpio::get(IO)
42
-#define WRITE_PIN(IO,V)     Gpio::set(IO, V)
41
+#define READ_PIN(IO)          Gpio::get(IO)
42
+#define WRITE_PIN(IO,V)       Gpio::set(IO, V)
43
 
43
 
44
 /**
44
 /**
45
  * Magic I/O routines
45
  * Magic I/O routines
50
  */
50
  */
51
 
51
 
52
 /// Read a pin
52
 /// Read a pin
53
-#define _READ(IO)         READ_PIN(IO)
53
+#define _READ(IO)             READ_PIN(IO)
54
 
54
 
55
 /// Write to a pin
55
 /// Write to a pin
56
-#define _WRITE_VAR(IO,V)  digitalWrite(IO,V)
56
+#define _WRITE_VAR(IO,V)      digitalWrite(IO,V)
57
 
57
 
58
-#define _WRITE(IO,V)      WRITE_PIN(IO,V)
58
+#define _WRITE(IO,V)          WRITE_PIN(IO,V)
59
 
59
 
60
 /// toggle a pin
60
 /// toggle a pin
61
-#define _TOGGLE(IO)       _WRITE(IO, !READ(IO))
61
+#define _TOGGLE(IO)          _WRITE(IO, !READ(IO))
62
 
62
 
63
 /// set pin as input
63
 /// set pin as input
64
-#define _SET_INPUT(IO)    SET_DIR_INPUT(IO)
64
+#define _SET_INPUT(IO)        SET_DIR_INPUT(IO)
65
 
65
 
66
 /// set pin as output
66
 /// set pin as output
67
-#define _SET_OUTPUT(IO)   SET_DIR_OUTPUT(IO)
67
+#define _SET_OUTPUT(IO)       SET_DIR_OUTPUT(IO)
68
 
68
 
69
 /// set pin as input with pullup mode
69
 /// set pin as input with pullup mode
70
-#define _PULLUP(IO,V)     pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
70
+#define _PULLUP(IO,V)         pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
71
 
71
 
72
 /// set pin as input with pulldown mode
72
 /// set pin as input with pulldown mode
73
-#define _PULLDOWN(IO,V)   pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
73
+#define _PULLDOWN(IO,V)       pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
74
 
74
 
75
 // hg42: all pins can be input or output (I hope)
75
 // hg42: all pins can be input or output (I hope)
76
 // hg42: undefined pins create compile error (IO, is no pin)
76
 // hg42: undefined pins create compile error (IO, is no pin)
77
 // hg42: currently not used, but was used by pinsDebug
77
 // hg42: currently not used, but was used by pinsDebug
78
 
78
 
79
 /// check if pin is an input
79
 /// check if pin is an input
80
-#define _GET_INPUT(IO)    (LPC1768_PIN_PIN(IO) >= 0)
80
+#define _GET_INPUT(IO)        (LPC1768_PIN_PIN(IO) >= 0)
81
 
81
 
82
 /// check if pin is an output
82
 /// check if pin is an output
83
-#define _GET_OUTPUT(IO)   (LPC1768_PIN_PIN(IO) >= 0)
83
+#define _GET_OUTPUT(IO)       (LPC1768_PIN_PIN(IO) >= 0)
84
 
84
 
85
 // hg42: GET_TIMER is used only to check if it's a PWM pin
85
 // hg42: GET_TIMER is used only to check if it's a PWM pin
86
 // hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
86
 // hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
87
 // hg42: instead use PWM bit from the #define
87
 // hg42: instead use PWM bit from the #define
88
 
88
 
89
 /// check if pin is a timer
89
 /// check if pin is a timer
90
-#define _GET_TIMER(IO)    TRUE  // could be LPC1768_PIN_PWM(IO), but there
90
+#define _GET_TIMER(IO)        true  // could be LPC1768_PIN_PWM(IO), but there
91
 // hg42: could be this:
91
 // hg42: could be this:
92
 // #define _GET_TIMER(IO)        LPC1768_PIN_PWM(IO)
92
 // #define _GET_TIMER(IO)        LPC1768_PIN_PWM(IO)
93
 // but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
93
 // but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
94
 
94
 
95
 /// Read a pin wrapper
95
 /// Read a pin wrapper
96
-#define READ(IO)          _READ(IO)
96
+#define READ(IO)             _READ(IO)
97
 
97
 
98
 /// Write to a pin wrapper
98
 /// Write to a pin wrapper
99
-#define WRITE_VAR(IO,V)   _WRITE_VAR(IO,V)
100
-#define WRITE(IO,V)       _WRITE(IO,V)
99
+#define WRITE_VAR(IO,V)      _WRITE_VAR(IO,V)
100
+#define WRITE(IO,V)          _WRITE(IO,V)
101
 
101
 
102
 /// toggle a pin wrapper
102
 /// toggle a pin wrapper
103
-#define TOGGLE(IO)        _TOGGLE(IO)
103
+#define TOGGLE(IO)           _TOGGLE(IO)
104
 
104
 
105
 /// set pin as input wrapper
105
 /// set pin as input wrapper
106
-#define SET_INPUT(IO)     _SET_INPUT(IO)
106
+#define SET_INPUT(IO)        _SET_INPUT(IO)
107
 /// set pin as input with pullup wrapper
107
 /// set pin as input with pullup wrapper
108
-#define SET_INPUT_PULLUP(IO)    do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
108
+#define SET_INPUT_PULLUP(IO)  do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
109
 /// set pin as input with pulldown wrapper
109
 /// set pin as input with pulldown wrapper
110
-#define SET_INPUT_PULLDOWN(IO)  do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
110
+#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
111
 /// set pin as output wrapper  -  reads the pin and sets the output to that value
111
 /// set pin as output wrapper  -  reads the pin and sets the output to that value
112
-#define SET_OUTPUT(IO)          do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
112
+#define SET_OUTPUT(IO)        do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
113
 
113
 
114
 /// check if pin is an input wrapper
114
 /// check if pin is an input wrapper
115
-#define GET_INPUT(IO)     _GET_INPUT(IO)
115
+#define GET_INPUT(IO)        _GET_INPUT(IO)
116
 /// check if pin is an output wrapper
116
 /// check if pin is an output wrapper
117
-#define GET_OUTPUT(IO)    _GET_OUTPUT(IO)
117
+#define GET_OUTPUT(IO)       _GET_OUTPUT(IO)
118
 
118
 
119
 /// check if pin is a timer (wrapper)
119
 /// check if pin is a timer (wrapper)
120
-#define GET_TIMER(IO)     _GET_TIMER(IO)
120
+#define GET_TIMER(IO)        _GET_TIMER(IO)
121
 
121
 
122
 // Shorthand
122
 // Shorthand
123
-#define OUT_WRITE(IO,V)   do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
123
+#define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
124
 
124
 
125
 // digitalRead/Write wrappers
125
 // digitalRead/Write wrappers
126
 #define extDigitalRead(IO)    digitalRead(IO)
126
 #define extDigitalRead(IO)    digitalRead(IO)

+ 34
- 33
Marlin/src/HAL/HAL_LPC1768/fastio.h View File

35
 
35
 
36
 #include <Arduino.h>
36
 #include <Arduino.h>
37
 
37
 
38
-#define USEABLE_HARDWARE_PWM(pin) TRUE // all pins are PWM capable
38
+#define PWM_PIN(P)              true // all pins are PWM capable
39
+#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
39
 
40
 
40
-#define LPC_PIN(pin)            gpio_pin(pin)
41
-#define LPC_GPIO(port)          gpio_port(port)
41
+#define LPC_PIN(pin)          gpio_pin(pin)
42
+#define LPC_GPIO(port)        gpio_port(port)
42
 
43
 
43
-#define SET_DIR_INPUT(IO)       gpio_set_input(IO)
44
-#define SET_DIR_OUTPUT(IO)      gpio_set_output(IO)
44
+#define SET_DIR_INPUT(IO)     gpio_set_input(IO)
45
+#define SET_DIR_OUTPUT(IO)    gpio_set_output(IO)
45
 
46
 
46
-#define SET_MODE(IO, mode)      pinMode(IO, mode)
47
+#define SET_MODE(IO, mode)    pinMode(IO, mode)
47
 
48
 
48
-#define WRITE_PIN_SET(IO)       gpio_set(IO)
49
-#define WRITE_PIN_CLR(IO)       gpio_clear(IO)
49
+#define WRITE_PIN_SET(IO)     gpio_set(IO)
50
+#define WRITE_PIN_CLR(IO)     gpio_clear(IO)
50
 
51
 
51
-#define READ_PIN(IO)            gpio_get(IO)
52
-#define WRITE_PIN(IO,V)         gpio_set(IO, V)
52
+#define READ_PIN(IO)          gpio_get(IO)
53
+#define WRITE_PIN(IO,V)       gpio_set(IO, V)
53
 
54
 
54
 /**
55
 /**
55
  * Magic I/O routines
56
  * Magic I/O routines
60
  */
61
  */
61
 
62
 
62
 /// Read a pin
63
 /// Read a pin
63
-#define _READ(IO)         READ_PIN(IO)
64
+#define _READ(IO)             READ_PIN(IO)
64
 
65
 
65
 /// Write to a pin
66
 /// Write to a pin
66
-#define _WRITE_VAR(IO,V)  digitalWrite(IO,V)
67
+#define _WRITE_VAR(IO,V)      digitalWrite(IO,V)
67
 
68
 
68
-#define _WRITE(IO,V)      WRITE_PIN(IO,V)
69
+#define _WRITE(IO,V)          WRITE_PIN(IO,V)
69
 
70
 
70
 /// toggle a pin
71
 /// toggle a pin
71
-#define _TOGGLE(IO)       _WRITE(IO, !READ(IO))
72
+#define _TOGGLE(IO)           _WRITE(IO, !READ(IO))
72
 
73
 
73
 /// set pin as input
74
 /// set pin as input
74
-#define _SET_INPUT(IO)    SET_DIR_INPUT(IO)
75
+#define _SET_INPUT(IO)        SET_DIR_INPUT(IO)
75
 
76
 
76
 /// set pin as output
77
 /// set pin as output
77
-#define _SET_OUTPUT(IO)   SET_DIR_OUTPUT(IO)
78
+#define _SET_OUTPUT(IO)       SET_DIR_OUTPUT(IO)
78
 
79
 
79
 /// set pin as input with pullup mode
80
 /// set pin as input with pullup mode
80
-#define _PULLUP(IO,V)     pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
81
+#define _PULLUP(IO,V)         pinMode(IO, (V) ? INPUT_PULLUP : INPUT)
81
 
82
 
82
 /// set pin as input with pulldown mode
83
 /// set pin as input with pulldown mode
83
-#define _PULLDOWN(IO,V)   pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
84
+#define _PULLDOWN(IO,V)       pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
84
 
85
 
85
 /// check if pin is an input
86
 /// check if pin is an input
86
-#define _GET_INPUT(IO)    (!gpio_get_dir(IO))
87
+#define _GET_INPUT(IO)        (!gpio_get_dir(IO))
87
 
88
 
88
 /// check if pin is an output
89
 /// check if pin is an output
89
-#define _GET_OUTPUT(IO)   (gpio_get_dir(IO))
90
+#define _GET_OUTPUT(IO)       (gpio_get_dir(IO))
90
 
91
 
91
 /// check if pin is a timer
92
 /// check if pin is a timer
92
 /// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
93
 /// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
93
-#define _GET_TIMER(IO)    TRUE
94
+#define _GET_TIMER(IO)        true
94
 
95
 
95
 /// Read a pin wrapper
96
 /// Read a pin wrapper
96
-#define READ(IO)          _READ(IO)
97
+#define READ(IO)              _READ(IO)
97
 
98
 
98
 /// Write to a pin wrapper
99
 /// Write to a pin wrapper
99
-#define WRITE_VAR(IO,V)   _WRITE_VAR(IO,V)
100
-#define WRITE(IO,V)       _WRITE(IO,V)
100
+#define WRITE_VAR(IO,V)       _WRITE_VAR(IO,V)
101
+#define WRITE(IO,V)           _WRITE(IO,V)
101
 
102
 
102
 /// toggle a pin wrapper
103
 /// toggle a pin wrapper
103
-#define TOGGLE(IO)        _TOGGLE(IO)
104
+#define TOGGLE(IO)            _TOGGLE(IO)
104
 
105
 
105
 /// set pin as input wrapper
106
 /// set pin as input wrapper
106
-#define SET_INPUT(IO)     _SET_INPUT(IO)
107
+#define SET_INPUT(IO)         _SET_INPUT(IO)
107
 /// set pin as input with pullup wrapper
108
 /// set pin as input with pullup wrapper
108
-#define SET_INPUT_PULLUP(IO)    do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
109
+#define SET_INPUT_PULLUP(IO)  do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
109
 /// set pin as input with pulldown wrapper
110
 /// set pin as input with pulldown wrapper
110
-#define SET_INPUT_PULLDOWN(IO)  do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
111
+#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0)
111
 /// set pin as output wrapper  -  reads the pin and sets the output to that value
112
 /// set pin as output wrapper  -  reads the pin and sets the output to that value
112
-#define SET_OUTPUT(IO)          do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
113
+#define SET_OUTPUT(IO)        do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0)
113
 
114
 
114
 /// check if pin is an input wrapper
115
 /// check if pin is an input wrapper
115
-#define GET_INPUT(IO)     _GET_INPUT(IO)
116
+#define GET_INPUT(IO)         _GET_INPUT(IO)
116
 /// check if pin is an output wrapper
117
 /// check if pin is an output wrapper
117
-#define GET_OUTPUT(IO)    _GET_OUTPUT(IO)
118
+#define GET_OUTPUT(IO)        _GET_OUTPUT(IO)
118
 
119
 
119
 /// check if pin is a timer (wrapper)
120
 /// check if pin is a timer (wrapper)
120
-#define GET_TIMER(IO)     _GET_TIMER(IO)
121
+#define GET_TIMER(IO)         _GET_TIMER(IO)
121
 
122
 
122
 // Shorthand
123
 // Shorthand
123
-#define OUT_WRITE(IO,V)   do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
124
+#define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
124
 
125
 
125
 // digitalRead/Write wrappers
126
 // digitalRead/Write wrappers
126
 #define extDigitalRead(IO)    digitalRead(IO)
127
 #define extDigitalRead(IO)    digitalRead(IO)

+ 1
- 1
Marlin/src/HAL/HAL_STM32/fastio_STM32.h View File

77
 #define GET_OUTPUT(IO)
77
 #define GET_OUTPUT(IO)
78
 #define GET_TIMER(IO)
78
 #define GET_TIMER(IO)
79
 
79
 
80
-#define PWM_PIN(p) digitalPinHasPWM(p)
80
+#define PWM_PIN(p)              digitalPinHasPWM(p)
81
 #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
81
 #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
82
 
82
 
83
 // digitalRead/Write wrappers
83
 // digitalRead/Write wrappers

+ 0
- 1
Marlin/src/HAL/HAL_STM32F1/HAL.cpp View File

207
   } }
207
   } }
208
 #endif
208
 #endif
209
 
209
 
210
-
211
 void HAL_init(void) {
210
 void HAL_init(void) {
212
   NVIC_SetPriorityGrouping(0x3);
211
   NVIC_SetPriorityGrouping(0x3);
213
 }
212
 }

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h View File

42
 
42
 
43
 #define SET_INPUT(IO)         _SET_MODE(IO, GPIO_INPUT_FLOATING)
43
 #define SET_INPUT(IO)         _SET_MODE(IO, GPIO_INPUT_FLOATING)
44
 #define SET_INPUT_PULLUP(IO)  _SET_MODE(IO, GPIO_INPUT_PU)
44
 #define SET_INPUT_PULLUP(IO)  _SET_MODE(IO, GPIO_INPUT_PU)
45
-#define SET_OUTPUT(IO)        OUT_WRITE(IO,LOW)
45
+#define SET_OUTPUT(IO)        OUT_WRITE(IO, LOW)
46
 
46
 
47
 #define GET_INPUT(IO)         (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
47
 #define GET_INPUT(IO)         (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
48
 #define GET_OUTPUT(IO)        (_GET_MODE(IO) == GPIO_OUTPUT_PP)
48
 #define GET_OUTPUT(IO)        (_GET_MODE(IO) == GPIO_OUTPUT_PP)

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h View File

50
 #define GET_OUTPUT(IO)
50
 #define GET_OUTPUT(IO)
51
 #define GET_TIMER(IO)
51
 #define GET_TIMER(IO)
52
 
52
 
53
-#define PWM_PIN(p) true
53
+#define PWM_PIN(p)              true
54
 #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
54
 #define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
55
 
55
 
56
 // digitalRead/Write wrappers
56
 // digitalRead/Write wrappers

+ 1
- 1
Marlin/src/inc/SanityCheck.h View File

2014
 #endif
2014
 #endif
2015
 
2015
 
2016
 #if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM))
2016
 #if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM))
2017
-  #error "FAST_PWM_FAN only supported by 8 bit CPUs."
2017
+  #error "FAST_PWM_FAN is only supported for ARDUINO and ARDUINO_ARCH_SAM."
2018
 #endif
2018
 #endif
2019
 
2019
 
2020
 #if ENABLED(Z_STEPPER_AUTO_ALIGN)
2020
 #if ENABLED(Z_STEPPER_AUTO_ALIGN)

Loading…
Cancel
Save