-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore_pins.h
More file actions
204 lines (151 loc) · 5.58 KB
/
core_pins.h
File metadata and controls
204 lines (151 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*==============================================================================
core_pins.h - Pin definitions.
Copyright 2010 Rowdy Dog Software.
This file is part of Arduino-Tiny.
Arduino-Tiny is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Arduino-Tiny is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Arduino-Tiny. If not, see <http://www.gnu.org/licenses/>.
==============================================================================*/
#ifndef core_pins_h
#define core_pins_h
#include "core_build_options.h"
/*=============================================================================
Pin definitions for the ATtinyX313
=============================================================================*/
#if defined( __AVR_ATtinyX313__ )
#define PIN_D0 ( 0)
#define PIN_D1 ( 1)
#define PIN_A1 ( 2)
#define PIN_A0 ( 3)
#define PIN_D2 ( 4)
#define PIN_D3 ( 5)
#define PIN_D4 ( 6)
#define PIN_D5 ( 7)
#define PIN_D6 ( 8)
#define PIN_B0 ( 9)
#define PIN_B1 (10)
#define PIN_B2 (11)
#define PIN_B3 (12)
#define PIN_B4 (13)
#define PIN_B5 (14)
#define PIN_B6 (15)
#define PIN_B7 (16)
#define PIN_A2 (17) /* RESET */
#define CORE_DIGITAL_FIRST (0)
#define CORE_DIGITAL_LAST (17)
#define CORE_DIGITAL_COUNT (CORE_DIGITAL_LAST-CORE_DIGITAL_FIRST+1)
#define CORE_RESET_INCLUDED (1)
#define CORE_ANALOG_COUNT (0)
#define CORE_INT0_PIN PIN_D2
#define CORE_INT1_PIN PIN_D3
#define CORE_OC0A_PIN PIN_B2
#define CORE_OC0B_PIN PIN_D5
#define CORE_OC1A_PIN PIN_B3
#define CORE_OC1B_PIN PIN_B4
#define CORE_PWM0_PIN CORE_OC0A_PIN
#define CORE_PWM0_TIMER 0
#define CORE_PWM0_CHANNEL A
#define CORE_PWM1_PIN CORE_OC0B_PIN
#define CORE_PWM1_TIMER 0
#define CORE_PWM1_CHANNEL B
#define CORE_PWM2_PIN CORE_OC1A_PIN
#define CORE_PWM2_TIMER 1
#define CORE_PWM2_CHANNEL A
#define CORE_PWM3_PIN CORE_OC1B_PIN
#define CORE_PWM3_TIMER 1
#define CORE_PWM3_CHANNEL B
#define CORE_PWM_COUNT (4)
#endif
/*=============================================================================
Pin definitions for the ATtiny84
=============================================================================*/
#if defined( __AVR_ATtinyX4__ )
#define PIN_A0 (10)
#define PIN_A1 ( 9)
#define PIN_A2 ( 8)
#define PIN_A3 ( 7)
#define PIN_A4 ( 6)
#define PIN_A5 ( 5)
#define PIN_A6 ( 4)
#define PIN_A7 ( 3)
#define PIN_B0 ( 0)
#define PIN_B1 ( 1)
#define PIN_B2 ( 2)
#define PIN_B3 (11) /* RESET */
#define CORE_DIGITAL_FIRST (0)
#define CORE_DIGITAL_LAST (11)
#define CORE_DIGITAL_COUNT (CORE_DIGITAL_LAST-CORE_DIGITAL_FIRST+1)
#define CORE_RESET_INCLUDED (1)
#define CORE_ANALOG_FIRST (CORE_DIGITAL_LAST+1)
#define CORE_ANALOG_COUNT (8)
#define CORE_ANALOG_LAST (CORE_ANALOG_FIRST+CORE_ANALOG_COUNT-1)
#define CORE_INT0_PIN PIN_B2
#define CORE_OC0A_PIN PIN_B2
#define CORE_OC0B_PIN PIN_A7
#define CORE_OC1A_PIN PIN_A6
#define CORE_OC1B_PIN PIN_A5
#define CORE_PWM0_PIN CORE_OC0A_PIN
#define CORE_PWM0_TIMER 0
#define CORE_PWM0_CHANNEL A
#define CORE_PWM1_PIN CORE_OC0B_PIN
#define CORE_PWM1_TIMER 0
#define CORE_PWM1_CHANNEL B
#define CORE_PWM2_PIN CORE_OC1A_PIN
#define CORE_PWM2_TIMER 1
#define CORE_PWM2_CHANNEL A
#define CORE_PWM3_PIN CORE_OC1B_PIN
#define CORE_PWM3_TIMER 1
#define CORE_PWM3_CHANNEL B
#define CORE_PWM_COUNT (4)
#endif
/*=============================================================================
Pin definitions for the ATtiny85
=============================================================================*/
#if defined( __AVR_ATtinyX5__ )
#define PIN_B0 ( 0)
#define PIN_B1 ( 1)
#define PIN_B2 ( 2)
#define PIN_B3 ( 3)
#define PIN_B4 ( 4)
#define PIN_B5 ( 5) /* RESET */
#define CORE_DIGITAL_FIRST (0)
#define CORE_DIGITAL_LAST (5)
#define CORE_DIGITAL_COUNT (CORE_DIGITAL_LAST-CORE_DIGITAL_FIRST+1)
#define CORE_RESET_INCLUDED (1)
#define CORE_ANALOG_FIRST (CORE_DIGITAL_LAST+1)
#define CORE_ANALOG_COUNT (4)
#define CORE_ANALOG_LAST (CORE_ANALOG_FIRST+CORE_ANALOG_COUNT-1)
#define CORE_INT0_PIN PIN_B2
#define CORE_OC0A_PIN PIN_B0
#define CORE_OC0B_PIN PIN_B1
#define CORE_OC1A_PIN PIN_B1
#define CORE_OC1B_PIN PIN_B4
/* Note: By default, CORE_OC1A_PIN is not used for PWM. It overlaps with
CORE_OC0B_PIN. CORE_OC0B_PIN was used because it supports phase-correct PWM.
There is a build option in "core_build_options.h" to determine which channel
to use */
#define CORE_PWM0_PIN CORE_OC0A_PIN
#define CORE_PWM0_TIMER 0
#define CORE_PWM0_CHANNEL A
#if FAVOR_PHASE_CORRECT_PWM
#define CORE_PWM1_PIN CORE_OC0B_PIN
#define CORE_PWM1_TIMER 0
#define CORE_PWM1_CHANNEL B
#else
#define CORE_PWM1_PIN CORE_OC1A_PIN
#define CORE_PWM1_TIMER 1
#define CORE_PWM1_CHANNEL A
#endif
#define CORE_PWM2_PIN CORE_OC1B_PIN
#define CORE_PWM2_TIMER 1
#define CORE_PWM2_CHANNEL B
#define CORE_PWM_COUNT (3)
#endif
#endif