Prusa MINI Firmware overview
pinmapping.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4  *
5  * Based on Sprinter and grbl.
6  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 #include "../../../inc/MarlinConfigPre.h"
25 
26 #include <stdint.h>
27 #include "../hardware/Gpio.h"
28 
29 typedef pin_type pin_t;
30 
31 #define P_NC -1
32 constexpr uint16_t NUM_DIGITAL_PINS = Gpio::pin_count;
33 constexpr uint8_t NUM_ANALOG_INPUTS = 16;
34 
35 #define HAL_SENSITIVE_PINS
36 
37 // Get the digital pin for an analog index
38 pin_t analogInputToDigitalPin(const int8_t p);
39 
40 // Return the index of a pin number
41 int16_t GET_PIN_MAP_INDEX(const pin_t pin);
42 
43 // Test whether the pin is valid
44 bool VALID_PIN(const pin_t p);
45 
46 // Get the analog index for a digital pin
47 int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p);
48 
49 // Test whether the pin is PWM
50 bool PWM_PIN(const pin_t p);
51 
52 // Test whether the pin is interruptable
53 bool INTERRUPT_PIN(const pin_t p);
54 
55 // Get the pin number at the given index
56 pin_t GET_PIN_MAP_PIN(const int16_t ind);
57 
58 // Parse a G-code word into a pin index
59 int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
WITHIN
#define WITHIN(N, L, H)
Definition: macros.h:195
NUM_DIGITAL_PINS
constexpr uint16_t NUM_DIGITAL_PINS
Definition: pinmapping.h:32
pin_type
int16_t pin_type
Definition: Gpio.h:28
P_NC
#define P_NC
Definition: pinmapping.h:31
GET_PIN_MAP_PIN
pin_t GET_PIN_MAP_PIN(const int16_t ind)
DIGITAL_PIN_TO_ANALOG_PIN
int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p)
Gpio::pin_count
static const pin_type pin_count
Definition: Gpio.h:73
PWM_PIN
bool PWM_PIN(const pin_t p)
pin_t
int8_t pin_t
Definition: HAL.h:65
analogInputToDigitalPin
pin_t analogInputToDigitalPin(const int8_t p)
pinmapping.h
INTERRUPT_PIN
bool INTERRUPT_PIN(const pin_t p)
GET_PIN_MAP_INDEX
int16_t GET_PIN_MAP_INDEX(const pin_t pin)
uint8_t
const uint8_t[]
Definition: 404_html.c:3
NUM_ANALOG_INPUTS
constexpr uint8_t NUM_ANALOG_INPUTS
Definition: pinmapping.h:33
pin_t
pin_type pin_t
Definition: pinmapping.h:29
VALID_PIN
bool VALID_PIN(const pin_t p)
code
Definition: inftrees.h:24
PARSED_PIN_INDEX
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval)
createSpeedLookupTable.parser
parser
Definition: createSpeedLookupTable.py:14