Skip to content

Commit e45eddf

Browse files
committed
🔨 Fix pins debugging for Simulator
1 parent 5004159 commit e45eddf

File tree

2 files changed

+52
-19
lines changed

2 files changed

+52
-19
lines changed
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
20+
#ifdef __PLAT_NATIVE_SIM__
21+
22+
#include "../../inc/MarlinConfig.h"
23+
#include "pinsDebug.h"
24+
25+
int8_t ADC_pin_mode(pin_t pin) { return -1; }
26+
27+
int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; }
28+
29+
bool GET_PINMODE(const pin_t pin) {
30+
const int8_t pin_mode = get_pin_mode(pin);
31+
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin
32+
return false;
33+
34+
return (Gpio::getMode(pin) != 0); // Input/output state
35+
}
36+
37+
bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
38+
return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin);
39+
}
40+
41+
void print_port(const pin_t) {}
42+
void pwm_details(const pin_t) {}
43+
bool pwm_status(const pin_t) { return false; }
44+
45+
#endif

Marlin/src/HAL/NATIVE_SIM/pinsDebug.h

+7-19
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,10 @@
3636
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
3737

3838
// Active ADC function/mode/code values for PINSEL registers
39-
constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; }
40-
41-
int8_t get_pin_mode(const pin_t pin) { return VALID_PIN(pin) ? 0 : -1; }
42-
43-
bool GET_PINMODE(const pin_t pin) {
44-
const int8_t pin_mode = get_pin_mode(pin);
45-
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // Invalid pin or active analog pin
46-
return false;
47-
48-
return (Gpio::getMode(pin) != 0); // Input/output state
49-
}
50-
51-
bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
52-
return !IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin);
53-
}
54-
55-
void print_port(const pin_t) {}
56-
void pwm_details(const pin_t) {}
57-
bool pwm_status(const pin_t) { return false; }
39+
int8_t ADC_pin_mode(pin_t pin);
40+
int8_t get_pin_mode(const pin_t pin);
41+
bool GET_PINMODE(const pin_t pin);
42+
bool GET_ARRAY_IS_DIGITAL(const pin_t pin);
43+
void print_port(const pin_t);
44+
void pwm_details(const pin_t);
45+
bool pwm_status(const pin_t);

0 commit comments

Comments
 (0)