Browse Source

Clean up HALs / FastIO (#14082)

Giuliano Zaro 5 years ago
parent
commit
a74aad3b4a

+ 1
- 5
Marlin/src/HAL/HAL_AVR/fastio_AVR.h View File

81
 #define _SET_INPUT(IO)        CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
81
 #define _SET_INPUT(IO)        CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
82
 #define _SET_OUTPUT(IO)       SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
82
 #define _SET_OUTPUT(IO)       SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
83
 
83
 
84
-#define _IS_INPUT(IO)        !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
84
+#define _IS_INPUT(IO)         !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
85
 #define _IS_OUTPUT(IO)        TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
85
 #define _IS_OUTPUT(IO)        TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
86
-#define _HAS_TIMER(IO)        bool(DIO ## IO ## _PWM)
87
 
86
 
88
 // digitalRead/Write wrappers
87
 // digitalRead/Write wrappers
89
 #ifdef FASTIO_EXT_START
88
 #ifdef FASTIO_EXT_START
106
 
105
 
107
 #define IS_INPUT(IO)          _IS_INPUT(IO)
106
 #define IS_INPUT(IO)          _IS_INPUT(IO)
108
 #define IS_OUTPUT(IO)         _IS_OUTPUT(IO)
107
 #define IS_OUTPUT(IO)         _IS_OUTPUT(IO)
109
-#define HAS_TIMER(IO)         _HAS_TIMER(IO)
110
 
108
 
111
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
109
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
112
 
110
 
353
 #else
351
 #else
354
   #error "unknown CPU"
352
   #error "unknown CPU"
355
 #endif
353
 #endif
356
-
357
-#define USEABLE_HARDWARE_PWM(P) (PWM_PIN(P) && !PWM_CHK(P))

+ 0
- 15
Marlin/src/HAL/HAL_DUE/HAL.h View File

78
 #undef pgm_read_word
78
 #undef pgm_read_word
79
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
79
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
80
 
80
 
81
-#define RST_POWER_ON   1
82
-#define RST_EXTERNAL   2
83
-#define RST_BROWN_OUT  4
84
-#define RST_WATCHDOG   8
85
-#define RST_JTAG       16
86
-#define RST_SOFTWARE   32
87
-#define RST_BACKUP     64
88
-
89
 typedef int8_t pin_t;
81
 typedef int8_t pin_t;
90
 
82
 
91
 #define HAL_SERVO_LIB Servo
83
 #define HAL_SERVO_LIB Servo
143
 
135
 
144
 void HAL_adc_start_conversion(const uint8_t adc_pin);
136
 void HAL_adc_start_conversion(const uint8_t adc_pin);
145
 uint16_t HAL_adc_get_result(void);
137
 uint16_t HAL_adc_get_result(void);
146
-uint16_t HAL_getAdcReading(uint8_t chan);
147
-void HAL_startAdcConversion(uint8_t chan);
148
-uint8_t HAL_pinToAdcChannel(int pin);
149
-uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
150
-//uint16_t HAL_getAdcSuperSample(uint8_t chan);
151
-void HAL_enable_AdcFreerun(void);
152
-//void HAL_disable_AdcFreerun(uint8_t chan);
153
 
138
 
154
 //
139
 //
155
 // Pin Map
140
 // Pin Map

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

46
 // Due has 12 PWMs assigned to logical pins 2-13.
46
 // Due has 12 PWMs assigned to logical pins 2-13.
47
 // 6, 7, 8 & 9 come from the PWM controller. The others come from the timers.
47
 // 6, 7, 8 & 9 come from the PWM controller. The others come from the timers.
48
 #define PWM_PIN(P)              WITHIN(P, 2, 13)
48
 #define PWM_PIN(P)              WITHIN(P, 2, 13)
49
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
50
 
49
 
51
 #ifndef MASK
50
 #ifndef MASK
52
   #define MASK(PIN) (1 << PIN)
51
   #define MASK(PIN) (1 << PIN)
180
 #define IS_INPUT(IO)         ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
179
 #define IS_INPUT(IO)         ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
181
 // Check if pin is an output
180
 // Check if pin is an output
182
 #define IS_OUTPUT(IO)        ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
181
 #define IS_OUTPUT(IO)        ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
183
-// Check if pin is a timer - Must be a constexpr
184
-#define HAS_TIMER(IO)         ((IO) >= 2 && (IO) <= 13)
185
 
182
 
186
 // Shorthand
183
 // Shorthand
187
 #define OUT_WRITE(IO,V)       { SET_OUTPUT(IO); WRITE(IO,V); }
184
 #define OUT_WRITE(IO,V)       { SET_OUTPUT(IO); WRITE(IO,V); }

+ 0
- 1
Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h View File

67
 
67
 
68
 // PWM outputs
68
 // PWM outputs
69
 #define PWM_PIN(P)              (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output.
69
 #define PWM_PIN(P)              (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output.
70
-#define USEABLE_HARDWARE_PWM(P) (!IS_I2S_EXPANDER_PIN(P) && PWM_PIN(P))
71
 
70
 
72
 // Toggle pin value
71
 // Toggle pin value
73
 #define TOGGLE(IO)              WRITE(IO, !READ(IO))
72
 #define TOGGLE(IO)              WRITE(IO, !READ(IO))

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

80
 /// check if pin is an output
80
 /// check if pin is an output
81
 #define _IS_OUTPUT(IO)        (LPC1768_PIN_PIN(IO) >= 0)
81
 #define _IS_OUTPUT(IO)        (LPC1768_PIN_PIN(IO) >= 0)
82
 
82
 
83
-// hg42: HAS_TIMER is used only to check if it's a PWM pin
84
-// hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
85
-// hg42: instead use PWM bit from the #define
86
-
87
-/// check if pin is a timer
88
-#define _HAS_TIMER(IO)        true  // could be LPC1768_PIN_PWM(IO), but there
89
-// hg42: could be this:
90
-// #define _HAS_TIMER(IO)        LPC1768_PIN_PWM(IO)
91
-// but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
92
-
93
 /// Read a pin wrapper
83
 /// Read a pin wrapper
94
 #define READ(IO)             _READ(IO)
84
 #define READ(IO)             _READ(IO)
95
 
85
 
116
 /// check if pin is an output wrapper
106
 /// check if pin is an output wrapper
117
 #define IS_OUTPUT(IO)        _IS_OUTPUT(IO)
107
 #define IS_OUTPUT(IO)        _IS_OUTPUT(IO)
118
 
108
 
119
-/// check if pin is a timer (wrapper)
120
-#define HAS_TIMER(IO)        _HAS_TIMER(IO)
121
-
122
 // Shorthand
109
 // Shorthand
123
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
110
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
124
 
111
 
125
 // digitalRead/Write wrappers
112
 // digitalRead/Write wrappers
126
 #define extDigitalRead(IO)    digitalRead(IO)
113
 #define extDigitalRead(IO)    digitalRead(IO)
127
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
114
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
128
-
129
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)

+ 0
- 5
Marlin/src/HAL/HAL_LINUX/watchdog.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#define RST_POWER_ON   1
25
-#define RST_EXTERNAL   2
26
-#define RST_BROWN_OUT  4
27
-#define RST_WATCHDOG   8
28
-
29
 #define WDT_TIMEOUT   4000000 // 4 second timeout
24
 #define WDT_TIMEOUT   4000000 // 4 second timeout
30
 
25
 
31
 void watchdog_init(void);
26
 void watchdog_init(void);

+ 1
- 9
Marlin/src/HAL/HAL_LPC1768/fastio.h View File

35
 
35
 
36
 #include "../shared/Marduino.h"
36
 #include "../shared/Marduino.h"
37
 
37
 
38
-#define PWM_PIN(P)              true // all pins are PWM capable
39
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
38
+#define PWM_PIN(P)            true // all pins are PWM capable
40
 
39
 
41
 #define LPC_PIN(pin)          gpio_pin(pin)
40
 #define LPC_PIN(pin)          gpio_pin(pin)
42
 #define LPC_GPIO(port)        gpio_port(port)
41
 #define LPC_GPIO(port)        gpio_port(port)
89
 /// check if pin is an output
88
 /// check if pin is an output
90
 #define _IS_OUTPUT(IO)        (gpio_get_dir(IO))
89
 #define _IS_OUTPUT(IO)        (gpio_get_dir(IO))
91
 
90
 
92
-/// check if pin is a timer
93
-/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
94
-#define _HAS_TIMER(IO)        true
95
-
96
 /// Read a pin wrapper
91
 /// Read a pin wrapper
97
 #define READ(IO)              _READ(IO)
92
 #define READ(IO)              _READ(IO)
98
 
93
 
119
 /// check if pin is an output wrapper
114
 /// check if pin is an output wrapper
120
 #define IS_OUTPUT(IO)         _IS_OUTPUT(IO)
115
 #define IS_OUTPUT(IO)         _IS_OUTPUT(IO)
121
 
116
 
122
-/// check if pin is a timer (wrapper)
123
-#define HAS_TIMER(IO)         _HAS_TIMER(IO)
124
-
125
 // Shorthand
117
 // Shorthand
126
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
118
 #define OUT_WRITE(IO,V)       do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
127
 
119
 

+ 0
- 5
Marlin/src/HAL/HAL_LPC1768/watchdog.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#define RST_POWER_ON   1
25
-#define RST_EXTERNAL   2
26
-#define RST_BROWN_OUT  4
27
-#define RST_WATCHDOG   8
28
-
29
 #define WDT_TIMEOUT   4000000 // 4 second timeout
24
 #define WDT_TIMEOUT   4000000 // 4 second timeout
30
 
25
 
31
 void watchdog_init(void);
26
 void watchdog_init(void);

+ 0
- 8
Marlin/src/HAL/HAL_STM32/HAL.h View File

127
 #undef pgm_read_ptr
127
 #undef pgm_read_ptr
128
 #define pgm_read_ptr(addr) (*(addr))
128
 #define pgm_read_ptr(addr) (*(addr))
129
 
129
 
130
-#define RST_POWER_ON   1
131
-#define RST_EXTERNAL   2
132
-#define RST_BROWN_OUT  4
133
-#define RST_WATCHDOG   8
134
-#define RST_JTAG       16
135
-#define RST_SOFTWARE   32
136
-#define RST_BACKUP     64
137
-
138
 // --------------------------------------------------------------------------
130
 // --------------------------------------------------------------------------
139
 // Types
131
 // Types
140
 // --------------------------------------------------------------------------
132
 // --------------------------------------------------------------------------

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

80
 
80
 
81
 #define IS_INPUT(IO)
81
 #define IS_INPUT(IO)
82
 #define IS_OUTPUT(IO)
82
 #define IS_OUTPUT(IO)
83
-#define HAS_TIMER(IO)           digitalPinHasPWM(IO)
84
 
83
 
85
-#define PWM_PIN(P)              HAS_TIMER(P)
86
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
84
+#define PWM_PIN(P)              digitalPinHasPWM(P)
87
 
85
 
88
 // digitalRead/Write wrappers
86
 // digitalRead/Write wrappers
89
 #define extDigitalRead(IO)    digitalRead(IO)
87
 #define extDigitalRead(IO)    digitalRead(IO)

+ 0
- 15
Marlin/src/HAL/HAL_STM32F1/HAL.h View File

253
 #define HAL_ADC_READY()     true
253
 #define HAL_ADC_READY()     true
254
 
254
 
255
 void HAL_adc_start_conversion(const uint8_t adc_pin);
255
 void HAL_adc_start_conversion(const uint8_t adc_pin);
256
-
257
 uint16_t HAL_adc_get_result(void);
256
 uint16_t HAL_adc_get_result(void);
258
 
257
 
259
-/* Todo: Confirm none of this is needed.
260
-uint16_t HAL_getAdcReading(uint8_t chan);
261
-
262
-void HAL_startAdcConversion(uint8_t chan);
263
-uint8_t HAL_pinToAdcChannel(int pin);
264
-
265
-uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
266
-//uint16_t HAL_getAdcSuperSample(uint8_t chan);
267
-
268
-void HAL_enable_AdcFreerun(void);
269
-//void HAL_disable_AdcFreerun(uint8_t chan);
270
-
271
-*/
272
-
273
 #define GET_PIN_MAP_PIN(index) index
258
 #define GET_PIN_MAP_PIN(index) index
274
 #define GET_PIN_MAP_INDEX(pin) pin
259
 #define GET_PIN_MAP_INDEX(pin) pin
275
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
260
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

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

50
 
50
 
51
 #define IS_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)
51
 #define IS_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)
52
 #define IS_OUTPUT(IO)         (_GET_MODE(IO) == GPIO_OUTPUT_PP)
52
 #define IS_OUTPUT(IO)         (_GET_MODE(IO) == GPIO_OUTPUT_PP)
53
-#define HAS_TIMER(IO)         (PIN_MAP[IO].timer_device != nullptr)
54
 
53
 
55
-#define PWM_PIN(P)              HAS_TIMER(P)
56
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
54
+#define PWM_PIN(P)            (PIN_MAP[IO].timer_device != nullptr)
57
 
55
 
58
 // digitalRead/Write wrappers
56
 // digitalRead/Write wrappers
59
 #define extDigitalRead(IO)    digitalRead(IO)
57
 #define extDigitalRead(IO)    digitalRead(IO)

+ 0
- 23
Marlin/src/HAL/HAL_STM32F4/HAL.h View File

136
 #undef pgm_read_ptr
136
 #undef pgm_read_ptr
137
 #define pgm_read_ptr(addr) (*(addr))
137
 #define pgm_read_ptr(addr) (*(addr))
138
 
138
 
139
-#define RST_POWER_ON   1
140
-#define RST_EXTERNAL   2
141
-#define RST_BROWN_OUT  4
142
-#define RST_WATCHDOG   8
143
-#define RST_JTAG       16
144
-#define RST_SOFTWARE   32
145
-#define RST_BACKUP     64
146
-
147
 // --------------------------------------------------------------------------
139
 // --------------------------------------------------------------------------
148
 // Types
140
 // Types
149
 // --------------------------------------------------------------------------
141
 // --------------------------------------------------------------------------
232
 #define HAL_ADC_READY()     true
224
 #define HAL_ADC_READY()     true
233
 
225
 
234
 void HAL_adc_start_conversion(const uint8_t adc_pin);
226
 void HAL_adc_start_conversion(const uint8_t adc_pin);
235
-
236
 uint16_t HAL_adc_get_result(void);
227
 uint16_t HAL_adc_get_result(void);
237
 
228
 
238
-/* Todo: Confirm none of this is needed.
239
-uint16_t HAL_getAdcReading(uint8_t chan);
240
-
241
-void HAL_startAdcConversion(uint8_t chan);
242
-uint8_t HAL_pinToAdcChannel(int pin);
243
-
244
-uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
245
-//uint16_t HAL_getAdcSuperSample(uint8_t chan);
246
-
247
-void HAL_enable_AdcFreerun(void);
248
-//void HAL_disable_AdcFreerun(uint8_t chan);
249
-
250
-*/
251
-
252
 #define GET_PIN_MAP_PIN(index) index
229
 #define GET_PIN_MAP_PIN(index) index
253
 #define GET_PIN_MAP_INDEX(pin) pin
230
 #define GET_PIN_MAP_INDEX(pin) pin
254
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
231
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

+ 1
- 3
Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h View File

50
 
50
 
51
 #define IS_INPUT(IO)
51
 #define IS_INPUT(IO)
52
 #define IS_OUTPUT(IO)
52
 #define IS_OUTPUT(IO)
53
-#define HAS_TIMER(IO)           true
54
 
53
 
55
-#define PWM_PIN(P)              HAS_TIMER(P)
56
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
54
+#define PWM_PIN(P)              true
57
 
55
 
58
 // digitalRead/Write wrappers
56
 // digitalRead/Write wrappers
59
 #define extDigitalRead(IO)    digitalRead(IO)
57
 #define extDigitalRead(IO)    digitalRead(IO)

+ 0
- 23
Marlin/src/HAL/HAL_STM32F7/HAL.h View File

125
 #undef pgm_read_ptr
125
 #undef pgm_read_ptr
126
 #define pgm_read_ptr(addr) (*(addr))
126
 #define pgm_read_ptr(addr) (*(addr))
127
 
127
 
128
-#define RST_POWER_ON   1
129
-#define RST_EXTERNAL   2
130
-#define RST_BROWN_OUT  4
131
-#define RST_WATCHDOG   8
132
-#define RST_JTAG       16
133
-#define RST_SOFTWARE   32
134
-#define RST_BACKUP     64
135
-
136
 // --------------------------------------------------------------------------
128
 // --------------------------------------------------------------------------
137
 // Types
129
 // Types
138
 // --------------------------------------------------------------------------
130
 // --------------------------------------------------------------------------
211
 #define HAL_ADC_READY()     true
203
 #define HAL_ADC_READY()     true
212
 
204
 
213
 void HAL_adc_start_conversion(const uint8_t adc_pin);
205
 void HAL_adc_start_conversion(const uint8_t adc_pin);
214
-
215
 uint16_t HAL_adc_get_result(void);
206
 uint16_t HAL_adc_get_result(void);
216
 
207
 
217
-/* Todo: Confirm none of this is needed.
218
-uint16_t HAL_getAdcReading(uint8_t chan);
219
-
220
-void HAL_startAdcConversion(uint8_t chan);
221
-uint8_t HAL_pinToAdcChannel(int pin);
222
-
223
-uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
224
-//uint16_t HAL_getAdcSuperSample(uint8_t chan);
225
-
226
-void HAL_enable_AdcFreerun(void);
227
-//void HAL_disable_AdcFreerun(uint8_t chan);
228
-
229
-*/
230
-
231
 #define GET_PIN_MAP_PIN(index) index
208
 #define GET_PIN_MAP_PIN(index) index
232
 #define GET_PIN_MAP_INDEX(pin) pin
209
 #define GET_PIN_MAP_INDEX(pin) pin
233
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
210
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

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

49
 
49
 
50
 #define IS_INPUT(IO)
50
 #define IS_INPUT(IO)
51
 #define IS_OUTPUT(IO)
51
 #define IS_OUTPUT(IO)
52
-#define HAS_TIMER(IO)           true
53
 
52
 
54
-#define PWM_PIN(P)              HAS_TIMER(P)
55
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
53
+#define PWM_PIN(P)              true
56
 
54
 
57
 // digitalRead/Write wrappers
55
 // digitalRead/Write wrappers
58
 #define extDigitalRead(IO)    digitalRead(IO)
56
 #define extDigitalRead(IO)    digitalRead(IO)

+ 1
- 23
Marlin/src/HAL/HAL_TEENSY31_32/HAL.h View File

89
 #undef pgm_read_word
89
 #undef pgm_read_word
90
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
90
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
91
 
91
 
92
-#define RST_POWER_ON   1
93
-#define RST_EXTERNAL   2
94
-#define RST_BROWN_OUT  4
95
-#define RST_WATCHDOG   8
96
-#define RST_JTAG       16
97
-#define RST_SOFTWARE   32
98
-#define RST_BACKUP     64
99
-
100
 // Clear the reset reason
92
 // Clear the reset reason
101
 void HAL_clear_reset_source(void);
93
 void HAL_clear_reset_source(void);
102
 
94
 
128
 #define HAL_READ_ADC()      HAL_adc_get_result()
120
 #define HAL_READ_ADC()      HAL_adc_get_result()
129
 #define HAL_ADC_READY()     true
121
 #define HAL_ADC_READY()     true
130
 
122
 
131
-#define HAL_ANALOG_SELECT(pin) NOOP;
123
+#define HAL_ANALOG_SELECT(pin)
132
 
124
 
133
 void HAL_adc_start_conversion(const uint8_t adc_pin);
125
 void HAL_adc_start_conversion(const uint8_t adc_pin);
134
-
135
 uint16_t HAL_adc_get_result(void);
126
 uint16_t HAL_adc_get_result(void);
136
 
127
 
137
-/*
138
-uint16_t HAL_getAdcReading(uint8_t chan);
139
-
140
-void HAL_startAdcConversion(uint8_t chan);
141
-uint8_t HAL_pinToAdcChannel(int pin);
142
-
143
-uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
144
-//uint16_t HAL_getAdcSuperSample(uint8_t chan);
145
-
146
-void HAL_enable_AdcFreerun(void);
147
-//void HAL_disable_AdcFreerun(uint8_t chan);
148
-*/
149
-
150
 #define GET_PIN_MAP_PIN(index) index
128
 #define GET_PIN_MAP_PIN(index) index
151
 #define GET_PIN_MAP_INDEX(pin) pin
129
 #define GET_PIN_MAP_INDEX(pin) pin
152
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
130
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

+ 0
- 1
Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h View File

91
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
91
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
92
 
92
 
93
 #define PWM_PIN(P)            digitalPinHasPWM(P)
93
 #define PWM_PIN(P)            digitalPinHasPWM(P)
94
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
95
 
94
 
96
 /**
95
 /**
97
  * Ports, functions, and pins
96
  * Ports, functions, and pins

+ 1
- 23
Marlin/src/HAL/HAL_TEENSY35_36/HAL.h View File

97
 #undef pgm_read_word
97
 #undef pgm_read_word
98
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
98
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
99
 
99
 
100
-#define RST_POWER_ON   1
101
-#define RST_EXTERNAL   2
102
-#define RST_BROWN_OUT  4
103
-#define RST_WATCHDOG   8
104
-#define RST_JTAG       16
105
-#define RST_SOFTWARE   32
106
-#define RST_BACKUP     64
107
-
108
 /** clear reset reason */
100
 /** clear reset reason */
109
 void HAL_clear_reset_source(void);
101
 void HAL_clear_reset_source(void);
110
 
102
 
133
 #define HAL_READ_ADC()      HAL_adc_get_result()
125
 #define HAL_READ_ADC()      HAL_adc_get_result()
134
 #define HAL_ADC_READY()     true
126
 #define HAL_ADC_READY()     true
135
 
127
 
136
-#define HAL_ANALOG_SELECT(pin) NOOP;
128
+#define HAL_ANALOG_SELECT(pin)
137
 
129
 
138
 void HAL_adc_start_conversion(const uint8_t adc_pin);
130
 void HAL_adc_start_conversion(const uint8_t adc_pin);
139
-
140
 uint16_t HAL_adc_get_result(void);
131
 uint16_t HAL_adc_get_result(void);
141
 
132
 
142
-/*
143
-  uint16_t HAL_getAdcReading(uint8_t chan);
144
-
145
-  void HAL_startAdcConversion(uint8_t chan);
146
-  uint8_t HAL_pinToAdcChannel(int pin);
147
-
148
-  uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false);
149
-  //uint16_t HAL_getAdcSuperSample(uint8_t chan);
150
-
151
-  void HAL_enable_AdcFreerun(void);
152
-  //void HAL_disable_AdcFreerun(uint8_t chan);
153
-*/
154
-
155
 #define GET_PIN_MAP_PIN(index) index
133
 #define GET_PIN_MAP_PIN(index) index
156
 #define GET_PIN_MAP_INDEX(pin) pin
134
 #define GET_PIN_MAP_INDEX(pin) pin
157
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
135
 #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

+ 0
- 1
Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h View File

90
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
90
 #define extDigitalWrite(IO,V) digitalWrite(IO,V)
91
 
91
 
92
 #define PWM_PIN(P)            digitalPinHasPWM(P)
92
 #define PWM_PIN(P)            digitalPinHasPWM(P)
93
-#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
94
 
93
 
95
 /**
94
 /**
96
  * Ports, functions, and pins
95
  * Ports, functions, and pins

+ 9
- 0
Marlin/src/HAL/shared/Marduino.h View File

55
     //#define strchr_P(s,c) strchr(s,c)
55
     //#define strchr_P(s,c) strchr(s,c)
56
   #endif
56
   #endif
57
 #endif
57
 #endif
58
+
59
+// Restart causes
60
+#define RST_POWER_ON    1
61
+#define RST_EXTERNAL    2
62
+#define RST_BROWN_OUT   4
63
+#define RST_WATCHDOG    8
64
+#define RST_JTAG       16
65
+#define RST_SOFTWARE   32
66
+#define RST_BACKUP     64

Loading…
Cancel
Save