1 |
ron |
1 |
/**
|
|
|
2 |
* Marlin 3D Printer Firmware
|
|
|
3 |
* Copyright (C) 2017 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 |
|
|
|
23 |
//
|
|
|
24 |
// some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
|
|
25 |
// do not function the same as the other Arduino extensions
|
|
|
26 |
//
|
|
|
27 |
|
|
|
28 |
#ifndef __PINSDEBUG_TEENSYDUINO_H__
|
|
|
29 |
#define __PINSDEBUG_TEENSYDUINO_H__
|
|
|
30 |
|
|
|
31 |
#undef NUM_DIGITAL_PINS
|
|
|
32 |
#define NUM_DIGITAL_PINS 48 // Teensy says 46 but FASTIO is 48
|
|
|
33 |
|
|
|
34 |
// "digitalPinToPort" function just returns the pin number so need to create our own.
|
|
|
35 |
// Can't use the name "digitalPinToPort" for our own because it interferes with the
|
|
|
36 |
// FAST_PWM_FAN function if we do
|
|
|
37 |
|
|
|
38 |
#define PA 1
|
|
|
39 |
#define PB 2
|
|
|
40 |
#define PC 3
|
|
|
41 |
#define PD 4
|
|
|
42 |
#define PE 5
|
|
|
43 |
#define PF 6
|
|
|
44 |
|
|
|
45 |
const uint8_t PROGMEM digital_pin_to_port_PGM_Teensy[] = {
|
|
|
46 |
PD, // 0 - PD0 - INT0 - PWM
|
|
|
47 |
PD, // 1 - PD1 - INT1 - PWM
|
|
|
48 |
PD, // 2 - PD2 - INT2 - RX
|
|
|
49 |
PD, // 3 - PD3 - INT3 - TX
|
|
|
50 |
PD, // 4 - PD4
|
|
|
51 |
PD, // 5 - PD5
|
|
|
52 |
PD, // 6 - PD6
|
|
|
53 |
PD, // 7 - PD7
|
|
|
54 |
PE, // 8 - PE0
|
|
|
55 |
PE, // 9 - PE1
|
|
|
56 |
PC, // 10 - PC0
|
|
|
57 |
PC, // 11 - PC1
|
|
|
58 |
PC, // 12 - PC2
|
|
|
59 |
PC, // 13 - PC3
|
|
|
60 |
PC, // 14 - PC4 - PWM
|
|
|
61 |
PC, // 15 - PC5 - PWM
|
|
|
62 |
PC, // 16 - PC6 - PWM
|
|
|
63 |
PC, // 17 - PC7
|
|
|
64 |
PE, // 18 - PE6 - INT6
|
|
|
65 |
PE, // 19 - PE7 - INT7
|
|
|
66 |
PB, // 20 - PB0
|
|
|
67 |
PB, // 21 - PB1
|
|
|
68 |
PB, // 22 - PB2
|
|
|
69 |
PB, // 23 - PB3
|
|
|
70 |
PB, // 24 - PB4 - PWM
|
|
|
71 |
PB, // 25 - PB5 - PWM
|
|
|
72 |
PB, // 26 - PB6 - PWM
|
|
|
73 |
PB, // 27 - PB7 - PWM
|
|
|
74 |
PA, // 28 - PA0
|
|
|
75 |
PA, // 29 - PA1
|
|
|
76 |
PA, // 30 - PA2
|
|
|
77 |
PA, // 31 - PA3
|
|
|
78 |
PA, // 32 - PA4
|
|
|
79 |
PA, // 33 - PA5
|
|
|
80 |
PA, // 34 - PA6
|
|
|
81 |
PA, // 35 - PA7
|
|
|
82 |
PE, // 36 - PE4 - INT4
|
|
|
83 |
PE, // 37 - PE5 - INT5
|
|
|
84 |
PF, // 38 - PF0 - A0
|
|
|
85 |
PF, // 39 - PF1 - A1
|
|
|
86 |
PF, // 40 - PF2 - A2
|
|
|
87 |
PF, // 41 - PF3 - A3
|
|
|
88 |
PF, // 42 - PF4 - A4
|
|
|
89 |
PF, // 43 - PF5 - A5
|
|
|
90 |
PF, // 44 - PF6 - A6
|
|
|
91 |
PF, // 45 - PF7 - A7
|
|
|
92 |
PE, // 46 - PE2 (not defined in teensyduino)
|
|
|
93 |
PE, // 47 - PE3 (not defined in teensyduino)
|
|
|
94 |
};
|
|
|
95 |
|
|
|
96 |
#define digitalPinToPort_Teensy(P) ( pgm_read_byte( digital_pin_to_port_PGM_Teensy + (P) ) )
|
|
|
97 |
|
|
|
98 |
// digitalPinToBitMask(pin) is OK
|
|
|
99 |
|
|
|
100 |
#define digitalRead_mod(p) digitalRead(p) // Teensyduino's version of digitalRead doesn't
|
|
|
101 |
// disable the PWMs so we can use it as is
|
|
|
102 |
|
|
|
103 |
// portModeRegister(pin) is OK
|
|
|
104 |
|
|
|
105 |
#endif // __PINSDEBUG_TEENSYDUINO_H__
|